This project is a source-code of the 0.7 version of cacti-netsnmp-memory produced by Eric A. Hall which is available on his website: http://www.eric-a-hall.com/software/cacti-netsnmp-memory/
I have replicated the page as a readme here in its entirety. The purpose of this repo is merely to control changes that I make to enable the netsnmp template to work with cacti 1.1.30.
Copyright for this template/code is held by Eric A Hall: Copyright © 2010-2017 Eric A. Hall.
Although the Linux version of Cacti includes multiple script templates for monitoring memory utilization on various *NIX systems, the graphs that are produced by the default tools are not very informative. For example, the memory usage script template for the Cacti server's local Linux system (as measured through local operating system calls) only shows free memory and swap space usage, and does not display the total real memory or the amount that has been used. Meanwhile, the "ucd/net" script template that reads memory usage data from Net-SNMP MIBs also omits critical data, partly due to the fact that different operating systems implement the Net-SNMP MIBs differently.
Figure 1
This script template is intended to overcome these shortcomings by fetching all of the available memory data from all known sources (including the standard HOST MIB), and then performing basic arithmetic to fill in any gaps in the data. For illustration purposes, the sample graph below shows the memory usage for a Linux host with 1 gigabyte of RAM. In that chart, the amount of real memory that is available to the system is displayed along with the amount of memory that has been reserved for processes ("used real"), the amount that has been allocated for buffers and disk caching, the amount that has not been allocated ("unused real"), and the amount of swap space that is currently in use. Note that this is the full and complete set of data, and some operating systems may provide much less data to the relevant SNMP MIBs.
To use this script template, perform the following steps:
Note: Release 0.7 is intended to be used with Cacti 0.8.6 and 0.8.7 and PHP 5.2, and may not operate as expected with other versions. Note: Release 1.0 is intended to be used with Cacti 1.x
In some cases you may want to execute the script file manually for debugging purposes. The parameters to the script use a fixed structure that is optimized for use with the Cacti poller, but also allows for human interaction.
In particular, the script uses an SNMP protocol "bundle" of the following values, separated by colon characters: In those cases where a value is unneeded (such as SNMP v3 authentication credentials for an SNMP v2 query), or where a default value is adequate (such as the SNMP port number), the value can be omitted.
Taken as a whole, a valid SNMP bundle for the localhost device using SNMP v2 with the community string of "public" on the default port number and a default timeout would be "'localhost' '2' 'public' '' '' '' '' '' '' '' ''".
The output from the script contains the all of the data that is needed to populate the RRD file and associated graph template.
The full exchange for these requests, using example data from above, are shown below:
$ php ss_netsnmp_memory.php ss_netsnmp_memory '127.0.0.1' '2' 'public' '161' '500' '' '' '' '' '' ''
totalReal:2059672 availReal:386380 totalSwap:4241144 availSwap:4224844 memBuffer:900 memCached:1046992 usedReal:625400 usedSwap:16300