DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

High Load Alert

10.22.2011
| 2386 views |
  • submit to reddit
        // Add the following one line command to crontab and run it every minute or every 5 minute. When the average server load is more than 40% send an alert to twitter account. Change the Username and Password.

myvar=$(cat /proc/loadavg | awk '{print int($1)}'); [ $myvar -gt 40 ] && curl --basic --user username:password --data status="Average load on server $myvar" http://twitter.com/statuses/update.xml