Monitor Webpage without checking keyword

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
scheema31
Posts: 90
Joined: Wed Jun 06, 2012 1:11 pm

Re: Monitor Webpage without checking keyword

Post by scheema31 »

thanks for quick update jdalrymple.
i updated my files to match your settings however i still get an error for authorization
HTTP WARNING: HTTP/1.1 401 Authorization Required - 681 bytes in 0.034 second response time
is there a way we can try this without having to use authentication, i used have this working just fine but then we upgraded our svn to a newer version and since nagios has been failing.
here is how i had it setup before the upgrade when nagios checks were working fine:

define command{
command_name check_https
command_line /usr/local/nagios/libexec/check_http -S -H $ARG1$ -p 443 -u $ARG3$ --regex=$ARG2$ -w 3 -c 5 -t 10
}
define service{
use pager_generic-service
host_name sv-baysvn-01.baynet.local
service_description - https://svn.bayleaf.com -
check_command check_https!svn.bayleaf.com!VisualSVN!
}

thanks,
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Monitor Webpage without checking keyword

Post by jdalrymple »

In order to check without authorization you'd have to *NOT* require auth on the SVN server, this is unlikely.

This does appear to use basic web auth though, and in my lab the -a argument is working great.

Code: Select all

[root@localhost libexec]# ./check_http -S -H www.somesite.com -p 443 -u /index.html -t 10 -a jdalrymple:password
HTTP OK: HTTP/1.1 200 OK - 15657 bytes in 0.208 second response time |time=0.207982s;;;0.000000 size=15657B;;;0
[root@jrd-cent65-5 libexec]# ./check_http -S -H www.somesite.com -p 443 -u /index.html -t 10
HTTP WARNING: HTTP/1.1 401 Unauthorized - 390 bytes in 0.286 second response time |time=0.285763s;;;0.000000 size=390B;;;0
Same thing for you - from the command line it's working. Just so I can double check your syntax, can you repost your updated command and service definitions?
scheema31
Posts: 90
Joined: Wed Jun 06, 2012 1:11 pm

Re: Monitor Webpage without checking keyword

Post by scheema31 »

here are my configs, i had set it up exactly like the example.

define command{
command_name check_https_plain
command_line /usr/local/nagios/libexec/check_http -S -H $ARG1$ -a $ARG2$
}


define service{
use pager_generic-service
host_name sv-baysvn-01.baynet.local
service_description https://svn.bayleaf.com -
check_command check_https_plain!svn.bayleaf.com!scheema:*****! (the "!" is part of the password, would that be throwing anything off?)
}

checks are definiatly made as nagios shows the service in "warning" state
any thoughts?
thanks
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Monitor Webpage without checking keyword

Post by jdalrymple »

scheema31 wrote:(the "!" is part of the password, would that be throwing anything off?)
YES!

Code: Select all

define service {
        host_name                       localhost
        service_description             nobang
        use                             local-service
        check_command                   check_dummy!0!!!!!!!!
        register                        1
        }

define service {
        host_name                       localhost
        service_description             bang
        use                             local-service
        check_command                   check_dummy!0!\!!!!!!!
        register                        1
        }
Attachments
Clipboard02.jpg
scheema31
Posts: 90
Joined: Wed Jun 06, 2012 1:11 pm

Re: Monitor Webpage without checking keyword

Post by scheema31 »

Hi,

so i have updated my file:
define service{
use pager_generic-service
host_name sv-baysvn-01.baynet.local
service_description https://svn.bayleaf.com -
check_command check_https_plain!svn.bayleaf.com!scheema:*****!\!
}
however im still getting authorization errors:
HTTP WARNING: HTTP/1.1 401 Authorization Required - 681 bytes in 0.042 second response time

thanks,
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Monitor Webpage without checking keyword

Post by jdalrymple »

A couple of things to look at ... mine's definitely working so we should be able to get yours working...

Code: Select all

[jdalrymple@localhost libexec]$ ./check_http -V
check_http v2.0.3 (nagios-plugins 2.0.3)
Make sure we're using the same version

Code: Select all

[root@localhost libexec]# ./check_http -S -H www.somesite.com -p 443 -u /index.html -t 10 -a jdalrymple:password
Note that I specify a -u and argument to go with it. I'm not sure that it should be strictly necessary, but maybe. I suppose that would depend on what the server's expectation is.
scheema31
Posts: 90
Joined: Wed Jun 06, 2012 1:11 pm

Re: Monitor Webpage without checking keyword

Post by scheema31 »

Hi,

so i have updated my nagios to Version 4.0.8. however when using your command (./check_http -V) to check version it shows as what it did before. is there another process to update the nagios-plugin?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Monitor Webpage without checking keyword

Post by jdalrymple »

Nagios Core and Nagios Plugins are not the same pieces of software:

http://www.nagios.org/download/plugins
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Monitor Webpage without checking keyword

Post by tgriep »

Exclamation points are used to separate command arguments, so they need to be treated somewhat differently.

One way to get around using ! in passwords is to do the following

You will need to edit /usr/local/nagios/etc/resource.cfg and enter in a new line with the following:

$USER10$=xyzabc!

and save the file. You will need to type in your password in place of 'xyzabc!'.

Then you will need to edit your command definition like so:

check_command check_https_plain!svn.bayleaf.com!scheema:$USER10$

and save that file. Then run:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios reload

and your check should work for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
scheema31
Posts: 90
Joined: Wed Jun 06, 2012 1:11 pm

Re: Monitor Webpage without checking keyword

Post by scheema31 »

thanks tgriep.
i will try your solution after i update the nagios plugins to version 2.0.3
is this the correct procedure to update:
1. mv to old libexec folder ( /usr/local/nagios/libexec )
2. tar xzf nagios-plugins-1.4.16.tar.gz
3. cd nagios-plugins-1.4.16
4. ./configure --with-nagios-user=nagios --with-nagios-group=nagios
5. make
6. make install

are there any additional steps after this?
do i need to restart nagios?
do i need to update the nagios agents?
Locked