monitor https request

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.
varalakshmi
Posts: 13
Joined: Wed Aug 06, 2014 8:01 am

monitor https request

Post 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
User avatar
lgroschen
Posts: 384
Joined: Wed Nov 27, 2013 1:17 pm

Re: monitor https request

Post 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.
/Luke
varalakshmi
Posts: 13
Joined: Wed Aug 06, 2014 8:01 am

Re: monitor https request

Post by varalakshmi »

Thank you so much for the reply..
I will get back to you once i'm done with the installation
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: monitor https request

Post by slansing »

Great, just let us know what the return is, thanks!
varalakshmi
Posts: 13
Joined: Wed Aug 06, 2014 8:01 am

Re: monitor https request

Post by varalakshmi »

Hi Sorry for delay reply..
I installed openssl still i'm getting the same error..thanks
User avatar
lgroschen
Posts: 384
Joined: Wed Nov 27, 2013 1:17 pm

Re: monitor https request

Post by lgroschen »

Please post the command line of the command that you ran and the output in a code block.
/Luke
varalakshmi
Posts: 13
Joined: Wed Aug 06, 2014 8:01 am

Re: monitor https request

Post 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">
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: monitor https request

Post by scottwilkerson »

you need to add the -S flag

Code: Select all

./check_http -H localhost -p443 -vv
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
varalakshmi
Posts: 13
Joined: Wed Aug 06, 2014 8:01 am

Re: monitor https request

Post 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]
User avatar
lgroschen
Posts: 384
Joined: Wed Nov 27, 2013 1:17 pm

Re: monitor https request

Post 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
/Luke
Locked