Webinject 1.51 + Nagios implementation

1,345 views
Skip to first unread message

Lipstars

unread,
Sep 9, 2010, 10:53:03 AM9/9/10
to WebInject
Hi,

I need to monitor some web services and tried at first to use the v.
1.41 found on Webinject website... It works fine but i need some
improvements (redirections possibilities included in v 1.51).

So I took the v1.51 there : http://groups.google.com/group/webinject/browse_thread/thread/c726d6c0af36343c

This works very well in command line but when I want to implement it
in Nagios I got some issues. It returns me "(null)"...

To sum up, I just replaced my actual "webinject.pl" by Sven's one
(v1.51) and it doesn't work anymore :(

Of course i checked if the owner was nagios and if he had enough
rights on "webinject.pl"...

Can someone help me ?

Sven Nierlein

unread,
Sep 9, 2010, 12:40:11 PM9/9/10
to webi...@googlegroups.com
Hi,

add a
2>&1
to your command line to redirect stderr to stdout. Then you will see the error message in nagios.

Regards,
Sven

Lipstars

unread,
Sep 10, 2010, 3:08:33 AM9/10/10
to WebInject
Well, this morning another error was shown in Nagios : "(Return code
of 13 is out of bounds)" which seems to be a permissions error. But
everything seems to be good. My webinject.pl can be found in Nagios'
plugins folder, and my tests are in a "scenarios" folder also in
Nagios' plugins directory. All of them have 755 permissions and there
owner is nagios:nagios.

If I add 2>&1, Nagios returns me "(No output returned from plugin)"
even in Nagios or Standard mode.

Any idea ? :(

On 9 sep, 18:40, Sven Nierlein <s...@nierlein.de> wrote:
>  Hi,
>
> add a
> 2>&1
> to your command line to redirect stderr to stdout. Then you will see the error message in nagios.
>
> Regards,
>  Sven
>
> On 09/09/10 16:53, Lipstars wrote:
>
>
>
> > Hi,
>
> > I need to monitor some web services and tried at first to use the v.
> > 1.41 found on Webinject website... It works fine but i need some
> > improvements (redirections possibilities included in v 1.51).
>
> > So I took the v1.51 there :http://groups.google.com/group/webinject/browse_thread/thread/c726d6c...
>
> > This works very well in command line but when I want to implement it
> > in Nagios I got some issues. It returns me "(null)"...
>
> > To sum up, I just replaced my actual "webinject.pl" by Sven's one
> > (v1.51) and it doesn't work anymore :(
>
> > Of course i checked if the owner was nagios and if he had enough
> > rights on "webinject.pl"...
>
> > Can someone help me ?- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -

Lipstars

unread,
Sep 10, 2010, 6:35:48 AM9/10/10
to WebInject
I'm trying again and again but Nagios always returns me "(null)"... Do
I need to install the whole module (http://search.cpan.org/~nierlein/
Webinject-1.53/lib/Webinject.pm) ? imo it won't change anything. Your
script you gave there : http://groups.google.com/group/webinject/browse_thread/thread/c726d6c0af36343c
should be enough to make it work...

Here are my command/service :

define command{
command_name check_webinject
command_line $USER1$/webinject.pl $ARG1$ -c
$ARG2$
}

define service{
host_name test_webinject
service_description Webinject on web service
use generic-service
check_command check_webinject!scenarios/
test1/testcases.xml!scenarios/test1/config.xml
}

As I said it before, everything work with theses definitions and
webinject.pl v1.41 but when i just replace it by webinject.pl v.1.51,
i got a problem with Nagios returns :(

Sven Nierlein

unread,
Sep 10, 2010, 9:54:07 AM9/10/10
to webi...@googlegroups.com
Hi,

This is the webinject list, not nagios. Please get help about how to configure and debug your Nagios installation
on the nagios-users list or in any nagios forum. But since your webinject runs fine when executed by hand, i
don't think its a webinject problem.

Sven

Lipstars

unread,
Sep 11, 2010, 10:55:56 AM9/11/10
to WebInject
Well, since nagios reports work perfectly with Webinject 1.41, it
could may be a problem with Webinject 1.51 , that's why i made a
thread...

Same configuration, same rights, same location, I can't see how it
could be a nagios problem... but maybe i'm wrong.

Could it be possible to upload your "Webinject.pl" v.1.52 and v1.53
please ?

On 10 sep, 15:54, Sven Nierlein <s...@nierlein.de> wrote:
>  Hi,
>
> This is the webinject list, not nagios. Please get help about how to configure and debug your Nagios installation
> on the nagios-users list or in any nagios forum. But since your webinject runs fine when executed by hand, i
> don't think its a webinject problem.
>
>  Sven
>
> On 09/10/10 12:35, Lipstars wrote:
>
>
>
> > I'm trying again and again but Nagios always returns me "(null)"... Do
> > I need to install the whole module (http://search.cpan.org/~nierlein/
> > Webinject-1.53/lib/Webinject.pm) ? imo it won't change anything. Your
> > script you gave there :http://groups.google.com/group/webinject/browse_thread/thread/c726d6c...

Sven Nierlein

unread,
Sep 13, 2010, 4:39:52 AM9/13/10
to webi...@googlegroups.com
Hi,

On 09/11/10 16:55, Lipstars wrote:
> Well, since nagios reports work perfectly with Webinject 1.41, it
> could may be a problem with Webinject 1.51 , that's why i made a
> thread...
>
> Same configuration, same rights, same location, I can't see how it
> could be a nagios problem... but maybe i'm wrong.
>
> Could it be possible to upload your "Webinject.pl" v.1.52 and v1.53
> please ?

I uploaded the full tar.gz and a prebuild check_webinject to:

http://labs.consol.de/nagios/check_webinject/

If it works from the command line, it should work with nagios. You can test it as
your nagios user with:

env -i ./check_webinject

Regards,
Sven

Lipstars

unread,
Sep 13, 2010, 9:57:43 AM9/13/10
to WebInject
Thanks, i installed your check_webinject v1.53 and tried with it...

Always returning me "(null)" or "(Return code of 13 is out of bounds)"
in Nagios (depending on my command definition...).

Could you just describe me your Webinject's architecture directory
(example: your check_webinject is in the Nagios' "Plugins" directory,
your testcases files are in the webinject directory etc...) even if
it's a part of Nagios settings I know :s.

I ask you this question because I saw on that thread (http://
www.webinject.org/cgi-bin/forums/YaBB.cgi?board=Users;action=display;message=10;num=1142449286)
that Corey, in the 10th post, said there was one way to invoke
correctly Webinject (1.41). I don't know if it's always the case on
v1.53.

As I already said it, "(Return code of 13 is out of bounds)" seems to
be a permissions error... and maybe I gave Webinject/test cases files
a wrong location where temp files cannot be read or something like
that (even if I don't get any error). If you could also give me a
command definition examples it would be perfect (I know I ask a
lot :s).

In fact I'm in internship and one of my goal is to make Webinject
works with some web services. That's around 2 weeks i spent on it and
I'm becoming a bit crazy ^^.

Thanks for your help... :)

Sven Nierlein

unread,
Sep 13, 2010, 11:42:44 AM9/13/10
to webi...@googlegroups.com
Hi,

did you try that as your nagios user?

On 09/13/10 15:57, Lipstars wrote:
>> env -i ./check_webinject

If that works, can you show me your command definition?

Regards,
Sven

Lipstars

unread,
Sep 14, 2010, 2:55:40 AM9/14/10
to WebInject
Yes it works :

sh-3.2$ env -i ./check_webinject
WebInject OK - All tests passed successfully in 8.138 seconds|
time=8.138;0;20;0;0 case1=0.233;0;0;0;0 case2=0.045;0;0;0;0
case3=7.509;0;0;0;0

Here is my command definition :

define command{
command_name check_webinject
command_line $USER1$/Webinject/
check_webinject $ARG1$ -c $ARG2$
}

with a service definition :

define service{
host_name FRU2SPV4
service_description Webinject on Centreon
check_command check_webinject!testcases.xml!
config.xml
max_check_attempts 5
normal_check_interval 4
retry_check_interval 1
check_period 24x7
notification_interval 0
notification_period 24x7
notification_options c,r
contacts nagiosadmin
}



This one returns me "(null)" in Nagios. I tried a lot of different
commands definitions.


The following definition returns me "(Return code of 13 is out of
bounds)" in Nagios :

define command{
command_name check_webinject
command_line $USER1$/Webinject/
check_webinject $USER1$/$ARG1$ -c $USER1$/$ARG2$
}

define service{
host_name FRU2SPV4
service_description Webinject on Centreon
check_command check_webinject!scenarios/
centreon/testcases.xml!scenarios/centreon/config.xml
max_check_attempts 5
normal_check_interval 4
retry_check_interval 1
check_period 24x7
notification_interval 0
notification_period 24x7
notification_options c,r
contacts nagiosadmin
}

Of course my test cases files (testcases.xml + config.xml) are both in
the "plugins" directory and the "plugins/scenarios/centreon/" one.

Any idea ? :o

Sven Nierlein

unread,
Sep 14, 2010, 4:51:44 AM9/14/10
to webi...@googlegroups.com
Hi,

Use absolute paths for your config and testcases.
And change your command_line to

command_line $USER1$/Webinject/check_webinject $ARG1$ -c $ARG2$ 2>&1

Sven

Lipstars

unread,
Sep 14, 2010, 6:02:42 AM9/14/10
to WebInject
Hello,

I tried with :

command_line $USER1$/Webinject/check_webinject
$ARG1$ -c $ARG2$ 2>&1

and

check_command check_webinject!/usr/lib/nagios/plugins/scenarios/
centreon/testcases.xml!/usr/lib/nagios/plugins/scenarios/centreon/
config.xml

Even with an absolute path and 2>&1 output, nothing new :(, it returns
me "(Return code of 13 is out of bounds)".

Sven Nierlein

unread,
Sep 14, 2010, 6:13:58 AM9/14/10
to webi...@googlegroups.com
Thats what webinject.org says about this error:


Troubleshooting

Beware that if you run WebInject with a user other than the default 'nagios', some files may be created with this user. Nagios will obtain an error if it can't write to these files. So give the ownership of these files to 'nagios' or remove them and run WebInject again as the 'nagios' user (the one declared in nagios.cfg). If you have file ownership issues, this will show up in Nagios with an error like "Return code of 13 for check of service ... on host ... was out of bounds"

Make sure the 'nagios' user has sufficient rights to execute webinject.pl, and to write to output files http.log, result.xml, and result.html. (if you don't have this setup correctly, you will get back invalid return codes from the plugin)


I am currently adding some fixes and will release a 1.54 soon. I will add proper error messages for this too.

Sven

Lipstars

unread,
Sep 14, 2010, 6:27:22 AM9/14/10
to WebInject
Yea i already saw that on the Webinject site. But as I said it,
everything works great with Webinject 1.41. Then I installed Webinject
1.53 under the nagios user, so he should have enough rights. I also
checked again and again if he had the good rights on each files/
directories and everything seems to be OK... so maybe the error isn't
correctly handled by the new Webinject I don't know :(

On 14 sep, 12:13, Sven Nierlein <s...@nierlein.de> wrote:
>  Thats what webinject.org says about this error:
>
>     Troubleshooting
>
> Beware that if you run WebInject with a user other than the default 'nagios', some files may be created with this user. Nagios will obtain an error if it can't write to these files. So give the ownership of these files to 'nagios' or remove them and run WebInject again as the 'nagios' user (the one declared in nagios.cfg). If you have file ownership issues, this will show up in Nagios with an error like "Return code of 13 for check of service ... on host ... was out of bounds"
>
> Make sure the 'nagios' user has sufficient rights to execute webinject.pl, and to write to output files http.log, result.xml, and result.html. (if you don't have this setup correctly, you will get back invalid return codes from the plugin)
>
> I am currently adding some fixes and will release a 1.54 soon. I will add proper error messages for this too.
>
>  Sven
>
> On 09/14/10 12:02, Lipstars wrote:
>
>
>
> > Hello,
>
> > I tried with :
>
> > command_line                    $USER1$/Webinject/check_webinject
> > $ARG1$ -c $ARG2$ 2>&1
>
> > and
>
> > check_command check_webinject!/usr/lib/nagios/plugins/scenarios/
> > centreon/testcases.xml!/usr/lib/nagios/plugins/scenarios/centreon/
> > config.xml
>
> > Even with an absolute path and 2>&1 output, nothing new :(, it returns
> > me "(Return code of 13 is out of bounds)".
>
> > On 14 sep, 10:51, Sven Nierlein <s...@nierlein.de> wrote:
> >>  Hi,
>
> >> Use absolute paths for your config and testcases.
> >> And change your command_line to
>
> >> command_line    $USER1$/Webinject/check_webinject $ARG1$ -c $ARG2$ 2>&1
>
> >>  Sven- Masquer le texte des messages précédents -

Sven Nierlein

unread,
Sep 14, 2010, 6:46:39 AM9/14/10
to webi...@googlegroups.com
Hi,

On 09/14/10 12:27, Lipstars wrote:
> Yea i already saw that on the Webinject site. But as I said it,
> everything works great with Webinject 1.41. Then I installed Webinject
> 1.53 under the nagios user, so he should have enough rights. I also
> checked again and again if he had the good rights on each files/
> directories and everything seems to be OK... so maybe the error isn't
> correctly handled by the new Webinject I don't know :(

could you please try the attached new version? If it works for you, i will create
a new release. At least there should be a more useful error message with this
version.

Sven

check_webinject-1.54.tar.gz

Lipstars

unread,
Sep 14, 2010, 8:31:46 AM9/14/10
to WebInject
It works a little bit more ^^. With 1.54 my service gets "Unknown" and
Nagios returns me "ERROR: Failed to write ./http.log: Permission
denied".

But there are the http.log rights : -rwxrwxrwx 1 nagios nagios 0 Sep
14 14:19 http.log

Nagios user got all the rights on it so I don't understand why he has
"Permission denied"...

I tried to delete the current http.log, tried also to create a new one
by launching webinject in command line, but nothing works and
everytime i get the same error.
>  check_webinject-1.54.tar.gz
> 20KAfficherTélécharger

Sven Nierlein

unread,
Sep 14, 2010, 9:25:17 AM9/14/10
to webi...@googlegroups.com
Please set a proper output_directory when using the http.log

>> 20KAfficherT�l�charger

Lipstars

unread,
Sep 14, 2010, 10:20:40 AM9/14/10
to WebInject
THANK YOU very much :). It works ! Indeed I forgot to specify an
output directory in my conf files... with the 1.54 it's easier to see
where does the problem come from ;)

Nevertheless there is one new "problem". The "standard" report type
seems now to be the same as nagios one...
> >> 20KAfficherT�l�charger- Masquer le texte des messages précédents -

Sven Nierlein

unread,
Sep 14, 2010, 11:51:39 AM9/14/10
to webi...@googlegroups.com
On 09/14/10 16:20, Lipstars wrote:
> Nevertheless there is one new "problem". The "standard" report type
> seems now to be the same as nagios one...

Only if you use the check_webinject. Not when you use the webinject.pl.
Have you tried to set the report_type in your config.xml?

Lipstars

unread,
Sep 15, 2010, 5:39:50 AM9/15/10
to WebInject

> Only if you use the check_webinject. Not when you use the webinject.pl.

You are right. I only tried with the "check_webinject". It works fine
with the "webinject.pl" ;).

Well thank you for everything ! I hope I wasn't too annoying. But this
thread will certainly help some people :p.

Phrozendice

unread,
Jan 16, 2014, 2:54:29 PM1/16/14
to webi...@googlegroups.com
Hey there!

How did you get it to work? I have the same exact problem you have, I get (null) as nagios output but it works when i run from the command line...

You say you got it to work by specifying the output dir? How did you do that? I even specified this on my commands as follows and still no luck!

    command_name    check_webinject
    command_line    %USER1$/check_webinject -n -c %USER1$//config.xml

Like i said, everything works via command line.

Please help?
Reply all
Reply to author
Forward
0 new messages