Here is an example of me trying to test webservice test using soap here i my try
check comman config is as below
$USER1$/check_http -H $HOSTADDRESS$ -k $ARG1$ -T 'text/xml' -P $ARG2$ -t 10 -m 512 -u $ARG3$
where $ARG2$ is an xml as follows
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<VerifyByAcct xmlns="http://webservices.xxxx.com/AccountVeri ... WebService">
<acctId>string</acctId>
<allPremises>boolean</allPremises>
</VerifyByAcct>
</soap:Body>
when I execute this with test Check command here is what we get . the whole ARG2 dissapears.
/usr/local/nagios/libexec/check_http -H xxxx.xxxx.com -k SOAPAction: "http://webservices.xxxx.com/AccountVeri ... rifyByAcct" -T 'text/xml' -P '\' -t 10 -m 512 -u /AccountVerificationWebService/AccountVerification.asmx
XML input to check_http
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: XML input to check_http
As mentioned before, please let the check run itself instead of using the test command function. The test command function WILL strip things that nagios and XI in general will not. Secondly this string is not url encoded. According to the online plugin man page you will need to escape the quotes and such. Newlines and endlines are also a bad idea to include, this should be a single line string. Just to verify, you are not passing this as a file, but the actual direct string to the argument correct?
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.
Re: XML input to check_http
I tried your suggestion and now i get null as the response from check_http . i have no idea where to look for the real results returned by the check_http. Is there any verbose logs of the execution of the command?
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: XML input to check_http
To my knowledge there is not a verbose option for check_http. Considering it executes from the nagios processes, although not quite correctly. Lets run this from the command line instead and see if you can get more information.
cd /usr/local/nagios/libexec
./check_http -H [Remote IP] -k [Header String] -T 'text/xml' -P [XML\Post String] -t 10 -m 512 -u [URL Path]
cd /usr/local/nagios/libexec
./check_http -H [Remote IP] -k [Header String] -T 'text/xml' -P [XML\Post String] -t 10 -m 512 -u [URL Path]
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.
Re: XML input to check_http
after running from command line , check_http I had to replace %22 with '' and it worked. But now what do i do? How do i make it work through Nagios XI?
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: XML input to check_http
Interesting that you needed to unencode that. At this point I would suggest taking the xml string that you used for post data and replacing it in the xi service argument that is defined. Then schedule an immediate check instead of using the test command button.
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.
Re: XML input to check_http
Thank you for all your support.
It worked!!! . the main learnings here are
1. you do not need to uuencode XML strings
2. single quote is your friend. In the command definition I supplied the single quote around arguments ex '$ARG1$'
3. -v works when debugging as args
here is the final command looks like in core config
$USER1$/check_http -H $HOSTADDRESS$ -k '$ARG1$' -T 'text/xml' -P '$ARG2$' -t 10 -m 512 -u '$ARG3$' -r '$ARG4$'
It worked!!! . the main learnings here are
1. you do not need to uuencode XML strings
2. single quote is your friend. In the command definition I supplied the single quote around arguments ex '$ARG1$'
3. -v works when debugging as args
here is the final command looks like in core config
$USER1$/check_http -H $HOSTADDRESS$ -k '$ARG1$' -T 'text/xml' -P '$ARG2$' -t 10 -m 512 -u '$ARG3$' -r '$ARG4$'
Re: XML input to check_http
Duly noted. Locking thread.
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.
"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.