OK. I checked this. regex_extracts is only from when you want to extract a
metric *value* (i.e. a floating-point number) from text, for some dodgy
MIBs which respond with things like temperature as a string value.
Since you already have apSysStatBssid containing the MAC address as a
string label, what exactly do you want to do with it?
On Wednesday, 5 March 2025 at 16:43:08 UTC Matthew Koch wrote:
> I've tried the variety of Regex and still it doesn't return any data. It's
> interesting because nothing comes back in the output and it doesn't error
> as well.
>
> On Wednesday, March 5, 2025 at 3:57:22 AM UTC-5 Brian Candler wrote:
>
>> Start with regex: '(.*)'
>>
>> If that works, then you know it's just the regex at fault. I'd start by
>> trying to double-backslash, i.e.
>>
>> - regex: '([\\w]{2}:[\\w]{2}:[\\w]{2}:[\\w]{2}:[\\w]{2}:[\\w]{2})'
>>
>> The spec for Go's regex language (RE2) is here:
>> https://github.com/google/re2/wiki/syntax
>>
>> I'm not sure if a backslash character class is allowed inside a
>> square-bracket character class. So you could try:
>>
>> - regex: '((\\w){2}:(\\w){2}:(\\w){2}:(\\w){2}:(\\w){2}:(\\w){2})'
>> - regex:
>> '([[:alnum:]]{2}:[[:alnum:]]{2}:[[:alnum:]]{2}:[[:alnum:]]{2}:[[:alnum:]]{2}:[[:alnum:]]{2})'
>>
>> or something simpler like:
>>
>> - regex: '([a-fA-F0-9:]{17})'
>>
>> On Tuesday, 4 March 2025 at 22:11:04 UTC Matthew Koch wrote:
>>
>>> I'm trying to extract the MAC address out of what is returned by SNMP
>>> exporter. The Regex I am using seems to work in general when I used an
>>> online Regex tester but for some reason it's not working in SNMP exporter.
>>>
>>> SNMPExporter config:
>>>
>>> - name: apSysStatBssid
>>> oid: 1.3.6.1.4.1.11.2.14.11.6.4.5.1.1.1.1.31.3
>>> type: PhysAddress48
>>> help: MAC address of the AP that the HPE501 is Associated to. -
>>> 1.3.6.1.4.1.11.2.14.11.6.4.5.1.1.1.1.31.3
>>> regex_extracts:
>>> Test:
>>> - regex: '([\w]{2}:[\w]{2}:[\w]{2}:[\w]{2}:[\w]{2}:[\w]{2})'
>>> value: '$1'
>>>
>>> This is what I typically get data wise without the regex config:
>>>
>>> # HELP apSysStatBssid BSSID of currently connected accesspoint -
>>> 1.3.6.1.4.1.29456.3.2
>>> # TYPE apSysStatBssid gauge
>>> apSysStatBssid{apSysStatBssid="6A:56:E3:7A:85:47"} 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/b0ff117f-567d-48f5-ae00-be1c4d3ba653n%40googlegroups.com.