Graphite Module: Templates

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 >')"

.graph

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)

.metrics_filters

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.$interface$_broadcast_in.value”

and use it for our title:
titel = "$interface$ Broadcast"

.urlparams

These are described here. They are used for everything around our graphs, like unit, title on top, bottom, left or right.

.functions

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:

1 Like

Thanks. I’ve moved this answer from Graphite module "Bad section name" into the #howto category, feel free to enhance it with community members :slight_smile:

Hey, I’m having a bit of a struggle in defining the correct Graph Settings. We have several Icingas in use for our customers and now, I was finally able to install one for our very own use. I wanted to set it up just like we are used to it from our customers systems and make a blue infill in the graphs:

In my System it looks like this:

I already changed the graphTemplates.conf so the background isn’t black anymore. I also figured out, that the correct configuration must be in /usr/share/icingaweb2/modules/graphite/templates but it seems like the module doesn’t use those templates, because they’re configured the same way it looks like in our customers system.
Is there a possibility to tell the Module to use the Templates inside this folder?

Greetings:
Daniel

Problem solved:
I adjusted the Retentions and noticed I had to delete the old Whisper Databases, cause they kept the old metrics. After deleting the Whisper Databases it looks like I wanted the Graphs: