Sometimes it’s difficult to setup Nagios for server monitoring. This is what I do instead.
Firstly, for load monitoring:
#!/bin/bash FILENAME=< absolute path >/monitoring/logs/load-$(date +%Y%m%d).txt cat /proc/loadavg | awk '{print strftime("%Y/%m/%d %H:%M:%S", systime()), $1, $2, $3}' >> $FILENAME
Run it both from cron, and then I use another cron script and gnuplot to graph the output.
genloadgraph.sh:
DATE=$1 if [ -z $DATE ]; then DATE="$(date +%Y%m%d)"; fi FILENAME=load-$DATE.txt cp < absolute path >/monitoring/logs/$FILENAME < absolute path >/monitoring/load.txt gnuplot < absolute path >/monitoring/loadplot.p rm < absolute path >/monitoring/load.txt
loadplot.p:
set terminal png large size 800,600 set xdata time set timefmt "%Y/%m/%d %H:%M:%S" set title "Load" set format x "%H:%M:%S" set out '< absolute path >/monitoring/load.png' plot "< absolute path >/monitoring/load.txt" using 1:3 title '1 min average' with lines, "< absolute path >/monitoring/load.txt" using 1:4 title '5 min average' with lines, "< absolute path >/monitoring/load.txt" using 1:5 title '15 min average' with lines set output
Gives a graph like this:
It possible to do a similar thing for website monitoring:
#!/bin/bash FILENAME=< absolute path >/monitoring/logs/nicklothian-$(date +%Y%m%d).txt (time wget -q --delete-after http://nicklothian.com/blog/) 2>&1 | awk '/real/ {print strftime("%Y /%m/%d %H:%M:%S", systime()), $2}' >> $FILENAME
Nice :) A man’s gotta do what a man’s gotta do.
Agree on the errrr complexity on installing Nagios, however Nagios is really not a trend tool. It is better on determinging if services/servers are up/down and send alerts to whom it may concern that the disk burned.
If you haven’t already, try Cacti.net, easy as hell and tons of extra templates to load into it like mysql, lighttpd, apache etc.