Page 1 of 2

monitor https request

Posted: Tue Dec 09, 2014 1:32 am
by varalakshmi
Hi Sir

I want to monitor https request in nagios

./check_http -Hlocalhost -p443 -vv
GET / HTTP/1.1
User-Agent: check_http/v2.0 (nagios-plugins 2.0)
Connection: close
Host: localhost:443


http://localhost:443/ is 553 characters
STATUS: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
**** HEADER ****
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
Reason: You're speaking plain HTTP to an SSL-enabled server port.<br />
Instead use the HTTPS scheme to access this URL, please.<br />
<blockquote>Hint: <a href="https://localhost/"><b>https://localhos ... kquote></p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at localhost Port 443</address>
</body></html>
**** CONTENT ****

HTTP CRITICAL - Invalid HTTP response received from host on port 443: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">


./check_http -H localhost -p 443 --ssl
check_http: Invalid option - SSL is not available
Usage:
check_http -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]
[-J <client certificate file>] [-K <private key>]
[-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-E] [-a auth]
[-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]
[-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]
[-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]
[-A string] [-k string] [-S <version>] [--sni] [-C <warn_age>[,<crit_age>]]
[-T <content-type>] [-j method]


I'm not able to understand this error please do some one suggest how to monitor https websites in nagios

Thanks
Varalakshmi

Re: monitor https request

Posted: Tue Dec 09, 2014 10:23 am
by lgroschen
Type the following in your command line and paste of all of the output: (I added my output also)

Code: Select all

[root@XIdevel libexec]# nmap localhost -p 443

Starting Nmap 5.51 ( http://nmap.org ) at 2014-12-09 09:02 CST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000038s latency).
PORT    STATE SERVICE
443/tcp open  https

Nmap done: 1 IP address (1 host up) scanned in 0.09 seconds
[root@XIdevel libexec]# which openssl
/usr/bin/openssl
[root@XIdevel libexec]# yum -y install openssl openssl-devel 
If you don't have openssl or openssl-devel installed yum will install the with the last command above. Then, if either of these packages are missing, you will have to recompile the plugins tarball. You can find the latest tarball here:

http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz

Recompile plugins and give it a shot.

Re: monitor https request

Posted: Tue Dec 09, 2014 10:54 am
by varalakshmi
Thank you so much for the reply..
I will get back to you once i'm done with the installation

Re: monitor https request

Posted: Tue Dec 09, 2014 11:17 am
by slansing
Great, just let us know what the return is, thanks!

Re: monitor https request

Posted: Tue Dec 16, 2014 12:38 am
by varalakshmi
Hi Sorry for delay reply..
I installed openssl still i'm getting the same error..thanks

Re: monitor https request

Posted: Tue Dec 16, 2014 4:34 pm
by lgroschen
Please post the command line of the command that you ran and the output in a code block.

Re: monitor https request

Posted: Thu Dec 18, 2014 11:24 pm
by varalakshmi
Hi ,

Same output i'm getting after installing openssl

nmap localhost -p 443

Starting Nmap 5.21 ( http://nmap.org ) at 2014-12-19 09:49 IST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00011s latency).
PORT STATE SERVICE
443/tcp open https

Nmap done: 1 IP address (1 host up) scanned in 1.28 seconds

./check_http -H localhost -p443 -vv
GET / HTTP/1.1
User-Agent: check_http/v2.0 (nagios-plugins 2.0)
Connection: close
Host: localhost:443


http://localhost:443/ is 553 characters
STATUS: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
**** HEADER ****
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
Reason: You're speaking plain HTTP to an SSL-enabled server port.<br />
Instead use the HTTPS scheme to access this URL, please.<br />
<blockquote>Hint: <a href="https://localhost/"><b>https://bbnlnagi ... kquote></p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at localhost Port 443</address>
</body></html>
**** CONTENT ****

HTTP CRITICAL - Invalid HTTP response received from host on port 443: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

Re: monitor https request

Posted: Fri Dec 19, 2014 9:36 am
by scottwilkerson
you need to add the -S flag

Code: Select all

./check_http -H localhost -p443 -vv

Re: monitor https request

Posted: Mon Dec 22, 2014 1:20 am
by varalakshmi
Hi Sir
if i add -S flag it gives me error like Invalid option - SSL is not available

Code: Select all

./check_http -H localhost -p 443 -vv -S
check_http: Invalid option - SSL is not available
Usage:
 check_http -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]
       [-J <client certificate file>] [-K <private key>]
       [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-E] [-a auth]
       [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]
       [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]
       [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]
       [-A string] [-k string] [-S <version>] [--sni] [-C <warn_age>[,<crit_age>]]
       [-T <content-type>] [-j method]

Re: monitor https request

Posted: Mon Dec 22, 2014 11:40 am
by lgroschen
Looks like you didn't compile plugins with SSL. Go into your plugins directory and do the following:

Code: Select all

sudo ./configure --with-openssl=/usr/bin/openssl
sudo make clean
sudo make
sudo make install
Then restart nagios: service nagios restart