Get detailed error response from WebInject Nagios Plugin using XML POST

1,187 views
Skip to first unread message

Andrei Poltoratsky

unread,
Feb 20, 2012, 3:52:24 PM2/20/12
to WebInject
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!

Sven Nierlein

unread,
Feb 20, 2012, 4:29:39 PM2/20/12
to webi...@googlegroups.com
Hi Andrei,

Try the latest version, as far as i remember, this has already been solved.

Sven

Andrei Poltoratsky

unread,
Feb 21, 2012, 1:36:11 PM2/21/12
to WebInject
Dear Sven,

I'm using WebInject 1.41. It seems to be a latest version.

Sven Nierlein

unread,
Feb 21, 2012, 1:41:49 PM2/21/12
to webi...@googlegroups.com
On 2/21/12 19:36, Andrei Poltoratsky wrote:
> Dear Sven,
>
> I'm using WebInject 1.41. It seems to be a latest version.

Development has moved to github and cpan. Get the latest version
from http://search.cpan.org/perldoc?Webinject or https://github.com/sni/Webinject
Latest version is the 1.72.

Sven

Andrei Poltoratsky

unread,
Feb 21, 2012, 6:05:07 PM2/21/12
to WebInject
Oh!

Thanks a lot for the information. I'll try to get the latest version
from github and will inform about the results. Just in case if someone
will search Google for the same problem solution.

On Feb 21, 8:41 pm, Sven Nierlein <s...@nierlein.de> wrote:
> On 2/21/12 19:36, Andrei Poltoratsky wrote:
>
> > Dear Sven,
>
> > I'm using WebInject 1.41. It seems to be a latest version.
>
> Development has moved to github and cpan. Get the latest version
> fromhttp://search.cpan.org/perldoc?Webinjectorhttps://github.com/sni/Webinject
Message has been deleted

sven

unread,
Mar 3, 2012, 2:44:02 PM3/3/12
to webi...@googlegroups.com
On 27.02.2012 22:18, Andrei Poltoratsky wrote:
> Thanks, it worked. I installed the latest Webinject 1.72 and got
> 'parseresponse' working fine.
>
> Now I have another problem. If I define a custom error message like
> errormessage="Error: {PARSEDRESULT}" and I receive communication error
> (like bad DNS or something), I'm getting a notification just like it
> was defined in the config file 'Error: {PARSEDRESULT}'. But in this
> case I expect to receive something like 'Bad DNS' or 'Connection
> timeout'. Is it possible with report type 'nagios' and defined
> 'errormessage'?

I think its better to have a seperate check for dns or http response
time and use webinject just
for end-to-end tests. Nagios offers much more possibilities than
webinject. You could even combine
these checks with the fabulous 'check_multi' plugin. So first do you
basic dns, ping, http check and
then webinject at the end.

Sven

Andrei Poltoratsky

unread,
Mar 7, 2012, 11:00:11 AM3/7/12
to WebInject
I didn't know about check_multi. Will search Google.

Thanks, Sven!
Reply all
Reply to author
Forward
0 new messages