Redeveloped some initial scripts authored by Peter Bense with the following bits of shell and perl code to get a better idea of the load on our server and when things might need more immediate attention.
A sample of the server statistics this code produces can be seen at
Charlton Purvis created another nice layout of some of the above graphs at
Generally the process is to use the 'vmstat' command to produce an ongoing log which we periodically check(currently every 10 minutes) to produce more graphics or email alerts. We also append to a log file every 10 minutes the top 20 CPU consuming processes.
The files are attached below and a zip of all the files is server_stat.zip
From the readme.txt file:
The listed 'cron.txt' shows the cron job which runs the various shell commands.
vmstat.sh starts a new vmstat log at the beginning of each day, and graphs the results ( vmstatgnuplot.pl ) at days end.
vmstat10min.sh calls vm_10_min.pl which checks the past 10 minutes of log for conditions which warrant an email notification
vmstat60min.sh calls vm_60_min.pl which graphs CPU wait for the past hour
vm_x_min_plot.pl is run directly from the command line to create graphs for the past x observations
graphVM.lib is the gnuplot script for producing the graphs
vmstats.html is the html page with references to the associated images and logs.
- The graphing utility used for this is 'gnuplot' http://www.gnuplot.info
- The code also assumes a subdirectory called 'vmstatgraphs' where the produced images are stored.
- The 'iostat' and 'mpstat' commands could be run similarly for other statistics.
- A small cleanup script could be set to delete old files or trim file logs.
- 31 Mar 2005