If you have your ifAlias well standardized you can use metric_relabel_configs to extract data.
metric_relabel_configs: - source_labels: [ifAlias] regex: "(.+) - (.+) - (.+)" replacement: "$1" target_label: port_description - source_labels: [ifAlias] regex: "(.+) - (.+) - (.+)" replacement: "$2" target_label: port_location - source_labels: [ifAlias] regex: "(.+) - (.+) - (.+)" replacement: "$3" target_label: cable_id This will separate out your ifAlias into the component label parts. On Mon, Jul 18, 2022 at 10:45 PM Brian Bowen <[email protected]> wrote: > Hi all, > > We are attempting to set up alerting with Prometheus and Alertmanager > using some SNMP data. The basic use case is that we would like to group by > a substring of label data rather than an entire label. Let's say our > interfaces have the ifAlias label in the following format: > ifAlias="<brief description> - device 1 port 5 to device 2 port 7 - <cable > ID>" and I want to group alerts only by "device 1 port 5 to device 2 port > 7" (assuming this description is consistent across both devices), leaving > the rest of the description and cableID out. > > Is there a way to do this? We have not had success extracting this as a > separate label through snmp_exporter. I thought potentially we could do > some regex matching under the group_by rules with Alertmanager, but I > haven't seen any documentation/examples showing how to do this either. > > Let me know if there are any files I should attach. > > -- > 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 on the web visit > https://groups.google.com/d/msgid/prometheus-users/31b5a66a-0aa5-432b-b527-764ac392e1d4n%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/31b5a66a-0aa5-432b-b527-764ac392e1d4n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 on the web visit https://groups.google.com/d/msgid/prometheus-users/CABbyFmokKkLOJgkSrKu%3DbLWNQE6RSSe4s1jgCGx1THCLhC9pSA%40mail.gmail.com.

