On 2020-12-23 09:53, akshay sharma wrote:
ONTSTAT{IDF="false",Interval="0",METype="NT",ResourceID="t",instance="172.27.173.103:8999 ",job="prometheus",rxByte="33",time="1608711202557257990",txByte="18"} 3


1) I want to perform some action on the labels of metrics above, how can we achieve this?
ex: rxbyte-txbyte/timestamp
You seem to have created a single metric with several labels which contain values. This is problematic, because that's not what Prometheus was designed for. You will likely get performance issues and will miss methods to work with your data.

2) Above metrics that support multiple values?? like list or map
Not directly. This is solved using multiple metrics in Prometheus.

3) As prometheus uses a TSDB, like influx, how can we query series from prometheus DB?
Prometheus contains a TSDB. It can be queried using PromQL. There is no other, secret interface or something.

4) Does promql support operations on labels?
Yes, it supports some operations (such as label_replace()), but this is probably not what you are looking for. All values which you want to be part of calculations should be the value of a metric, not the label content.

To provide more explicit guidance how your metrics should look like, we would need some more context. I assume that you are monitoring some kind of network interface. I guess it will have some kind of ID (maybe that's the numbers 1 to 10 which you currently store as a value?). I'll just assume it can be called device_id.

The metrics for one such device could look like this:

ontstat_rx_bytes{device_id="1"} 31
ontstat_tx_bytes{device_id="1"} 16
ontstat_idf{device_id="1"} 0 # 0 for false
ontstat_info{device_id="1",type="NT",resource_id="t"} 1 # always 1

If the value time= denotes the time when the metric was gathered, it should be dropped entirely. Prometheus will figure this out on its own. If this is some other timestamp (timestamp of last administrative modification or something), it should be added as another metric:

ontstat_last_admin_action_timestamp_seconds{device_id="1"} 1608712842316890688

The value doesn't look like a unix timestamp. Maybe it should converted to one (in seconds).

The following documents provide further background:
https://prometheus.io/docs/concepts/data_model/
https://prometheus.io/docs/practices/naming/

In fact, I just provided some examples for the hopefully right direction. I'm probably missing something as well. Depending on context you will also want to do some things differently (e.g. if it makes sense 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 above examples are the examples for a single device_id. You would have additional such lines for every other device.

It may also make sense to look at the (network) metrics of an existing exporter such as node_exporter.

Kind regards,
Christian

--
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-users+unsubscr...@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.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to