1 Disk space utilisation

You need to be aware of two MIBs which can be used for monitoring disk space.

1.1 hrStorageTable (.

This comes from HOST-RESOURCES-MIB and is the "standard" way of returning disk space utilisation. It is supported by many vendors, including Windows SNMP Agent, and enabled by default in Linux net-snmp as well.

It is limited to returning 2^31 filesystem blocks, which means you can have problems when monitoring large filesystems (e.g. an 8TB filesystem with 4KB blocks)

Use snmpwalk to look at it. You will see entries for various things including RAM utilisation, but the mounted partition(s) will be included as members of type hrStorageFixedDisk.

$ snmpwalk -v2c -c NetManage localhost hrStorageTable
HOST-RESOURCES-MIB::hrStorageIndex.31 = INTEGER: 31
HOST-RESOURCES-MIB::hrStorageType.31 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageDescr.31 = STRING: /
HOST-RESOURCES-MIB::hrStorageAllocationUnits.31 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageSize.31 = INTEGER: 4934317
HOST-RESOURCES-MIB::hrStorageUsed.31 = INTEGER: 232406

1.2 dskTable (.

This MIB is proprietary to the net-snmp daemon which runs under Linux/Unix. It is a convenient alternative when monitoring a Linux/Unix box if there are problems with hrStorageTable. It also can have problems with very large filesystems, except for very recent net-snmp versions.

If you want to enable this MIB you need to list all the filesystem mount point(s) you want to monitor in snmpd.conf

$ sudo editor /etc/snmp/snmpd.conf
... add this line somewhere ...
disk /

$ sudo service snmpd restart
$ snmpwalk -v2c -c NetManage localhost dskTable
UCD-SNMP-MIB::dskIndex.1 = 1
UCD-SNMP-MIB::dskPath.1 = /
... etc

2 Cacti configuration

To make things complicated, Cacti has several different data queries pre-defined.

You may get one or other of these data queries automatically added for you based on which Host Template you chose when creating a host. You can always add another query if you wish, and/or remove the one you don't want.

2.1 How to collect hrStorageTable from a device

If you see "Success [0 Items, 0 Rows]" then there is a problem. Find it and fix it, and click on "verbose query" again until you see something like "Success [24 Items, 8 Rows]"

2.2 Create graphs

Now go to "Create Graphs for this Host". Under "Data Query [SNMP - Get Mounted Partitions]", check the box(es) next to the partitions you want to graph, and then click Create at the bottom of the page.

If this is a new host, add it into a graph tree.

3 Monitoring disk I/O operations

You can use Cacti to monitor disk I/O (that is, read/write transactions per second and bytes per second). This MIB is available in recent versions of Linux snmpd.

However, out-of-the-box Cacti does not have the data query for this, so you need to install a new data query and graph templates. This can be done on a standard Cacti installation - it does not require the Cacti Plugin Architecture.

3.1 Download the configuration

Firstly, go to http://docs.cacti.net/usertemplate:data:host_mib:diskio and download the file with a name like 'diskio087d.tar.gz', and extract the two XML files it contains. You could do this under Linux like this:

$ wget http://docs.cacti.net/_media/usertemplate:data:host_mib:diskio087d.tar.gz
$ gzip -dc usertemplate:data:host_mib:diskio087d.tar.gz | tar -xvf -

This should give you two files:

3.2 Install the configuration files

disk_io.xml needs to be installed in the Linux box in the correct directory:

$ sudo cp disk_io.xml /usr/share/cacti/resource/snmp_queries/disk_io.xml

The other file needs to be installed via the web interface. Login to Cacti via the web browser, click "Import Templates". Next to "Import Template from Local File" click "Choose"; select the file; then click "Save"

Note: this means that you'll have to have the file cacti087d_data_query_snmp_-_get_disk_io.xml on your PC or laptop. You can copy it to your laptop using something like Putty PSFTP (or another Windows scp or sftp client). Alternatively, just download the original .tar.gz file to your laptop and unpack it again there.

You should see "Cacti has imported the following items..."

Go to Data Queries and you should see "SNMP - Get Disk IO" as a new entry.

3.3 Switch to 64-bit counters

Unfortunately, using 32-bit counters for disk I/O means that with 5-minute polling, you graphs will break if you exceed about 14MB/sec of disk activity.

Modern versions of net-snmp support 64-bit counters. You can check this by doing:

snmpwalk -v2c -c <community> <target> UCD-DISKIO-MIB::diskIOTable

If you see diskIONReadX and diskIONWrittenX (note the final "X") then you have extended or 64-bit counters.

To use them, edit /usr/share/cacti/resource/snmp_queries/disk_io.xml and change the OIDs as follows:

        <name>Number of Bytes Read</name>
        <oid>.</oid>   ## change final .3 to .12
        <name>Number of Bytes Written</name>
        <oid>.</oid>   ## change final .4 to .13

3.4 Start monitoring

If you want to monitor both Bytes per second and Transactions per second, then repeat the process to create graphs of the other type.

3.5 Interpreting the results

It is helpful to have a good idea how many operations per second you can expect your drives to be able to handle. There is a good background article here: http://www.symantec.com/connect/articles/getting-hang-iops