check_http H hostname (or) -I ip-address {optional options}
常用的几个例子
1. 检测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 size=332B;;;0
2.检测https协议
$ 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 size=332B;;;0
如果服务器只运行http协议没有运行https协议,那么检测https协议时会报错“HTTP CRITICAL – Unable to open TCP socket”
$ check_http -H 192.168.1.50 -S
Connection refused
HTTP CRITICAL - Unable to open TCP socket
3.检测http不同的端口
$ check_http -H 192.168.1.50 -p 8080
HTTP OK HTTP/1.1 200 OK - 332 bytes in 0.004 seconds |time=0.004144s;;;0.000000 size=332B;;;0
4.检测https不同的端口
$ check_http -H 192.168.1.50 -S -p 8443
HTTP OK HTTP/1.1 200 OK - 332 bytes in 0.004 seconds |time=0.004144s;;;0.000000 size=332B;;;0
5.检测特定网址
$ check_http -H 101hacks.com -u http://linux.101hacks.com/toc
6.检测SSL证书是否到期
$ check_http -H 101hacks.com -C 365
WARNING - Certificate expires in 300 day(s) (01/01/2011 10:10).警告在300天内到期