WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Server monitoring with email alerts  (Read 4694 times)

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Server monitoring with email alerts
« on: February 19, 2012, 11:25:12 PM »
Hi all,

The tinycore based samba server is up and running for two weeks now, and is working well.
I've tested a few different combinations of tinycore and samba and have come up with the following stable recipie.

Tinycore v 3.8.4
Samba v 3.4.5

I'm storing my tce folder on a small partition I created as our community centre does not have enough usb flash drives to spare.

Bit of forum searching uncovered the tce-setdrive command, which allowed me to set the tce folder without the gui :)

I am going on a trip with the church in April to a hospital they are setting up in the solomon islands and am considering installing tinycore+samba as a file server for them. Does anyone know if there is a tc extension that sends regular system status via email ? I've found nagios with google, and it looks ok, if there is nothing already available, i'll make it into an extension. They have internet via satellite at the site.
Live long and prosper.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Server monitoring with email alerts
« Reply #1 on: February 19, 2012, 11:46:15 PM »
Hi remus
Depending on what you are trying to do, you might be able  to set up a script to gather the information you wish
to monitor. Use  cron  to run it once a day, and possibly  alpine  to send an email.

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: Server monitoring with email alerts
« Reply #2 on: February 20, 2012, 01:32:39 AM »
Hi Rich,
I guess I could do it with shell scripts.

I have a bit of learning to do here.
- enabling emailing in tinycore
- gathering system status, samba logs, hard drive health status
- emailing it out of tinycore

Hmm looks achievable.

Whats the best approach to gathering system satus information, and putting it into an email ?
Live long and prosper.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Server monitoring with email alerts
« Reply #3 on: February 20, 2012, 01:52:27 AM »
Hi remus
It depends on what kind of data you wish to gather. In general, the script would start by creating a temporary
work directory.
1. mkdir workdirectory
2. Copy any required log files to it.  (Samba, dmesg > filename, syslog, etc.)
3. Use the hdparm utility for drive information   (hdparm [switches] > filename)
4. Use ifconfig > filename  to check for excessive network errors
5. tar zcf workdirectory.tar.gz workdirectory   (assumes you are just above workdirectory when executed)

That should give you a starting point. Sorry, I don't have any experience with automating emails, maybe
someone else will offer some advice.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Server monitoring with email alerts
« Reply #4 on: February 20, 2012, 02:14:58 AM »
Try logwatch http://sourceforge.net/projects/logwatch/

Unfortunately it is not in the repo but it is written in Perl, so no need to compile.
« Last Edit: February 20, 2012, 02:32:08 AM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: Server monitoring with email alerts
« Reply #5 on: February 21, 2012, 10:34:29 PM »
Thanks for the Logwatch link, I'll check it out tonight.

Heres another tool that looks interesting: http://mmonit.com/monit/
I've started the build process and ran into problem's, I'll post some of the error messages when i get home tonight.
Live long and prosper.

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: Server monitoring with email alerts
« Reply #6 on: February 22, 2012, 02:02:06 AM »
I got a bunch of odd make errors when I tried to build monit, sorry but I'll post proper examples when I get home, it had something to do with   PAM   is that a part of an existing extension ?
Live long and prosper.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Server monitoring with email alerts
« Reply #7 on: February 22, 2012, 02:06:07 AM »
Hi remus
There is the  Linux-PAM.tcz  extension as well as the  dev  version.

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: Server monitoring with email alerts
« Reply #8 on: February 22, 2012, 07:37:51 AM »
How did you find that Rich ?
I searched for pam and PAM with ab with no luck.
I just now tried with the wild card *PAM and *pam but that did not work. Experimented with wild cards and they do seem to work

In the past I've browsed the repository here : http://distro.ibiblio.org/tinycorelinux/4.x/x86/tcz/ but that takes a bit of bandwidth to load.
Live long and prosper.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Server monitoring with email alerts
« Reply #9 on: February 22, 2012, 10:53:07 AM »
Hi remus
In this case I used the provides function to search for pam. That function searches for a match anywhere in the files list.
Just be aware that this type of search can return many other extensions as well.

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: Server monitoring with email alerts
« Reply #10 on: February 22, 2012, 06:18:56 PM »
Can you give me an example ?

I've googled "Linux provides function" which returns a staggering amount of hits about how great linux is :) but nothing about how to search through the repository file list.
Live long and prosper.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Server monitoring with email alerts
« Reply #11 on: February 22, 2012, 06:34:59 PM »
Linux does not have a provides function.
Perhaps your time would be better spent reading the wiki and searching the fora.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Server monitoring with email alerts
« Reply #12 on: February 22, 2012, 08:49:10 PM »
Hi remus
Sorry, I left out the part  about opening AppBrowser, and then changing the search button to  Provides.

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
Re: Server monitoring with email alerts
« Reply #13 on: February 23, 2012, 02:58:31 AM »
Thanks Rich.
Live long and prosper.

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
Re: Server monitoring with email alerts
« Reply #14 on: February 23, 2012, 04:16:24 AM »
OT:  In a little we will have the tag and this should not happen again!  :D