atc0005 / go-nagios

Shared Golang package for Nagios plugins
MIT License
8 stars 3 forks source link

Nagios XI interprets current `nagios.CheckOutputEOL` value as two newlines #109

Closed atc0005 closed 2 years ago

atc0005 commented 2 years ago

https://github.com/atc0005/go-nagios/blob/2d7c3b12122ff43f5ead36f3077c2a01f1403bd3/nagios.go#L43-L49

Nagios Core interprets the CheckOutputEOL value as intended, but Nagios XI interprets as two newlines.

Snippet from service check output as shown by the web UI (Nagios XI):

Summary:

* Filtering applied to components set: false

* Evaluating all components in the set: true

* Omitting OK/operational components (if requested): false

* Number of total top-level components: 0

* Number of total component groups: 3

* Number of total subcomponents: 21

* Number of total problem components: 0

* Number of ignored problem components: 0

* Number of remaining problem components: 0

It should be:

Summary:

* Filtering applied to components set: false
* Evaluating all components in the set: true
* Omitting OK/operational components (if requested): false
* Number of total top-level components: 0
* Number of total component groups: 3
* Number of total subcomponents: 21
* Number of total problem components: 0
* Number of ignored problem components: 0
* Number of remaining problem components: 0
atc0005 commented 2 years ago

Brief testing indicates that replacing \r\n with just \n works as intended on Nagios XI, but results in literal \n values showing up on some lines of the output in the web UI on Nagios Core (3.x at least). The current doc comments explain this as reasoning for using \r\n as a workaround.

atc0005 commented 2 years ago

This however seems to work as intended:

-const CheckOutputEOL string = "\r\n"
+const CheckOutputEOL string = " \n"

Note the additional single leading whitespace before the \n value.