--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/4f1d1f2d-4224-4cc6-9d00-cf0736a78732%40googlegroups.com.
Hi Dmitry,ifHCInOctets is a counter metric, which can reset to 0 at arbitrary times (like when your networking device restarts), so you cannot rely on its latest value to show you the total cumulative count of bytes over "all time". So with counters, you almost never want to look at their absolute value, but at their rate of increase (with resets handled by functions such as rate() or increase()).For example, you could do:increase(ifHCInOctets{ifDescr="ether1",ifIndex="3",ifName="ether1",instance="10.10.4.102",job="snmp"}[7d]) / 1e6...to calculate the total MB (in base 10) over 7d. Set the "7d" to a time range which is sufficient to mean "all time" for you, and you should get the increase you're looking for.I don't think you will need the "sum(...)" at all if you are selecting only one time series to begin with (looks like exactly one interface on one node). sum(...) would be for summing the values of multiple time series at one point in time.Regards,Julius
On Sun, May 10, 2020 at 2:11 PM Dmitry <barnyb...@gmail.com> wrote:
--Hi guys!I am new to prometheus and having some difficulties with it and have already become a little confused.I am trying to calculate the amount of incoming traffic for an interface for all the time in megabytes, which is displayed in octets.Please correct, what am I doing wrong?P.S. sorry for my English.ifHCInOctets{ifDescr="ether1",ifIndex="3",ifName="ether1",instance="10.10.4.102",job="snmp"} value=1433610926 this is how query looks in prom.sum(ifHCInOctets{ifDescr="ether1",ifName="ether1",instance="10.10.4.102",job="snmp"})/1000000 and i'm trying to calculate sum of traffic.As a result, my value=1433.610926
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/4f1d1f2d-4224-4cc6-9d00-cf0736a78732%40googlegroups.com.
What a strange situation. If you transfer the formula to grafana and die in time intervals, then the increase in 6 hours goes beyond more than 12.
Nevertheless, if we consider the total traffic not on the interface, but on the device, can we take mikrotik_interface_rx_byte and calculate sum?
Can you show the noob please, how the formula should look? Now nothing happens at all.
(increase(mikrotik_interface_tx_byte{address="$node",instance="212.90.175.74:9436"}[7d])) /1e6
(increase(ifHCInOctets{address="$node",instance="212.90.175.74:9436"}[7d])) /1e6