5 Nagios Check - HTTP Plugin Examples For HTTP - HTTPS
5 Nagios Check - HTTP Plugin Examples For HTTP - HTTPS
What is check_http?
5 check_http examples
Syntax and Options
Related Commands
What is check_http?
check_http plugin is used to verify the status of HTTP server (or HTTPS) that is running on a remote
host. If you’ve installed Nagios from source, check_httpd command will be located in the
/usr/local/nagios/libexec directory.
1. Check HTTP
Check whether Apache HTTP is running on a remote server using check_http.
$ check_http -H 192.168.1.50
HTTP OK HTTP/1.1 200 OK - 332 bytes in 0.004 seconds |time=0.004144s;;;0.000000 siz
2. Check HTTPS
Check whether Apache HTTPS is running on a remote server using check_http.
$ check_http -H 192.168.1.50 -S
HTTP OK HTTP/1.1 200 OK - 332 bytes in 0.004 seconds |time=0.004144s;;;0.000000 siz
If the remote server runs only HTTP and not HTTPS, you’ll get “HTTP CRITICAL – Unable to open TCP
socket” message as shown below.
$ check_http -H 192.168.1.50 -S
Connection refused
HTTP CRITICAL - Unable to open TCP socket
Short Long
Option Description
Option Option
-H –hostname host name of the server where HTTP (or HTTPS) daemon is running
-I –IP-address ip address of the HTTP (or HTTPS) server
-p –port Port number where HTTP server runs. Default is 80
-4 –use-ipv4 This will use IPv4 connection
-6 –use-ipv6 This will use IPv6 connection
-S –ssl This will use HTTPS using default 443 port
-C –certificate Minimum number of days a SSL certiface must be valid.
-e –expect Expected response string. Default is HTTP/1
-s –string Expected content string.
-u –url URL to check
-P –post URL encoded http POST data
Do not wait for whole document body to download. Stop once the headers are
-N –no-body
downloaded.
Check whether a document is older than x seconds. Use 5 for 5 seconds, 5m for 5
-M –max-age
minutes, 5h for 5 hours, 5d for 5 days.
–content-
-T Indicate content type in header for POST request
type
-l –linespan Regular expression can span to new line (Use this with -r or -R option)
–regex, –
-r Use this regular expression to search for string in the HTTP page
ereg
-R –eregi Same as above, but with ignore case.
–
-a If the site user basic authentication send uid, pwd in the format uid:pwd
authorization
-A –useragent Pass the specified string as “User Agent” in HTTP header.
-k –header Add additional tags that should be sent in the HTTP header.
-L –link The output is wrapped as HTML link
When a URL is redirected, use this to either follow the URL, or send ok, warning,
-f –onredirect
or critical notification
Specify the minimum and maximum page size expected in bytes. Format is
-m –pagesize
minimum:maximum
-w –warning Response time in seconds for warning state
Specify the minimum and maximum page size expected in bytes. Format is
-m –pagesize
minimum:maximum
-w –warning Response time in seconds for warning state
-c –critical Response time in seconds for critical state
-t –timeout Number of seconds to wait before connection times out. Default is 10 seconds
Related Commands
check_ping
check_ftp
Can i specify what a valid response is, i.e. does the HTML display “xx welcome xx”?
LINK
Hello, ask a question, check_http detect page size, page size detection value changes again, the
alarm.
LINK
LINK
That is superb artile I was looking for! Far better then Nagios documentation.
LINK
alexydz December 20, 2012, 10:29 pm
LINK
Dear Friends,
I am gettinr this error in nagios3. can anyone help me out for this problem:-
Check-Website-Response
UNKNOWN 2013-04-25 18:11:24 0d 0h 55m 37s 4/4 RESPONSE: UNKNOWN – ERROR: /usr/bin/nc
does does not exist
LINK
nitin: you need to install the netcat package for your distribution which will provide
/usr/bin/nc
LINK
I had been using this plugin for a while. But today when I am trying to post an XML message to the
server, from console it works well but does not work with nrpe.
It says “Unknown option specified in config file ”
The command is
LINK
hello.. I test the command from command line successfull, but when I insert in configuration
file (cfg) it gives Error: Service check command ‘check_http -H MYIP -u http://MYIP/test.php‘ specified
in service ‘HTTP’ for host ‘Server01’ not defined anywhere!
Here is my configuration :
define service{
use generic-service ; Name of service template to use
host_name Server01
service_description check http://MYIP/test.php
check_command check_http -H MYIP -u http://MYIP/test.php
notifications_enabled 0
}
LINK
@sunardo – I just ran into this exact same thing. It looks like that with the default install,
there’s no configuration set up to tell Icinga where to look for the check_http executable. You need to add
the full path to it in the check_command. For example:
check_command /usr/share/nagios/plugins/check_http -H MYIP -u http://MYIP/test.php
LINK
LINK
JOB,
Try to put full path in the command line. i.e:
/usr/nagios/libexec/check_http …..
Diramos
LINK
The -S option is not working with 2.0 plugins. It says -S is for version. How can I get it to work
with https with Nagios4 and plugins 2.x?
LINK
LINK
Home | Linux 101 Hacks – Table of Contents | Contact | Email | RSS | Copyright © 2009–2017 Ramesh Natarajan All rights
reserved | Terms of Service