snmp_exporter value ends up in a label (unwanted behavior)

33 views
Skip to first unread message

Stephan Schwarz

unread,
Apr 20, 2020, 9:34:38 PM4/20/20
to Prometheus Users
Hi,

I'm having an issue which I don't quite understand.

I have successfully used the SNMP exporter now for a couple of devices, and so far the actual value that is returned always ended up as the metric value.
Now I tried to add different device (CheckPoint firewall) and the value is now added as a label instead.

For example, lets take the counter for conncurrent connections "asgCountersConcurrConnNum"
The SNMP exporter displays the information like this

# HELP asgCountersConcurrConnNum Number of concurrent connections - 1.3.6.1.4.1.2620.1.48.20.25.1.6
# TYPE asgCountersConcurrConnNum gauge
asgCountersConcurrConnNum{asgCountersConcurrConnNum="58852",asgCountersIndex="1"} 1
asgCountersConcurrConnNum{asgCountersConcurrConnNum="68239",asgCountersIndex="2"} 1
asgCountersConcurrConnNum{asgCountersConcurrConnNum="N/A",asgCountersIndex="3"} 1
asgCountersConcurrConnNum{asgCountersConcurrConnNum="N/A",asgCountersIndex="4"} 1

I'm pretty new to Prometheus, but I can't find an easy way to extract the asgCountersConcurrConnNum value in the label in order to graph this.
Is there an easy way to force the SNMP exporter to present the data like this instead?

asgCountersConcurrConnNum{asgCountersIndex="1"} 58852
asgCountersConcurrConnNum{asgCountersIndex="2"} 68239

Alternatively, can I create a query that will select the metric I want and return the value inside the label instead of the "actual" (but wrong) value? If so, an example would be welcome.

I used a different tool in order to check how the data is presented.
Paessler SNMP Tester 5.2.3 
4/21/2020 2:59:00 AM (11 ms) : Device: <ip>
4/21/2020 2:59:00 AM (16 ms) : SNMP V2c
4/21/2020 2:59:00 AM (23 ms) : Walk 1.3.6.1.4.1.2620.1.48.20.25.1.6
4/21/2020 2:59:00 AM (29 ms) : 1.3.6.1.4.1.2620.1.48.20.25.1.6.1.0 = "59714" [ASN_OCTET_STR]
4/21/2020 2:59:00 AM (38 ms) : 1.3.6.1.4.1.2620.1.48.20.25.1.6.2.0 = "68496" [ASN_OCTET_STR]
4/21/2020 2:59:00 AM (45 ms) : 1.3.6.1.4.1.2620.1.48.20.25.1.6.3.0 = "N/A" [ASN_OCTET_STR]
4/21/2020 2:59:00 AM (50 ms) : 1.3.6.1.4.1.2620.1.48.20.25.1.6.4.0 = "N/A" [ASN_OCTET_STR]

Kind regards,
Stephan Schwarz

Brian Brazil

unread,
Apr 21, 2020, 3:06:59 AM4/21/20
to Stephan Schwarz, Prometheus Users
On Tue, 21 Apr 2020 at 02:34, Stephan Schwarz <stephan...@live.com> wrote:
Hi,

I'm having an issue which I don't quite understand.

I have successfully used the SNMP exporter now for a couple of devices, and so far the actual value that is returned always ended up as the metric value.
Now I tried to add different device (CheckPoint firewall) and the value is now added as a label instead.

For example, lets take the counter for conncurrent connections "asgCountersConcurrConnNum"
The SNMP exporter displays the information like this

# HELP asgCountersConcurrConnNum Number of concurrent connections - 1.3.6.1.4.1.2620.1.48.20.25.1.6
# TYPE asgCountersConcurrConnNum gauge
asgCountersConcurrConnNum{asgCountersConcurrConnNum="58852",asgCountersIndex="1"} 1
asgCountersConcurrConnNum{asgCountersConcurrConnNum="68239",asgCountersIndex="2"} 1
asgCountersConcurrConnNum{asgCountersConcurrConnNum="N/A",asgCountersIndex="3"} 1
asgCountersConcurrConnNum{asgCountersConcurrConnNum="N/A",asgCountersIndex="4"} 1

I'm pretty new to Prometheus, but I can't find an easy way to extract the asgCountersConcurrConnNum value in the label in order to graph this.
Is there an easy way to force the SNMP exporter to present the data like this instead?

asgCountersConcurrConnNum{asgCountersIndex="1"} 58852
asgCountersConcurrConnNum{asgCountersIndex="2"} 68239

Alternatively, can I create a query that will select the metric I want and return the value inside the label instead of the "actual" (but wrong) value? If so, an example would be welcome.

No, label values are opaque strings to PromQL that you can't do any math on.
 

I used a different tool in order to check how the data is presented.
Paessler SNMP Tester 5.2.3 
4/21/2020 2:59:00 AM (11 ms) : Device: <ip>
4/21/2020 2:59:00 AM (16 ms) : SNMP V2c
4/21/2020 2:59:00 AM (23 ms) : Walk 1.3.6.1.4.1.2620.1.48.20.25.1.6
4/21/2020 2:59:00 AM (29 ms) : 1.3.6.1.4.1.2620.1.48.20.25.1.6.1.0 = "59714" [ASN_OCTET_STR]
4/21/2020 2:59:00 AM (38 ms) : 1.3.6.1.4.1.2620.1.48.20.25.1.6.2.0 = "68496" [ASN_OCTET_STR]
4/21/2020 2:59:00 AM (45 ms) : 1.3.6.1.4.1.2620.1.48.20.25.1.6.3.0 = "N/A" [ASN_OCTET_STR]
4/21/2020 2:59:00 AM (50 ms) : 1.3.6.1.4.1.2620.1.48.20.25.1.6.4.0 = "N/A" [ASN_OCTET_STR]

As you can see here the vendor decided to present the integer value as a human readable string, which the snmp exporter then faithfully converts to a label as that's the only way a string can be represented.

You can use regexp_extracts to pull out the number, for example https://github.com/prometheus/snmp_exporter/blob/master/generator/generator.yml#L430

Brian

Kind regards,
Stephan Schwarz

--
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/1130147c-70ff-43fb-870f-83f63ad79c52%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages