Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linux server hardware monitoring via email 2

Status
Not open for further replies.
Aug 22, 2007
4
US
We want to monitor a Linux server for hard drive failure, free space running out etc. and have it send email warnings to our I.T. group. What would be the best program or method to use for this? Thank you.....
 
Expensive solutions: IBM Tivoli Monitoring, Patrol, etc...
Open Source: Nagios

There are also other solutions based on snmp you can try, just search for snmp server monitoring.
 
i have a bash script that runs from a cron job that monitors the disk usage the sends an email if it reaches a certain point. Not real time but it works pretty good.
 
This is the script
Code:
#!/bin/bash
#       This script determines the percentage of disk usage.
#       If that percentage is greater than 90% a user is emailed
#       a report notifying them of the usage.
#
#       Copyright 2006 Daniel McCarthy
# BE SURE TO CHANGE THIS TO YOUR EMAIL ADDRESS ;) 
emailUser="email.address@local.com"
typeset -i error="90"
if [ -e temp.txt ]; then
  rm temp.txt
fi
for disc in `mount| egrep '^/dev' | egrep -iv 'cdrom|proc|sys|pts' |awk '{print $3}'`
do
  typeset -i discUsage=`df -h $disc|cut -c40-42|grep -i [^a-z]`
  if [ "$discUsage" -ge "$error" ]; then
    echo "Disc usage for $disc is at $discUsage%" >> temp.txt
  fi
done
if [ -e temp.txt ]; then
  message=`cat temp.txt`
fi
if [ ${#message} -gt 0 ]; then
  cat temp.txt | mail  -s "Disc Usage Report for: $HOSTNAME" $emailUser
fi
 
x2 on nagios. You can do very basic monitoring and alerting with it or coax it into performing some pretty amazing feats.
 
Nagios is excellent for near realtime alerts (few minutes). For capacity planning/trending Cacti is also very good.

Running the two in tandem can give you an excellent overview of your enviroment.

I wish someone would just call me Sir, without adding 'Your making a scene'.

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top