Results 1 to 4 of 4
  1. #1

    Disk usage, SwapIO, load avg scripts


    I have found this script from below mention URL: Linux Web Admin

    I want some more suggestion and modification on this script to make it batter.

    Some useful script for yoru server maintenance:

    Script which will send you email alert when disk space usage is more than 70%:

    usage=`df -h | awk '{print $5}' | sed -e N -e 's/\n/ /' | awk '{print $2}' | tr -d % -s "\n"`
    devnm=`df -h | awk '{print $1}' | sed -e N -e 's/\n/ /' | awk '{print $2}' | tr -s "\n"`

    if [ $usage -ge 70 ]; then
    info="Disk usage for $devnm is more than 70% , Current Disk usage is $usage % "
    echo -e "$str\n$info\n$str" |mail -s "Alert: Disk Usage for `hostname` on `date`" [email protected]

    info="Disk Usage is $usage% for $devnm"
    # echo -e "$str\n$info\n$str" | mail -s "Alert: Disk Usage for `hostname` on `date`" [email protected]
    Script which will send you email alert when swapIO us more than 100 MB:

    Script which will send you email alert wehn load average is more than 5:

    avg=`uptime | awk '{print $8" " $9 " "$10 $11 $12 }' | tr -s , " "`
    cur=`uptime | awk '{print $10}' | tr -d , | cut -d. -f1`
    info="Curent $avg"

    if [ $cur -ge 5 ]; then
    info1="Server load is high presently"
    echo -e "$str\n$info\n$info1\n$str" | mail -s "Alert: Load Average for `hostname` on `date`" [email protected]
    # echo -e "$str\n$info\n$str"

  2. #2
    trendhoper:I will recomend nagios for this.
    It's great for check your service
    Nagios is always batter, than this script but this is a simple scripts at first level there should not be any comparision of this with nagios.

    However, Nagios is powerful tool for server monitoring at all level.

  3. #3
    Join Date
    Jul 2006
    I agree nagios is the way to go for that kind of monitoring. I've got it running with gnokii, so that I get sms alerts if anything is going wrong.

    I also have nagios via nrpe checking some static files on the server. I update the static file once a week with scripts that...
    - Check if there are any updates available via yum
    - Check for smart disk errors/run a badblocks scan
    - Check daily that backups have run and have been verified on the backup server
    - Run a nessus scan of the server and warn me if there are any changes
    Secure your server with

  4. #4
    Yes, I agree with you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts