Hex-STRING instead of DisplayString = trailing NULL
47 views
Skip to first unread message
Jonathan Tougas
unread,
Apr 30, 2023, 5:25:25 AM4/30/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prometheus Users
I'm looking for a way to deal with a situation where we end up with null characters trailing some label values: `count({ifDescr=~".*\x00"}) != 0`.
The source of the problem seems to be with `ifDescr` returned as a `Hex-String` instead of what the MIB says should be a `DisplayString`... for __some__ servers.
I'm currently planning on using `metric_relabel_configs` to cleanup the trailing nulls on these and other similar situations I uncovered. Is there better way than mopping up like that? Perhaps snmp-exporter can deal with these and convert somehow? I'm not familiar enough with it to figure out if it can or not.
Daniel Swarbrick
unread,
May 3, 2023, 10:18:46 AM5/3/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prometheus Users
You can override the type of an OID to force snmp_exporter to always handle it as e.g. DisplayString in your generator.yml, even when dodgy snmp engines return it as different type than what the MIB specifies. Read the "overrides" section of https://github.com/prometheus/snmp_exporter/tree/main/generator#file-format
However, that won't prevent the null bytes from still appearing in the label value, and the only way (currently) to do that is with metric relabelling as you have already discovered. You might want to subscribe to this github issue: https://github.com/prometheus/snmp_exporter/issues/615