| ONTSTAT{IDF="false",Interval="0",METype="NT",ResourceID="t",instance="172.27.173.103:8999",job="prometheus",rxByte="31",time="1608711202557174342",txByte="16"} | 1 |
| ONTSTAT{IDF="false",Interval="0",METype="NT",ResourceID="t",instance="172.27.173.103:8999",job="prometheus",rxByte="32",time="1608711202557246491",txByte="17"} | 2 |
| ONTSTAT{IDF="false",Interval="0",METype="NT",ResourceID="t",instance="172.27.173.103:8999",job="prometheus",rxByte="33",time="1608711202557257990",txByte="18"} | 3 |
On 2020-12-23 09:53, akshay sharma wrote:
> ONTSTAT{IDF="false",Interval="0",METype="NT",ResourceID="t",instance=":8999
--
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/54936447-5f4e-464a-6db7-b9359b8f3ac9%40hoffmann-christian.info.
Hi Christian,
Thanks for you reply,
ONTSTAT{IDF="false",Interval="0",METype="NT",ResourceID="t",instance="localhost:8999 ",job="prometheus",rxByte="33",time="1608711202557257990",txByte="18"} 4
what i've understood from your reply is , you are saying to break the metric into two metrics, one refers to rxbyte info with value and other one with txbyte info with value.and then perform action (like rx-tx) on using both of them.?????
That is correct. Metrics are the values you are wanting to store
over time. Labels attached to those metrics are purely
descriptions of those metrics (device name, location, service,
etc.) and not values which change over time themselves.
ex: as you mentioned..
ontstat_rx_bytes{device_id="1"} 31
ontstat_tx_bytes{device_id="1"} 16
I've one query, suppose I'm receiving the same metrics with different rx and tx values, but labels are the same(deviceid), and I want to perform some calculation between 1st (rx tx metrics ) and last (tx rx metrics).How can we achieve this?
It depends what calculation you are wanting to do. For example if
you wanted to add the rx & tx values you could just do
ontstat_rx_bytes + onststat_tx_bytes. For the example above you
would get the result {device_id="1"} 47
can you please elaborate on the below comment??
semantically to sum up rx/tx metrics, you might consider making it a
single metric with a label to distinguish, e.g.
ontstat_traffic_bytes{device_id="1",queue="tx"}.
The design of your metrics should reflect their meaning. As mentioned labels are there to describe different subsets of a metric (e.g different devices). It should be possible to remove all labels via an aggregation such as sum() and still have a value which is meaningful.
For example if you had a metric counting number of requests it
would make sense to have labels for status code or method. However
it would not make sense to have a metric where the values with a
label of "type=time" are durations and "type=number" are counts -
that would be two different metrics.
STAT{METype="NT",ResourceID="t",queue="rx",time="1608786795151775007"} | 31 |
| STAT{METype="NT",ResourceID="t",queue="rx",time="1608786795151813374"} | 32 |
| STAT{METype="NT",ResourceID="t",queue="rx",time="1608786795151855424"} | 33 |
| STAT{METype="NT",ResourceID="t",queue="tx",time="1608786795151775007"} | 1 |
| STAT{METype="NT",ResourceID="t",queue="tx",time="1608786795151813374"} | 2 |
| STAT{METype="NT",ResourceID="t",queue="tx",time="1608786795151855424"} | 3 |
Thanks for the clarification,
What if,there is multiple metrics with same labels but different valuesex:
STAT{METype="NT",ResourceID="t",queue="rx",time="1608786795151775007"}31 STAT{METype="NT",ResourceID="t",queue="rx",time="1608786795151813374"} 32 STAT{METype="NT",ResourceID="t",queue="rx",time="1608786795151855424"}
33
STAT{METype="NT",ResourceID="t",queue="tx",time="1608786795151775007"} 1 STAT{METype="NT",ResourceID="t",queue="tx",time="1608786795151813374"} 2 STAT{METype="NT",ResourceID="t",queue="tx",time="1608786795151855424"} 3
And i've to perform operations on specific metrics( 2nd and 5th, how can we fetch that particular series for operation.
Note: Just to clarify, above time labels are added,to push the same metrics multiple times.
You can't have multiple entries for the same metric (same name
and set of labels) during a single scrape.
What is the actual difference between the lines you listed above?
If it is just time then you would never be outputting these in a
single scrape. Each scrape will return the "current" value, which
would change over time.
5:04 PM (0 minutes ago) |
I understood your point
5:04 PM (0 minutes ago)
I'm not quite sure I understand what you mean by "each value is pushing two times"?
Prometheus will scrape your application at whichever scraping
frequency you set in the Prometheus configuration. Once data is
being ingested you will be able to run PromQL queries over it to
produce graphs and trigger alerts.
|
node_value{ID="1",instance="xx.xxx.xx.xx:x",job="prometheus",node="node1"} |
32 @1608811039.845 |