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

  • 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"