Calculating rate and check_snmp

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jeff_gunn
Posts: 5
Joined: Mon Jun 28, 2010 3:01 pm

Calculating rate and check_snmp

Post by jeff_gunn »

Hello all,

I'm using check_snmp to poll some network devices for in_octets and out_octets to see how much traffic is flowing over some interfaces. I have it polling with the default 5min interval and I set the check_snmp arguments to use the "-rate" option to calculate the difference between the current value and the previous value, as the counter on the switch gives total octets on the interface, not rate per second or anything.

This seems to work fine.

What I'd like to know is, how does the "-rate" argument calculate? For example, does it somehow check and see that my service monitor is configured to poll at a 5min interval and include the polling interval in its math (maybe using the mod date on the previous temp file)? Or is it simply returning the octet count since the last check, and therefore I'd need to do additional math to take the polling interval into account (in this case, 5min * 60sec = 300sec, so divide the returned value by 300 to calculate the octets/sec value)?

Thanks for your help,
Jeff
User avatar
admin
Site Admin
Posts: 256
Joined: Mon Oct 12, 2009 8:21 am

Re: Calculating rate and check_snmp

Post by admin »

That's a very good question. It would probably require digging into the code behind the plugin to see what its doing behind-the-scenes. Has anyone else using the -rate option with this plugin before?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Ethan Galstad
President
jeff_gunn
Posts: 5
Joined: Mon Jun 28, 2010 3:01 pm

Re: Calculating rate and check_snmp

Post by jeff_gunn »

Thanks for the prompt reply. Can you tell me where I'd find the file? I'm running a copy of the Nagios XI virtual machine. I'll see if I can decipher what's happening in the plugin code, but my skills are limited outside of C and C++ so no guarantees I'll be much use in that regard.

Mr. Admin, do you have a programming resource on your end that might be able to take a look as well?

Thanks,
Jeff
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Calculating rate and check_snmp

Post by mguthrie »

All of the check plugins are located at /usr/local/nagios/libexec/

This check is actually written in C, you can download the source package of plugins and take a look at the source code.
http://www.nagios.org/download/plugins/

Most of the nagios check plugins are community developed, you could take a look at the code and email the developers list with questions or patches.
jeff_gunn
Posts: 5
Joined: Mon Jun 28, 2010 3:01 pm

Re: Calculating rate and check_snmp

Post by jeff_gunn »

A little follow-up from the RTFM department... :roll:

"Rate Calculation:
In many places, SNMP returns counters that are only meaningful when
calculating the counter difference since the last check. check_snmp
saves the last state information in a file so that the rate per second
can be calculated. Use the --rate option to save state information.
On the first run, there will be no prior state - this will return with OK.
The state is uniquely determined by the arguments to the plugin, so
changing the arguments will create a new state file."

So the intention, clearly, is for the -rate argument to validate previous state information and calculate rate-per-second based on that (which can be modified by the multiplier argument). I may still discuss it with the developers but I'm pretty confident for the time being. If I get a firm answer, I'll post back.
Locked