Small solution for server statistics

Purpose

Once I needed small statistics collecting and displaying solution, that I could access from my web browser on a server where PHP was not an option. Because of that Cacti was not an option. So I quickly hacked this piece of shi^H^H^H script :-)

I'm not going to explain how to setup collectd, a statistics gathering daemon which I use for myself.

Output

Sample output:

Requirements

  • collectd (for collecting data to RRD)
  • rrdtool (for RRD libraries and graphing tool)
  • simple httpd server, e.g. lighttpd (don't worry Apache works too ;)

(It's also possible to use SNMP and write data to RRD yourself)

Little step by step guide of my crappy script

1) These files should be placed under /opt/graphrrd/ Or if you want in another place (e.g. your home dir), you'll have to substitute corresponding lines in scripts.

2) The output by default will be placed in /var/www/stats/, so create that dir before running any script.

3) Some default values are in /opt/graphrrd/_values check them out.

4) To make sure everything is OK run /opt/graphrrd/graphall If you see any errors/warnings, then act according to them. Else go to step 5.

5) Everythings working from step 4? Lets pretend, for the sake of the guide, that it's OK :)

To execute script periodicaly you can use these lines in crontab:

*/5 * * * * /opt/graphrrd/graphall   2>&1 1> /dev/null
1 6 * * *   /opt/graphrrd/graphall w 2>&1 1> /dev/null
2 6 * * *   /opt/graphrrd/graphall m 2>&1 1> /dev/null

'graphall' just runs all the individual scritps, that way they generate graphs.

6) Now point your web browser to http://yourserver/stats/ or where have you configured it.

Downloading

See attachments on this post. The file is called graphrrd.tar_.bz2 (yes, I noticed, that my CMS added underscore after 'tar').

AttachmentSize
graphrrd.tar_.bz24.01 KB
cpu3-d.png51.55 KB
mem-d.png50.5 KB
eth-d.png50.26 KB
eth-packets-d.png48.33 KB
load-d.png62.76 KB
---