I have a bunch of SNMP devices that report their firmware version as 3 separate metrics as below.
I’m trying to think of a useful way to visualize this data in a Grafana dashboard and I’m feeling stumped. Is there a way to concatenate the values into a single string like 9.5.0?
I’d also like to get a count of how many devices in the fleet are on each version, and perhaps display it as a pie chart. As it now, I could make 3 separate pie charts, that wouldn’t make any sense.
I don’t know if it’s possible to do what you are trying to do. You essentially are looking to join three log lines, which to my knowledge is currently not possible in logql.
I would propose tackling this from ingestion:
Querying your devices using a script and output to Loki is one solution.
You can also use some sort of intermediary tool to parse the logs as they come in. This depends on how you are currently shipping logs from your devices to Loki.
You can also write a simple Python script that executes on a schedule, look for firmware version log lines for the past X minutes, combine it based on instance IP, then write back into Loki.