?
Solved

self running program

Posted on 2005-03-04
7
Medium Priority
?
265 Views
Last Modified: 2010-04-20
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

-KC-
0
Comment
Question by:kaseylund
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 35

Accepted Solution

by:
Duncan Roe earned 672 total points
ID: 13463544
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: http://servers.linux.com/servers/04/09/14/2317206.shtml
Nagios home page:- http://www.nagios.org/
Google for nagios gives many more articles &c.
0
 
LVL 38

Assisted Solution

by:wesly_chen
wesly_chen earned 664 total points
ID: 13463860
Hi,

   For system monitoring, I use Bigbrother.
http://www.bb4.org/

   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.

Regards,

Wesly
0
 
LVL 12

Assisted Solution

by:mburdick
mburdick earned 664 total points
ID: 13463983
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.





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

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

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

0
 
LVL 5

Expert Comment

by:Anonymouslemming
ID: 13542571
Wesley:

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 ?
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 13547249
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.

Wesly
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month15 days, 14 hours left to enroll

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question