I've got Grafana pulling metrics for a dashboard out of PRTG and I'm wanting to setup a traffic light indicator for an HTTP sensor. It looks like the "statustext" on the senor reports Up, Warning, and Down. I'd like to have the traffic light report Up = Green, Warning = Orange, and Down = Red. I can't seem to figure out how to get the metric to pull using any sort of data using the metric type, text, or raw data within Grafana. Any thoughts on how to best pull this off?
Article Comments
It's this traffic light plugin over from Grafana:
https://grafana.com/plugins/snuids-trafficlights-panel
Aug, 2018 - Permalink
Hi,
Well, this is seemingly for Kibana, not PRTG. You might be better off with the SVG Panel plugin and something like this:
SVG code (basically, a traffic light)
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="300" width="100" version="1.1"> <defs> </defs> <g stroke="none"> <circle r="30" cx="30" cy="30" fill="#888" id='red' /> <circle r="30" cx="30" cy="100" fill="#888" id='yellow' /> <circle r="30" cx="30" cy="170" fill="#888" id='green' /> </g> </svg>
Code to change the colors accordingly
$(svgnode).find("#red").attr("fill","#d71920") $(svgnode).find("#yellow").attr("fill","#ffcb05") $(svgnode).find("#green").attr("fill","#b4cc38")
If I find the time today, I may come up with a way to make it state dependent, based on the output of getstatus.htm?id=<objid>, but it certainly won't use the PRTG plugin, as I seemingly cannot use the retrieved JSON query from a raw query :/
edit no dice unfortunately, couldn't properly query PRTGs API in the javascript field of the plugin :(
Kind regards,
Stephan Linke, Tech Support Team
Aug, 2018 - Permalink
What traffic light javascript/css combination are you using here?
Kind regards,
Stephan Linke, Tech Support Team
Aug, 2018 - Permalink