# Icinga2 Store Traffic Values

**URL:** <https://community.icinga.com/t/icinga2-store-traffic-values/2604>\
**Category:** Icinga 2\
**Created:** [October 25, 2019, 3:09pm UTC](https://community.icinga.com/t/icinga2-store-traffic-values/2604 "2019-10-25T15:09:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jafi](https://community.icinga.com/user_avatar/community.icinga.com/jafi/32/1385_2.png) [@jafi](https://community.icinga.com/u/jafi)\
**Post date:** [October 25, 2019, 3:09pm UTC](https://community.icinga.com/t/icinga2-store-traffic-values/2604/1 "2019-10-25T15:09:39Z")

</div>

hello

whats the value to store traffic?  
currently most of my plugins return value since reboot but graphite does not show this correctly.  
should i store last value and subtract them from current in plugin check or is there a solution to tell graphite to do this?

thanks

---

<div class="post-metadata">

**Author:** ![dnsmichi](https://community.icinga.com/user_avatar/community.icinga.com/dnsmichi/32/7721_2.png) [@dnsmichi](https://community.icinga.com/u/dnsmichi)\
**Post date:** [October 25, 2019, 3:11pm UTC](https://community.icinga.com/t/icinga2-store-traffic-values/2604/2 "2019-10-25T15:11:09Z")

</div>

> [@jafi](#):
>
> currently most of my plugins return value since reboot but graphite does not show this correctly.

I cannot follow here. Which plugins are you using and how does their graph look like in Graphite?  
What’s the current value and which value do you expect?

Cheers,  
Michael

---

<div class="post-metadata">

**Author:** ![jafi](https://community.icinga.com/user_avatar/community.icinga.com/jafi/32/1385_2.png) [@jafi](https://community.icinga.com/u/jafi)\
**Post date:** [October 25, 2019, 3:34pm UTC](https://community.icinga.com/t/icinga2-store-traffic-values/2604/3 "2019-10-25T15:34:05Z")

</div>

![Unbenannt](https://community.icinga.com/uploads/default/original/2X/6/6bba848c5129e33dbb1292c787a5e53bcfd3e38c.png)  
make sense to get traffic since last check and not since last reboot.

i read via snmp the traffic from switches and routers via oid. most (or all) devices return int of bytes since reboot. and i want to ask should i create an plugin which stores value local and subtract current value from local stored value.

regards

---

<div class="post-metadata">

**Author:** ![dnsmichi](https://community.icinga.com/user_avatar/community.icinga.com/dnsmichi/32/7721_2.png) [@dnsmichi](https://community.icinga.com/u/dnsmichi)\
**Post date:** [October 25, 2019, 3:50pm UTC](https://community.icinga.com/t/icinga2-store-traffic-values/2604/4 "2019-10-25T15:50:03Z")

</div>

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](https://wiki.geant.org/display/public/EK/SNMP+Counter+Wrap) 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 ( `ifInOctets` and `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).

Cheers,  
Michael

---

<div class="post-metadata">

**Author:** ![jafi](https://community.icinga.com/user_avatar/community.icinga.com/jafi/32/1385_2.png) [@jafi](https://community.icinga.com/u/jafi)\
**Post date:** [October 25, 2019, 4:03pm UTC](https://community.icinga.com/t/icinga2-store-traffic-values/2604/5 "2019-10-25T16:03:17Z")

</div>

![pmacct2graphite](https://community.icinga.com/uploads/default/original/2X/a/a9edb5b75a267da171f78aa0a3933270e4c4dbb6.png)  
i am looking to getting graphs like this.  
So when i understand you right, best is to:

> dividing the difference between the readings

then i can look for existing plugins which already do this or change code of our existing perl scripts.
