Check SNMP value when SNMP data-type is COUNTER?

Hi!

I have been running Nagios for a couple of weeks now and it is great. Now that the basics are up i am starting to look at some more refined checks.

I would like to check the Unicast Packets and Non-Unicast Packets that are a part of the standard RFC 1213 MIB II definition.

But… I do not get it to work since the type is a counter and has to be compared to the previous value to work in comparison to the GAUGE type. I have tried the check_centreon_snmp_value where there are a option “-t GAUGE/COUNTER” but it does not work since the “-t COUNTER” only reads the value and compares with the threshholds i put for -w and -c

I have found check_snmp_int.pl and check_snmp_netint.pl plugins but they do not check packets and does not seem to support entering manual OID:s.

So…

How do i check a SNMP value that is of the type COUNTER?

You could write a script that would output the first check to some file, and then after 5 minutes or so (dependent on your wish of how much time you want between checks), do another check that would compare the values and subtract them. That is a way of how you could get the 5 minutes counter value.

The output for Nagios would take the subtraction result and use it as the Unicast value in time period you specified.

Of course the first check would have the value of the first check since you don’t have the starting value (or we can say you have it but it is 0), but every other check would result in correct value.

Ok, writing a script yourself is always a solution but i thought that reading a snmp value, COUNTER or GAUGE was a rather common task in Nagios. There are several scripts that do this already check_centreon_snmp_traffic, check_snmp_int.pl and check_snmp_netint.pl are all reading COUNTER types. But does not allow manual OID input.

So, perhaps its just to modify one of the above to suit my needs. Just thougth that this has been done before.