Help with Cacti, SNMP, Disk I/O

Discuss Applications
Post Reply
User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Help with Cacti, SNMP, Disk I/O

Post by Void Main »

At work I make heavy use of a graphing tool called Cacti. Here's a tiny example on my home web stuff:

At work I probably have close to 1,000 graphs being managed in this utility. In addition to using the default templates I creat a lot of my own custom graphs and templates. In fact I have customized most parts of Cacti at work to suit my needs. In addition to all the SNMP stuff we also do a lot of custom scripts which gather data and update the RRD databases for things that can not be obtained via SNMP.

To make a long story short, I am looking for an easy way to graph disk utilization. I don't mean utilization as in %used but as in performance. I would like to be able to graph one or more of the following things for each individual disk (either logical or physical, whatever the OS can see):

Code: Select all

Basically, the sort of information you can get from the "iostat" command. Say you have two disks "hda" and "hdb". You could monitor this information with iostat by:

$ iostat -x /dev/hda -x /dev/hdb 5

which will update every 5 seconds. Actually, using the iostat command for the above example drive scenerio I would want to do this:

$ iostat -x /dev/hda -x /dev/hdb 300 2

which would get an average over 5 minutes and spit out the results from which I would want to use the second of the two results. Rather than doing this every 5 minutes and parsing the output and populating an rrd database I was hoping maybe there was some other way of getting this type of information.

What would be most handy for me would be to have this info obtainable via SNMP. One way I have been toying with is to have a script that runs the above iostat from cron every 5 minutes and parse the results into a nice format in a data file that is overwritten every time the command runs. Then create another little script that will read that data file and map the results to an SNMP OID. This is actually very easy to do with net-snmp (comes with most Linux distros) and there are nice examples in the included /etc/snmp/snmpd.conf file. I have actually used these custom OIDs quite a bit in the past.

Now the only reason I ask for help on this is because I don't know if there is an easier way. This information being exposed directly under /proc somewhere would make life easier and eliminate the need for the cron job (which is sort of messy if you ask me). I just can't think of any other way to do this.

The reason I would like to do this is to help identify bottlenecks on larger systems with lots of disks (but would be good for smaller systems just as well).

In fact in addition to being able to graph disk performance it might even be helpful to break it down to the partition level. Graphing things like reads/writes/trasactions per second to a specific parition might be helpful. I'll take any part of any of the above though.

Thanks for any help!

Post Reply