check_http syntax?


#1

I’m trying to setup nagios where it monitors a website with a port. This website in on a Windows 2003 Server.

When I try the command manually to test - check_http -H “WinSrv IP” -p xxxx
I get an error message “check_http -H: Invalid option -SSL in not available”

When I try it with out the -p command - check_http -H “WinSrv IP” -S
I get an error message “check_http -H: Invalid option -SSL in not available”

What am I missing with the syntax - could it be that I need an something to monitor Windows based server or I need additional plugins.

I know I’m no expert, but help is greatly appreciated.

Thx.


#2

Usage:
check_http -H | -I -u ] -p ]
-w ] -c ] -t ] -L] -a auth]
-b proxy_auth] -f <ok|warning|critcal|follow|sticky|stickyport>]
-e ] -s string] -l] -r | -R ]
-P string] -m <min_pg_size>:<max_pg_size>] -4|-6] -N] -M ]
-A string] -k string] -S] --sni] -C ] -T ]
-j method]

try running ./check_http --help


#3

I was doing some web search and found that I may bet missing some plugins. The syntax I was using should’ve worked by it didn’t.

How do I go about and installing the missing ‘ssl’ nagios pluggin?


#4

Check the output of the configure step when compiling the plugins…

a) You are not using ssl so i don’t see why you would need SSL libraries, if check_http required the libs it wouldn’t have compiled.
b) Your syntax is wrong -H does not want an IP, and you don’t need to use the switch twice for sure.


#5

The syntax is definitely correct. I’ve just confirmed it using a colleague of mine nagios system.

check_http -H 'servername' or 'server_ip' -S -p 'port#'

HTTP OK: HTTP/1.1 302 Found -129 bytes in 0.029 seconds response time |time ....blah, blah...

I think, that I need to install some sort of SSL software. Unfortunately, I’m pretty new to Linux/UNIX. What SSL would I need though? I’ve installed openssl-devel, openssl, pyOpenSSL, perl-Cryp-OpenSSL.

Yes, you are right my syntax is wrong. I’ve inadvertently added an extra -H after the IP address. -H will accept either hostname or IP address with the ‘check_http’ command - just verified it.


#6

usage syntax says the opposite… and it mainly depends id you are using vhosts or not.

as i sadi above check the errors and warnings you may get during the configure step. (it should be libssl something )


#7

[quote=“luca”]usage syntax says the opposite… and it mainly depends id you are using vhosts or not.

as i sadi above check the errors and warnings you may get during the configure step. (it should be libssl something )[/quote]

Sorry, kind-a new to Linux. Could you elaborate when you said “check the errors and warnings you may get during the configure step. (it should be libssl something )”?

Thanks


#8

did you install from source or RPM?
If you went from RPM, the package *****, compile from source following the docs: nagios.sourceforge.net/docs/3_0/quickstart.html
If you already did from source, re-read the docs :slight_smile:


#9

So, I went to basic and started all over again! :cry:

So, here’s what I have when manually running the command:

/usr/local/nagios/libexec/check_http -H serverip.com -S -p port#

HTTP OK: HTTP/1.1 302 Found -129 bytes in 0.048 seconds response time |time=0.047785s;;;0.000000 size=129B;;;0

So, it’s working.

Here’s my nrpe.cfg to check command:

command[check_https_port]=/usr/local/nagios/libexec/check_http -H $ARG1$ -S -p $ARG2$

And here’s my services.cfg:

define service{
        use                                    basic-http-service
        service_description            Server Web Login
        contact_groups                  admintest
        host_name                         server hostname
        check_command                 check_nrpe!check_https_port
        }

I’m so, so, sure that my code is correct - actually it’s not correct! Cause, I’m getting two types of error - cause I have two test website.
The first error - Connection refused by host
The second error - CHECK-NRPE: Socket timeout after 10 seconds.

Can you point me out to the right syntax?
Your help has been greatly appreciated -BIG TIME!

Thanks again.


#10

Forgot to mention about the page, so I’ve added the -u

/usr/local/nagios/libexec/check_http -H serverhostname.com -S -p 7773 -u /folder/webpage.jsp

HTTP OK: HTTP/1.1 200 OK - 5129 bytes in 0.038 second response time |time=0.038029s;;;0.000000 size=5129B;;;0

I modified my nrpe.cfg

command[check_https_port]=/usr/local/nagios/libexec/check_http -H $ARG1$ -S -p $ARG2$ -u $ARG3$

I’m still missing how to configure services.cfg - not even sure if my nrpe.cfg is correct.

TIA…


#11

Where does the NRPE stuff come from now?
You want a server to direct another server to check http on a THIRD server?!


#12

I’m not sure I understand the question, but, the nrpe comes from the same directory - I guess.

No, I only have one nagios server. What I’m trying to accomplish with nagios is to check a webserver and make sure that it’s webpage is up.

So, when I manually run the command:/usr/local/nagios/libexec/check_http -H serverhostname.com -S -p 7773 -u /folder/webpage.jsp I get a positive response of OK.

I think I’ve got the nrpe.cfg command line configured. But, having a little trouble in getting the services.cfg arguments for the nrpe to work.

For instance, here is my nrpe.cfg command line to check for https with port check:command[check_https_port]=/usr/local/nagios/libexec/check_http -H $ARG1$ -S -p $ARG2$ -u $ARG3$ It has 3 arguments, one for the webpage, one for the port no., and one for the actual folder and file/page.

Here’s my services.cfg for checking the https site define service{ use basic-http-service service_description Login contact_groups Web-test host_name webserver check_command check_nrpe!check_https_port!https://serverhostname.com!9999!/user/signin.jsp } Are my inputs for the arguments correct - nope. I guess I need to see a sample or a proper syntax on how to provide the right arguments.

Again many thanks and sorry for being a newbie.


#13

First get rid of the nrpe stuff… :slight_smile:

read here for a beginners intro to checking services, there’s a complete example for check_http

nagios.sourceforge.net/docs/3_0/ … vices.html

This should be enough to get you going.


#14

I’m really sorry for not getting it - chalk this one up for being a nub!

This is what I have for services define service{ use basic-http-service service_description Web Login Test contact_groups webtest host_name serverhostname check_command check_https_portx!https://serverhostname.com }

and here’s what I have for nrpe config command[check_https_portx]=/usr/local/nagios/libexec/check_http -H $ARG1$ -S -p 7773 -u /user/signin.jsp

Now, I get an error message when running a -v test.
Checking services…
Error: Service check command ‘check_https_portx’ specified in service ‘Web Login Test’ for host ‘serverhostname’ not defined anywhere!

Also, the link doens’t have sample of using check_http with -S, -p, and a -u. Using check_http is an nrpe command or part of the nagios plugins?


#15

Again, why are you trying to get NRPE into play? NRPE is for checking services on REMOTE hosts. You don’t even want to know that name now!

you need a simple CHECK_HTTP as defined in the example i gave you, and THEN you need to add two parameters. and you almost got that right, except for the fact you insist on adding nrpe configs somewhere…

define a host in hosts.cfg
define a service in services.cfg
define a command in command.cfg

You don’t need anything more than this.


#16

YOU, are a life saver! When you explained it and mentioned the command.cfg. Everything clicked!

Thank you for being patient with me - greatly appreciated it.


#17

Happy it worked in the end, i was out of hope :mrgreen:


#18

:lol: Me too!