mpounsett / nagiosplugin

A Python class library which helps with writing Nagios (Icinga) compatible plugins.
https://nagiosplugin.readthedocs.io/
Other
28 stars 14 forks source link

perfdata should be single line #11

Closed mpounsett closed 8 years ago

mpounsett commented 9 years ago

Original report by Onur Yalazı (Bitbucket: yalazi, ).


Nagios and icinga2 uses only a single line output to get check results and performance data. In case of multiple metrics output.py:format_perfdata method joins metrics with newlines. This breaks perf data collection. This should join with spaces.

Sample output:

ONLINE OK - Online is 2528
| 'www.xxxx.com'=74;;;0 'www.yyyy.com'=3;;;0 'www.zzzz.com'=306;;;0
'www.ttttt.com'=80;;;0 'www.bbbbbb.com'=819;;;0
mpounsett commented 9 years ago

Original comment by Christian Kauhaus (Bitbucket: ckauhaus, GitHub: ckauhaus).


Calling a plugin with verbose level 0 will always return all results in one line. I think it would be resonable to change output behaviour for verbose levels >0 to still keep perfdata in one line.

mpounsett commented 8 years ago

Original comment by Christian Kauhaus (Bitbucket: ckauhaus, GitHub: ckauhaus).


Always keep perfdata on a single line

Some systems swallow multi-line performance data even if output style is perfectly ok w.r.t. the Nagios plugin specs.

So we restrict ourselves to single line performance data even in multi-line mode.

Fixes #11