NSCP Settings Escape Character

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.
TechnicallyTrue
Posts: 25
Joined: Mon May 13, 2019 11:57 am

Re: NSCP Settings Escape Character

Post by TechnicallyTrue »

Interesting... It does work from command prompt, but not from powershell. I wonder if I have to escape all the quotation marks in powershell using the ` character as well.
I'll try that and get back to you.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NSCP Settings Escape Character

Post by scottwilkerson »

TechnicallyTrue wrote:Interesting... It does work from command prompt, but not from powershell. I wonder if I have to escape all the quotation marks in powershell using the ` character as well.
I'll try that and get back to you.
Probably you will have some other powershell escaping to do.

Best of luck!
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
TechnicallyTrue
Posts: 25
Joined: Mon May 13, 2019 11:57 am

Re: NSCP Settings Escape Character

Post by TechnicallyTrue »

Sure enough, the quotation marks needed to be escaped twice, once for nscp settings and once for powershell. The final command reads as follows:

Code: Select all

& .\nscp settings --path `"/settings/scheduler/schedules`" --key `"Drive Space C:`" --set `"check_drivesize `"`"warn=free<10G and free<10%`"`" `"`"crit=free<5G and free<5%`"`" drive=c: show-all`"
Seems to work now. Thank you very much for your help.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NSCP Settings Escape Character

Post by scottwilkerson »

TechnicallyTrue wrote:Sure enough, the quotation marks needed to be escaped twice, once for nscp settings and once for powershell. The final command reads as follows:

Code: Select all

& .\nscp settings --path `"/settings/scheduler/schedules`" --key `"Drive Space C:`" --set `"check_drivesize `"`"warn=free<10G and free<10%`"`" `"`"crit=free<5G and free<5%`"`" drive=c: show-all`"
Seems to work now. Thank you very much for your help.
Great! Glad to hear you got it working!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked