Search This Blog

Thursday, May 3, 2012

Linux, Solaris and FreeBSD iostat monitoring with Cacti - Mark's blog

Linux, Solaris and FreeBSD iostat monitoring with Cacti - Mark's blog:

I've been looking for ages for a tool to parse the output from "iostat" on Linux, and graph it in Cacti. I found a few scripts and templates that did some of what I was looking for (disk I/O etc.), but nothing that gave me the full set of statistics such as queue length, utilisation, service time etc. I finally got round to writing my own set of templates and a data gathering script to provide this information, and it seems to work very well. So that others can benefit, I've posted the package archive and a brief description over on the Cacti forums (click Continue Reading for a download link to an updated version - the one on the Cacti forums has a bug so that it won't work with all versions of sysstat). Below are a couple of sample graphs to give you an idea of what it can do - there's also a few more samples posted in the Cacti forums thread :
Installation is a simple matter of creating a cron job to gather iostat data, extending your snmpd.conf to call the included script, and then importing the templates. Full instructions are included in the README within the archive (click the Continue Reading link to see them), but if you have any comments, suggestions or problems please let me know!
Update : Thanks to a patch from Viktor Sokolov, the script should now work with older sysstat versions, including the one that shipped with Debian Etch. I tried to update my original post over on the Cacti forums, but kept getting hit with a wonderful error message ("Mistake! Your message is sent to hell. Try still times who knows - can it will turn out?")
Update 2 : The package now supports Solaris.
Update 3 : The package now supports FreeBSD! The trinity is complete :-)
Update 4 : If you have trouble with the script (it returns no data in Cacti, graphs remain blank),  try increasing the SNMP timeout setting for the device in Cacti. Some people have reported increasing this from 500ms to 10000ms works...
Update 5 : There is now a much improved persistent version of the script included - see below for comments from "acq"
Update 6 : The package is now being maintained at GitHub. This means you can now grab the latest version by running 
git clone 
Hopefully, this will mean that I'll be able to incorporate patches more easily, as well as open up development to anyone who wants to fork their own versions. You can also download the latest tarball or ZIP archive from
In the meantime, you can grab the old tarball here if you don't have git installed.: cacti-iostat-1.6.tar.gz