Page 1 of 1
Escaping characters in the message
Posted: Tue Aug 18, 2015 4:05 pm
by devnull
is there a way to escape characters like "|" in the message.
sample message:
[1439925251] PROCESS_SERVICE_CHECK_RESULT;localhost;TSERVICE;2;TEST123|456
Re: Escaping characters in the message
Posted: Tue Aug 18, 2015 4:09 pm
by hsmith
devnull wrote:is there a way to escape characters like "|" in the message.
sample message:
[1439925251] PROCESS_SERVICE_CHECK_RESULT;localhost;TSERVICE;2;TEST123|456
What exactly are you trying to do, just make it so the | does not show up?
Re: Escaping characters in the message
Posted: Tue Aug 18, 2015 4:24 pm
by devnull
it only shows TEST123
but if the value of $SERVICEOUTPUT$ is TEST123|456 ACB DEF:HIJ FOO|BAR|TEST|THIS|IS|LONG|Blah: GHJD
notification doesn't even execute
Re: Escaping characters in the message
Posted: Tue Aug 18, 2015 4:25 pm
by devnull
ooopss.. i wanted to show all characters in $SERVICEOUTPUT$ including the pipes.
Re: Escaping characters in the message
Posted: Tue Aug 18, 2015 7:23 pm
by Box293
Your plugin should only be returning one pipe in the output.
The pipe is what separates the status information from the performance data.
This is why you only see TEST123
https://nagios-plugins.org/doc/guidelines.html#AEN200
Re: Escaping characters in the message
Posted: Wed Aug 19, 2015 8:05 am
by devnull
Are there a list of characters that nagios doesnt allow in the $SERVICEOUTPUT$
Re: Escaping characters in the message
Posted: Wed Aug 19, 2015 4:48 pm
by tmcdonald
Re: Escaping characters in the message
Posted: Thu Aug 20, 2015 8:40 am
by devnull
thanks..
Re: Escaping characters in the message
Posted: Thu Aug 20, 2015 9:28 am
by tmcdonald
You can of course edit that list, but remember that the pipe character has special meaning in Nagios. I tried escaping it with a backslash but it had no effect.