On my freebsd box i have snmpd daemon from net-snmp-5.5_4 packet.
In snmpd.conf file i have:
extend .1.3.6.1.4.1.2021.2 inpt /usr/bin/perl /usr/local/etc/snmp/mpdinput.pl
where mpdinput.pl my script which return input-octets from some mpd5-ng network interface.
Cacti reading this value and plot such graphs:
I added red lines to graph.
In marked places snmpd cache the result and return prev values, thats why rrdtool plot zero activity. And its a problem for me.
How to prevent caching result in snmpd?
according to the snmp documentation;
`extend [MIBOID] NAME PROG ARGS works in a similar manner to the exec directive, but with a number of improvements. The MIB tables (nsExtendConfigTable etc) are indexed by the NAME token, so are unaffected by the order in which entries are read from the configuration files. There are two result tables - one (nsExtendOutput1Table) containing the exit status, the first line and full output (as a single string) for each extend entry, and the other (nsExtendOutput2Table) containing the complete output as a series of separate lines. If MIBOID is specified, then the configuration and result tables will be rooted at this point in the OID tree, but are otherwise structured in exactly the same way. This means that several separate extend directives can specify the same MIBOID root, without conflicting.
The exit status and output is cached for each entry individually, and can be cleared (and the caching behaviour configured) using the nsCacheTable.`
If you can use your perl script as an extension in snmpd then you should also be able to use it as a direct data source in Cacti as well, skipping snmpd altogether.