Escaping " issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Escaping " issue

Post by BanditBBS »

Ok, so I can run this from command line:

Code: Select all

./check_snmp -H 10.6.59.90 -o SNMPv2-SMI::enterprises.5528.100.4.2.10.1.7.303280526 -C xxxxxx -P 2c -l "Spot Leak" -s "\"No Leak\""
And I get this back:

Code: Select all

Spot Leak OK - "No Leak" |
But when I put that in $ARG1$ using check_snmp command, it screws up the -s part. The string actually contains double quotes. How can I put that in XI so it performs the command properly?
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Escaping " issue

Post by sreinhardt »

First question, although I figured you checked this already, you're not testing this with the test command button right?

Otherwise some options I might try:

Code: Select all

./check_snmp -H 10.6.59.90 -o SNMPv2-SMI::enterprises.5528.100.4.2.10.1.7.303280526 -C xxxxxx -P 2c -l "Spot Leak" -s \"\"No Leak\"\"

Code: Select all

./check_snmp -H 10.6.59.90 -o SNMPv2-SMI::enterprises.5528.100.4.2.10.1.7.303280526 -C xxxxxx -P 2c -l "Spot Leak" -s "\\"No Leak\\""

Code: Select all

./check_snmp -H 10.6.59.90 -o SNMPv2-SMI::enterprises.5528.100.4.2.10.1.7.303280526 -C xxxxxx -P 2c -l "Spot Leak" -s \\"\\"No Leak\\"\\"
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Escaping " issue

Post by BanditBBS »

I was using the test command. it works fine, disregard this entire thread :(

I knew test command feature had the issue it had to run as apache not as nagios, but didn't realize there was an issue with escaping.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Escaping " issue

Post by abrist »

Yep. user restriction, escaping restrictions, you name it. The test check command is really only good for those simple 'vanilla' checks. I will send this thread down the green mile . . .
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked