Monitoring Linux Disk Statistics with Cacti

I firstly want to acknowledge the work of Mark Round and Linux iostat monitoring with Cacti. The following work was inspired and based on the ideas found in Mark’s post.

My main objective when I started looking into disk monitoring was to get some similar stats into Cacti for Linux that can be found with the Windows PerfMon utility. I found Mark’s post and didn’t quite like the way it used cron to collect its statistics, and wanted something that I could easily add to snmpd.conf without needing to change much more. I was also keen on obtaining the mount point data for each partition as looking at “cciss/c0d0p3” doesn’t mean as much to management (and sometimes to me) and hopefully “/home” does.

So I wrote a script which uses the output from “df -l”, “vmstat -d”, “iostat -dk”, “iostat -xdk” to produce the results I wanted. This script only looks at the individual partition on the disk. Some of the stats don’t work with Software RAID, and some stats are missing for some older versions of the kernel when used with a HP Hardware RAID card (this is all I have tested with). These are the results.

Disk Stats - Data Transferred

Disk Stats - Operations

Disk Stats - Disk Queue Size

Disk Stats - Time On Disk

Disk Stats - Disk Utilisation

Disk Stats - Disk Wait Times


  • sysstat package
  • Net-SNMP
  • Tie::IxHash perl module
  • Cacti (Ver 0.8.7d minimum)


  1. Make sure you have the requirements installed.
    Tie::IxHash comes as a package on both Debian/Ubuntu and OpenSUSE and at the very least you could install it using CPAN.
    Sysstat also should come prepackaged for most Linux Distros.
  2. Copy the “disk_stats.xml” file from the archive into the “resource/snmp_queries” folder of your Cacti installation.
  3. Copy the “” file to your “/usr/local/bin” directory and run “chmod +x /usr/local/bin/“.
  4. Edit your “snmpd.conf” file and add the following line “pass . /usr/bin/perl /usr/local/bin/” (If that OID conflicts with another OID on your system you need to change the value used both in your snmpd.conf file and in the file. You will need to restart SNMPD after this change.
  5. Import the “cacti_data_query_snmp_-_disk_stats.xml” file into your Cacti installation using the “Import Templates” menu option.

You should now be able to open a device and add the “SNMP – Disk Stats” in the “Associated Data Queries” section.


This entry was posted in Cacti, Linux, Sys Admin and tagged , , , , , , . Bookmark the permalink.

2 Responses to Monitoring Linux Disk Statistics with Cacti

  1. Enrico says:


    Do you have also a version for redhat 5 or centos 5?
    Looks like that the output of vmstat is different, especially if LVM is involved

    Thank you a lot


  2. admin says:

    This is something I will be looking into soon, just haven’t had a lot of time for my personal tech work lately.

    It would be helpful if you could post a sample of your Centos/RHEL vmstat output.



Leave a Reply

Your email address will not be published. Required fields are marked *