I am using Prometheus as a data source into Grafana and am using Prom’s SNMP-EXPORTER to get info from Cisco switches. So far, I have managed to get snmp oid for sysName and sysLocation and display them using the ‘Stat’ panel. These are working great.
However when I poll for sysDescr using the snmp-exporter, I get the data like the below:
Cisco IOS Software [Fuji], Catalyst L3 Switch Software (CAT9K_LITE_IOSXE), Version 16.9.3, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2019 by Cisco Systems, Inc. Compiled Wed 20-Mar-19 07:19 by mcpre
This comes in as a label as its text, so my metric is called ‘sysDescr’ and this text above is added as a label called ‘sysDescr’ on the metric and the value of the metric itself it set at 1.
Within the stat, I set the value Field to be ‘sysDescr’ and it displays the above output from the switch. However, I only want it to give me ‘Version 16.9.3’ so I just get the IOS version. And I cannot find out how to manipulate the value to change how it is displayed. I have some regex that matches the string I would like, but cannot seem to work out how to get the stat to only display the version number and not the whole string above.
I have also tried label replacing but it seems that because the label name ‘sysDescr’ is the same as the metric name (done by the prometheus snmp-exporter not me), im not able to label replace either.
Does anyone have any ideas how this is achievable?