Some Graphite Templates (check_nwc_health, icmp, load, interface usage)

Hi all,

as I don’t really have an idea where the right place to put some templates would be, I’ll drop them off here.
I have created some templates(or edited the shipped ones) for my systems.

check_nwc_health interface usage
check_command = "interface-usage"

bpsin = "$service_name_template$.perfdata.$interface$_traffic_in.value"
bpsmaxin = "$service_name_template$.perfdata.$interface$_traffic_in.max"
bpscritin = "$service_name_template$.perfdata.$interface$_traffic_in.crit"
bpswarnin = "$service_name_template$.perfdata.$interface$_traffic_in.warn"

bpsout = "$service_name_template$.perfdata.$interface$_traffic_out.value"
bpsmaxout = "$service_name_template$.perfdata.$interface$_traffic_out.max"
bpscritout = "$service_name_template$.perfdata.$interface$_traffic_out.crit"
bpswarnout = "$service_name_template$.perfdata.$interface$_traffic_out.warn"

min = "0"
title = "$interface$ traffic"
lineWidth = "2"
yUnitSystem = "si"

bpsin = "alias(color($metric$, '#1a7dd7'), 'Traffic in (B/s)')"
bpsmaxin = "alias(color($metric$, '#7d7f81'), 'Traffic in max (B/s)')"
bpswarnin = "alias(color($metric$, '#ff8d00'), 'Traffic in warn (B/s)')"
bpscritin = "alias(color($metric$, '#ff0000'), 'Traffic in crit (B/s)')"

bpsout = "alias(color($metric$, '#0b3c68'), 'Traffic out (B/s)')"
bpsmaxout = "alias(color($metric$, '#45008d'), 'Traffic out max (B/s)')"
bpswarnout = "alias(color($metric$, '#ff8d00'), 'Traffic out warn (B/s)')"
bpscritout = "alias(color($metric$, '#ff0000'), 'Traffic out crit (B/s)')"

check_command = "interface-usage"

usagein = "$service_name_template$.perfdata.$interface$_usage_in.value"
usagecritin = "$service_name_template$.perfdata.$interface$_usage_in.crit"
usagewarnin = "$service_name_template$.perfdata.$interface$_usage_in.warn"

usageout = "$service_name_template$.perfdata.$interface$_usage_out.value"
usagecritout = "$service_name_template$.perfdata.$interface$_usage_out.crit"
usagewarnout = "$service_name_template$.perfdata.$interface$_usage_out.warn"

min = "0"
title = "$interface$ usage"
lineWidth = "2"
yUnitSystem = "none"

usagein = "alias(color($metric$, '#1a7dd7'), 'Usage in (%)')"
usagewarnin = "alias(color($metric$, '#ff8d00'), 'Usage in warn (%)')"
usagecritin = "alias(color($metric$, '#ff0000'), 'Usage in crit (%)')"

usageout = "alias(color($metric$, '#0b3c68'), 'Usage out (%)')"
usagewarnout = "alias(color($metric$, '#ff8d00'), 'Usage out warn (%)')"
usagecritout = "alias(color($metric$, '#ff0000'), 'Usage out crit (%)')"

check_command = "snmp-interface"

bpsin = "$service_name_template$.perfdata.$interface$_in_bps.value"
bpsout = "$service_name_template$.perfdata.$interface$_out_bps.value"

min = "0"
title = "Interface $interface$ Traffic"
lineWidth = "2"
yUnitSystem = "si"

bpsin = "alias(color($metric$, '#1a7dd7'), 'Traffic in (B/s)')"
bpsout = "alias(color($metric$, '#0b3c68'), 'Traffic out (B/s)')"

check_command = "snmp-interface"

ppsindiscard = "$service_name_template$.perfdata.$interface$_in_discard.value"
ppsoutdiscard = "$service_name_template$.perfdata.$interface$_out_discard.value"

min = "0"
title = "Interface $interface$ Discards"
lineWidth = "2"
yUnitSystem = "si"

ppsindiscard = "alias(color($metric$, '#edb017'), 'Discard in (B/s)')"
ppsoutdiscard = "alias(color($metric$, '#ad7d05'), 'Discard out (B/s)')"

check_command = "snmp-interface"

ppsinerr = "$service_name_template$.perfdata.$interface$_in_error.value"
ppsouterr = "$service_name_template$.perfdata.$interface$_out_error.value"

min = "0"
title = "Interface $interface$ Errors"
lineWidth = "2"
yUnitSystem = "si"

ppsinerr = "alias(color($metric$, '#ff5566'), 'Error in (B/s)')"
ppsouterr = "alias(color($metric$, '#a80000'), 'Error out (B/s)')"

check_nwc_health cpu-load
check_command = "nwc-load"

value = "$service_name_template$.nwc_health.perfdata.$load$.value"
crit = "$service_name_template$.nwc_health.perfdata.$load$.crit"
warn = "$service_name_template$.nwc_health.perfdata.$load$.warn"

areaAlpha = "0.5"
lineWidth = "2"
min = "0"
title = "$load$ %"
yUnitSystem = "none"

value = "alias(color($metric$, '#1a7dd7'), 'CPU usage (%)')"
crit = "alias(color($metric$, '#ff0000'), 'Crit (%)')"
warn = "alias(color($metric$, '#ff8d00'), 'Warn (%)')"
icmp template for Host objects
check_command = "icmp-host"

rtmin.value = "$host_name_template$.perfdata.rtmin.value"
rta.value = "$host_name_template$.perfdata.rta.value"
rtmax.value = "$host_name_template$.perfdata.rtmax.value"

areaAlpha = "0.5"
areaMode = "all"
lineWidth = "2"
min = "0"
yUnitSystem = "none"

rtmin.value = "alias(color(scale($metric$, 1000), '#44bb77'), 'Min. round trip time (ms)')"
rta.value = "alias(color(scale($metric$, 1000), '#ffaa44'), 'Avg. round trip time (ms)')"
rtmax.value = "alias(color(scale($metric$, 1000), '#ff5566'), 'Max. round trip time (ms)')"

check_command = "icmp-host"

pl.value = "$host_name_template$"

areaAlpha = "0.5"
areaMode = "all"
lineWidth = "2"
min = "0"
yUnitSystem = "none"

pl.value = "alias(color($metric$, '#1a7dd7'), 'Packet loss (%)')"

For all those templates I use the option to specify an obscured custom check command for the graphite module, as the “real” check commands used by the monitoring are either generic (like nwc_health and it’s many modes) or used by other templates (like icmp for the service check template)

Feel free to use the templates and please point me to any errors you find, because they mostly will be not working perfectly :smiley:

1 Like

@log1c that’s fantastic!

I would love to see those templates included in the official module. Any chance you could open a PR?

1 Like

Tbh I have not idea how to do that, as I only ever worked with github by creating issues :wink:
Will see if I can figure it out tomorrow

You can follow the icinga2 version for contributing, with the simple change of adding the template files instead.

Thanks, will check on it later today

PR created, not sure if I did it correctly though, but it shows up in the Pull requests :slight_smile: