On Thursday, 27 March 2025 at 00:20:02 UTC Elliott Balsley wrote:

How do other folks handle TruthValues with snmp-exporter?


For all the sample MIBs in generator.yml, AFAICS they retain the values 1 
and 2 as-is. (For example, see ifConnectorPresent and ifPromiscuousMode in 
IF-MIB)

Personally, I would be inclined not to fight it, and write PromQL 
expressions appropriately:

# With these filters you can quietly forget that false is 2 rather than 0
ifConnectorPresent == 1
ifConnectorPresent != 1

# If you really need a 0 or 1 value
(ifConnectorPresent == bool 1)
(2 - ifConnectorPresent)

You can't directly use a 0/1 value as a "boolean" in PromQL anyway, except 
perhaps when multiplying by another value.

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/prometheus-users/d2f84d7a-ee62-4b6a-a6ca-f4891b21f7d7n%40googlegroups.com.

Reply via email to