> Why does SNMP exporter show MAC addresses as uppercase?

That's what the code does:
https://github.com/prometheus/snmp_exporter/blob/v0.28.0/collector/collector.go#L871-L877

        case "PhysAddress48":
                subOid, indexOids := splitOid(indexOids, 6)
                parts := make([]string, 6)
                for i, o := range subOid {
*                        parts[i] = fmt.Sprintf("%02X", o)*
                }
                return strings.Join(parts, ":"), subOid, indexOids

I don't think there's any standard which says hex MAC addresses should be 
rendered as uppercase or lowercase, and I've seen both on physical hardware 
(i.e. switches and routers).

On Wednesday, 26 March 2025 at 05:25:28 UTC Elliott Balsley wrote:

> I figured out how to change this with relabel_configs so it's just a 
> curiosity.
>
> On Tuesday, March 25, 2025 at 6:28:38 PM UTC-7 Elliott Balsley wrote:
>
> Why does SNMP exporter show MAC addresses as uppercase?  For example, 
> using the default snmp.yml with if_mib module I get this:
>
> ifPhysAddress{ifAlias="",ifDescr="eth0",ifIndex="2",ifName="eth0",ifPhysAddress="3C:EC:EF:3C:B1:5E"}
>  
> 1
>
> Net-snmp tools show these values as lowercase, as does the snmp-exporter 
> README 
> <https://github.com/prometheus/snmp_exporter/blob/main/generator/README.md>
> : 
> #   PhysAddress48: A 48 bit MAC address, rendered as 00:01:02:03:04:ff.
>
> If you're wondering why this matters... I'm trying to migrate some SNMP 
> configs from Telegraf to the Prometheus SNMP Exporter.  I have a bunch of 
> existing data in Prometheus, so I'm hoping to build the configs such that 
> all my time series continue. Telegraf uses lower-case MACs.
>
>

-- 
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 visit 
https://groups.google.com/d/msgid/prometheus-users/2b82d181-165c-4c04-b0cf-75acaa4cfa3fn%40googlegroups.com.

Reply via email to