On my freebsd box i have snmpd daemon from net-snmp-5.5_4 packet.

In snmpd.conf file i have:

extend . 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: graph

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.`

also you could take a look here too; http://www.fineconnection.com/How_to_set_the_net-snmp_agent_update_or_counter_refresh_interval

  • Yes! Looks like what i need. But: snmpset -v 2c -c private NET-SNMP-AGENT-MIB::nsCacheTimeout. i 1 return : Reason: noCreation (That table does not support row creation or that object can not ever be created) Failed object: NET-SNMP-AGENT-MIB::nsCacheTimeout. dont understood why... – Korjavin Ivan Apr 12 '12 at 8:42
  • @KorjavinIvan try to list your mibs first ; root@ubuntu:/etc/snmp# snmpwalk -v1 -c public localhost iso. = INTEGER: 2 and then change with root@ubuntu:/etc/snmp# snmpset -v2c -c public localhost iso. i 1 iso. = INTEGER: 1 if you have any problems with the listing, check comunity access. – cikuraku Apr 12 '12 at 10:05
  • Thanks. I mean: tryed modify all nsCacheTimeout which discovered by snmpwalk, set to 1. But graphs not changed, that why i suppose may be i must create some oid with combination of nsCache and my custom oid for extend - but thats not work. – Korjavin Ivan Apr 12 '12 at 10:09
  • @KorjavinIvan what is your NET-SNMP-AGENT-MIB::nsCacheEnabled.0 value ? if this value is true, you could try to disable it ant then check again . – cikuraku Apr 12 '12 at 11:06
  • i just check : NET-SNMP-AGENT-MIB::nsCacheEnabled.0 = INTEGER: false(2) and i never change this. So,looks like i am on wrong way? – Korjavin Ivan Apr 12 '12 at 17:29

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.

  • sorry, but its a pain. snmpd do alot for me. Auth, check ip, network daemon, etc.. I really dont want reiplement that. (And i know that with perl +mojo its simple, but i want one solution for all monitoring tasks) – Korjavin Ivan Apr 21 '12 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.