Is that an important measurement for switches and routes, as in “all time traffic”? To my knowledge, such counters would overflow at some point (32 bit counters) and you then also start with -1/0. Also, numbers will overflow in metric backends as well. The bandwidth as a rate is much more interesting as sample over time.
Here’s an interesting read on the topic:
Many of the variables accessible through SNMP are counters . Counters in SNMP are never reset, and they don’t have a defined starting value. So they can really only be used to measure rates: From two consecutive measurements of a counter, you can compute a rate by dividing the difference between the readings through the time interval between them. A common example are the per-interface “octet” (byte) counters for input and output traffic (
ifOutOctets ), that have been in SNMP since the very beginning and that are used for monitoring traffic rates.
Likely you can build such measurement samples with then detecting the gap and continue counting. I’ve seen patches in check_snmp_int.pl for this AFAIK.
Before going the route of creating such a plugin, I’d still recommend to find out why you need that (likely your boss told you so).