Hi,
I'm using WebInject as a Nagios plugin to check a web server using XML
POST. When the request fails, the plugin provides the information in
the way like 'WebInject test case x failed'. I've read the manual and
found that I can also use a custom error message, like 'It's hard to
say this, but there's an error.'
What do I need is to get a notification from Nagios which includes
server error message output. I've tried to play with postresponse and
{PARSEDRESULT}, but without success.
Here is my config file:
<case
id="1"
description1="My Description"
addheader='SOAPAction: "
http://myurl/MyAction"'
logrequest="yes"
logresponse="yes"
method="post"
parseresponse='"string1"|"string2"|escape'
posttype="text/xml"
postbody="file=>myfile.xml"
url="
http://myurl"
verifypositive="MYTESTMESSAGE"
errormessage = "got error: {PARSEDRESULT}"
/>
When I launch
webinject.pl with this config, I receive the following
message:
-------------------------------------------------------
Use of uninitialized value in substitution (s///) at ./
webinject.pl
line 1148.
Test: testcasestest.xml - 1
My Description
Verify : "MYTESTSTRING"
Passed XML Parser (content is well-formed)
Failed Positive Verification
Failed HTTP Response Code Verification (HTTP/1.1 405 Method Not
Allowed)
Use of uninitialized value $_ in substitution (s///) at ./
webinject.pl
line 1161.
TEST CASE FAILED : got error:
Response Time = 0.134 sec
-------------------------------------------------------
Can someone help me with solving my problem? What I actually need is
to receive a notification from Nagios like:
CRITICAL: Error! Server returned XXX error code with a message
*messagetext*.
Thanks!