olorin / nagiosplugin

Package for writing Nagios/Icinga/et cetera plugins in Go (golang)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use thresholds in Check.AddPerfDatum()

zstyblik opened this issue · comments

Hello,

according to Nagios Plugin Dev Guidelines:

warn and crit are in the range format (see the Section called Threshold and ranges). Must be the same UOM

However, Check.AddPerfDatum() expects float64. What's the correct way to add warn and crit threshold to perf data then? I've tried something like:

check.AddPerfDatum(label, unit, value, 0, 0,
    warnRange.Start, warnRange.End, critRange.Start, critRange.End)

but the output doesn't seem to be correct, resp. it's something like:

CRITICAL: It's broken. | label=value;0;warn.End;0;0

where input values for warn and critical are -w 400000 -c 500000. I've also tried to pass different combinations to Check.AddPerfDatum(), but without success. However, it's possible I'm expecting something that cannot be :)

Thank you for clarification.

warn and crit are in the range format (see the Section called Threshold and ranges).

Huh, I missed that, I always thought they were scalars - thanks for pointing that out. This is an example of how I've been using that function. I think current behaviour is a bug though; I'll leave this open until I get a chance to look at fixing it.