I don't think the exporter can do that, although it sounds like a good idea 
to me (i.e. to be able to set a label rather than mangle the metric name).

Possibly you could use metric_relabel_configs to fix it up:

- source_labels: [__name__]
  regex: '.*_CHANNEL_(.+)'
  target_label: channel
- source_labels: [__name__]
  regex: '(.*)_CHANNEL_.+'
  target_label: __name__

Otherwise, a simple HTTP proxy which sits between prometheus and 
snmp_exporter.

On Wednesday, 26 March 2025 at 08:44:49 UTC Elliott Balsley wrote:

> I have an SNMP device that returns a value like this:
>
> DOLBY-CP850-MIB::cp850MeterLevels.0 = STRING: "00 00 00 00 00 00 00 00 00 
> 00"
>
> This string represents the volume level of 10 separate audio channels, so 
> I would like to break it apart and record it as 10 metrics.  I previously 
> had this working in Telegraf so the result looked like this:
> snmp_dolby_cp_meter_level_dbfs{channel="L"} 0
> snmp_dolby_cp_meter_level_dbfs{channel="R"} 0
> snmp_dolby_cp_meter_level_dbfs{channel="C"} 0
> snmp_dolby_cp_meter_level_dbfs{channel="LFE"} 0
> snmp_dolby_cp_meter_level_dbfs{channel="Lss"} 0
> snmp_dolby_cp_meter_level_dbfs{channel="Rss"} 0
> snmp_dolby_cp_meter_level_dbfs{channel="Lrs"} 0
> snmp_dolby_cp_meter_level_dbfs{channel="Rrs"} 0
> snmp_dolby_cp_meter_level_dbfs{channel="Lts"} 0
> snmp_dolby_cp_meter_level_dbfs{channel="Rts"} 0
>
> Is this possible to do with snmp-exporter?  I couldn't find any way to add 
> the channel label.  The best I could think of is this regex_extract in the 
> exporter, but this isn't really what I want because it adds the channel 
> identifier to the metric name.
>
>       cp850MeterLevels:
>         type: DisplayString
>         regex_extracts:
>           '_L':
>           - regex: '(..) .. .. .. .. .. .. .. .. ..'
>             value: $1
>           '_R':
>           - regex: '.. (..) .. .. .. .. .. .. .. ..'
>             value: $1
>           '_C':
>           - regex: '.. .. (..) .. .. .. .. .. .. ..'
>             value: $1
>           '_LFE':
>           - regex: '.. .. .. (..) .. .. .. .. .. ..'
>             value: $1
>           '_Lss':
>           - regex: '.. .. .. .. (..) .. .. .. .. ..'
>             value: $1
>           '_Rss':
>           - regex: '.. .. .. .. .. (..) .. .. .. ..'
>             value: $1
>           '_Lrs':
>           - regex: '.. .. .. .. .. .. (..) .. .. ..'
>             value: $1
>           '_Rrs':
>           - regex: '.. .. .. .. .. .. .. (..) .. ..'
>             value: $1
>           '_Lts':
>           - regex: '.. .. .. .. .. .. .. .. (..) ..'
>             value: $1
>           '_Rts':
>           - regex: '.. .. .. .. .. .. .. .. .. (..)'
>             value: $1
>
>

-- 
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/040c098f-5ae7-4ab0-bdd2-f5826b8eb141n%40googlegroups.com.

Reply via email to