self running program

i need to write a program that runs twice every hour
it needs to check the system usage
save info to a folder
then once it saves info it needs to compair the new info to info it got a half hour ago
and if and disk has increased 10% it needs to send an email.

please help me

Who is Participating?
Duncan RoeConnect With a Mentor Software DeveloperCommented:
You *could* write a cron job to run every half hour which does what you want "man crontab" for more info on that.
But there is a systems monitoring package already written called Nagios, which can likely do what you want.
A good introduction:
Nagios home page:-
Google for nagios gives many more articles &c.
wesly_chenConnect With a Mentor Commented:

   For system monitoring, I use Bigbrother.

   It is quite easy to setup and you can adjust the report timeto every 30 minutes and send the alert email when the disk usage over
the threadhold (85%, you can customize it) or the specific process dead (httpd, smbd...) or the network connection drop.

   It's server-client base that you install the bb client on the machines you want to monitor and send the report to the bb server. And you
watch the report on the bb server through web browser. Give it a try.


mburdickConnect With a Mentor Commented:
Twice per hour = cron job. That's easy.

"check the system usage". What does that mean? Is that simply checking disk space usage?

Why do you only care if disk space usage has increased by 10% in 30 minutes? Is there a more useful "minimum" amount of disk space to base your checking on?

What about mount points?

Here's an example of a script that I run every 30 minutes to check for available disk space on one of my mount points (/var). If the value drops below 1GB free, it sends me an e-mail.

FREE=`df -m /var | grep dev | tr -s ' ' | cut -f4 -d ' '`

FREENUM=`echo $((10#$FREE))`

if [ $FREENUM -le 1000 ]
  echo "$FREENUM MB Free on /var" | /usr/bin/mail -s "Low Disk Space on SERVER" <EMAIL ADDRESS>


Just a comment / question on big brother - We've had to move away from it because of their licence. If I recall correctly, it has changed to being free for non-commercial use only, with a cost of about USD5000 per server now. Is this correct ?
Hi Anonymouslemming,
Good point, my big brother version was downloaded 2+ years ago....
Sigh. Whatever good stuff becomes commerical and is getting worse since less people use it and feed back to it.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.