Page 2 of 2

Re: Nagios 4.3.1 not accepting single quote '

Posted: Wed Jun 28, 2017 11:54 am
by tgriep
I setup a 3.5.1 system and a 4.x.x server.

I then created the nagios command like the example below

Code: Select all

'\\LogicalDisk(C:)\\Avg. Disk sec/Write'
I then enabled debugging in the NSClient agent and this is how the command was received.

Code: Select all

Created command: show-all "\LogicalDisk(C:)\Avg. Disk sec/Write" perf-config=*(suffix:none)
So it looks like Core 3.5.1 changes the single quote to double quotes and removes the second back slash.

On the core 4.x.x server I created the command like the following

Code: Select all

'\LogicalDisk(C:)\% Free Space'
this is how the command was received by NSClient.

Code: Select all

Created command: show-all "\LogicalDisk(C:)\% Free Space" perf-config=*(suffix:none)
All that was done was the change of single quotes to double quotes.

It looks like Nagios Core always changed the single quotes to double quotes but core 3.5.1 removed the extra \ from the command.

In core 4.x.x, you can still use the single quote but you cannot use the double back slashes as it seems from the testing I did.

Re: Nagios 4.3.1 not accepting single quote '

Posted: Thu Jul 06, 2017 10:29 am
by padu_3891
Thank you for your support, I need to update double slashes with single slash for larger number of services.
Is there any quick fix or workaround to make nagios4.3.1 consider doubleslash as singleslash as it was working with nagios3.5.1

Re: Nagios 4.3.1 not accepting single quote '

Posted: Thu Jul 06, 2017 1:12 pm
by tmcdonald
If core was treating '\\' as '\' then it was a bug and we will not be reverting to that behavior. Anything inside single quotes should be treated as a literal string, meaning no conversion is done. If you need escaping, then double quotes are the answer.