Just for the book of wisdom a template for Graphite module works like this:
[broadcast.graph] check_command = "nwc_health" [broadcast.metrics_filters] broadcast_in.value = "$service_name_template$.perfdata.$interface$_broadcast_in.value" broadcast_out.value = "$service_name_template$.perfdata.$interface$_broadcast_out.value" [broadcast.urlparams] areaAlpha = "0.5" yUnitSystem = "none" yMinLeft = "0" yMaxLeft = "100" yMinRight = "0" yMaxRight = "100" lineWidth = "2" title = "$interface$ Broadcast" vtitle = "Incoming" vtitleRight = "Outgoing" [broadcast.functions] broadcast_in.value = "alias(color(asPercent($metric$,100), '#44bb77'), '< Broadcast')" broadcast_out.value = "alias(color(secondYAxis(asPercent($metric$,100)), '#ff5566'), 'Broadcast >')"
First of all we need metrics to which this template should be applied to. So we have to specify the check_command providing these. (Attention there is some little limitation, you can’t combine metrics from different checks together)
At this stage we have our metrics and now we have to select metrics which should appear in our graph. For example the inbound and outbond of our
broadcast. There is some cool feature available if you didn’t notice yet. You can template names out of the metric path to generate for example the title.
Here we template out the name:
broadcast_in.value = “$service_name_template$.perfdata.
and use it for our title:
titel = "
These are described here. They are used for everything around our graphs, like unit, title on top, bottom, left or right.
In the final section “functions” we apply (obviously) functions to our metrics. Functions are used to manipulate our metrics with for example a color, and a pretty node name. The Graphite project also provides some documentation here.
Last but not least some example graph: