Graphite thresholds in reverse order

I use the plugin check_snmp to display the relative humidity of a sensor. Here I want to check for warning and critical values and a low humidity is worse. Thus the warning value is e.g. with 25% and the critical one with 20%. In the plugin I can also specify this well with the parameters -w 25: and -c 20:.

Now I would like to have these values in my display of the icinga2web graphite-plugin . Is there a way to change this in the template? Now I don’t have any output. I think it’s because the values of “25:” and “20:” are not presentable.

Thanks in advance

Hi and welcome to our community,

you can built your own graphite templates.

Location:

/etc/icingaweb2/modules/graphite/templates

original location:

/usr/share/icingaweb2/modules/graphite/templates/ #do not change anything here

Example for disk checks via snmp:

[disk.graph]
check_command = "check-snmp-storage"

[disk.metrics_filters]
value = "$service_name_template$.perfdata.$disk$.value"
max = "$service_name_template$.perfdata.$disk$.max"
warn = "$service_name_template$.perfdata.$disk$.warn"
crit = "$service_name_template$.perfdata.$disk$.crit"

[disk.urlparams]
areaAlpha = "0.5"
areaMode = "all"
lineWidth = "2"
min = "0"
title = "Disk $disk$"
yUnitSystem = "binary"

[disk.functions]
value = "alias(color($metric$, '#1a7dd7'), 'Used (gbytes)')"
max = "alias(color($metric$, '#cfd7e6'), 'Size (gbytes)')"
warn = "alias(color($metric$, '#eab839'), 'warning (gbytes)')"
crit = "alias(color($metric$, '#bf1b00'), 'critical (gbytes)')"
1 Like

Hi Hendrik,

many thanks for answering my question.

I’ve already added a customized template. But my question is more pointing to the fact, that I don’t have a clue how to add max and min-lines in a reverse logic to graphite as I described. For the humidity high values are good and lower values are bad. This is done by implementing the parameters of warning and critical in the check plugin using the colon after the specific value. If I do this icinga2 is working perfect and doesn’t show any warning if the humidity is high. But I’m not able to present the critical and warning levels in the diagram of the graphite module.

The presenting of such levels is working in principle as you can see in the snapshot I append at the beginning of the graph. But only if I add the values of warning and critical in the normal way without a colon. But then the icinga2 is in warning state.

I thought of a way in the graphite template to get rid of the colon.

Please share your template :slight_smile:

This is my template:

[humidity.graph]
check_command = "snmp"

[humidity.metrics_filters]
humi.value = "$service_name_template$.perfdata.iso.3.6.1.2.1.99.1.1.1.4.2.value"
humi.warn = "$service_name_template$.perfdata.iso.3.6.1.2.1.99.1.1.1.4.2.warn"
humi.crit = "$service_name_template$.perfdata.iso.3.6.1.2.1.99.1.1.1.4.2.crit"

[humidity.urlparams]
areaAlpha = "0.5"
min = "18"
yUnitSystem = "none"
lineWidth = "2"
title = "Rel. Luftfeuchtigkeit"

[humidity.functions]
humi.value = "alias(color($metric$, '#4269b8'), 'rel. Luftfeuchtigkeit [%]')"
humi.warn = "alias(color($metric$, '#ffaa44'), 'Warnung')"
humi.crit = "alias(color($metric$, '#ff5566'), 'Kritisch')"
1 Like

Okay I see your point!
I have the same problem with a snmp threshold range.
Unfortunately I do not know how to fix it.

Icingaweb does not show it either:

image

I can see see the values in icingaweb.

2019-11-26_12h58_49

But I can’t even see them in graphite.

That’s a problem with Icinga 2 not parsing the threshold ranges correctly and as such, they are not written to Graphite’s backend. There’s no short-term solution other than writing a wrapper script which parses the performance data and puts in parsable threshold levels on execution.

1 Like

Thanks Michael.

I’ll see how to manage this.

Please give a feedback when you found a solution :slight_smile:

Yes I’ll. but I think it’ll last a little bit for I’m not completly aware of the internals of icinga2.