Nagios 4.3.1 not accepting single quote '

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios 4.3.1 not accepting single quote '

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
padu_3891
Posts: 50
Joined: Thu Sep 05, 2013 10:12 pm

Re: Nagios 4.3.1 not accepting single quote '

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios 4.3.1 not accepting single quote '

Post 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.
Former Nagios employee
Locked