Linux – Nagios plugin output character escaping

linuxnagios

Which characters in a Nagios plugin output need escaping other than pipe (|)?

How do I escape the pipe character and others?

Best Answer

The development guidelines do not specify a way to escape the |

The syntax of the first line is fix and not very flexible

SERVICE STATUS: First line of output | First part of performance data

and then in section 2.6 (Performance Data)

Nagios 3 and newer will concatenate the parts following a "|" in a) the first line output by the plugin, and b) in the second to last line, into a string it passes to whatever performance data processing it has configured.

I would then assume that if you have a | in the First line of output part it will just interpreted as the beginning of the performance data.

Since the first line of output is not interpreted (up to the |) I would also assume that no characters have to be specially handled.