Table of Contents

Name

check_remote_by_http - nagios plugin for getting remote values by http

Synopsis

check_remote_by_http [ -D ] [ -L ] [ -A(0|1|2|3|4) ] -w warnlevel -c critlevel -H ip-address -p port [ -t timeout ] [ -T(O|W|C) ] [ -u unit ] key

Description

check_remote_by_http is a nagios plugin for remote checking hosts by (simplified) http. It was written as a (fast) alternative to net-snmp and it is designed to work with knoerre, a small http-server.
check_remote_by_http sends according to the given key a HTTP request to the remote server. Then it expects a value as a result of the remote check. It takes the value from the last line of the remote HTTP response. The value will be interpreted as a positive integer with up to 63 bits.
If the remote value is greater than the specified warning or critical level then check_remote_by_http will also recognize the line before and print it contents as additional data. This additional or debug information is printed between the remote value and the performance data. Its output can be formatted as HTML-data with the original URL sent to the remote host as link. See examples.
key is a string sent as http GET request to the remote server and depends on the type of the remote http server. If i.e. the key load1 is specified then the following request is sent:

GET /load1 HTTP/1.0

If you use i.e. knoerre as remote http server then you will get a http response with the current load-per-1-minute as remote check value in the last line and the complete output of /proc/loadavg in the line before.

Options

-w warnlevel
Specify the warning level. The remote value must be greater than the warnlevel to trigger.

-c critlevel
Specify the critical level. The remote value must be greater than the critlevel to trigger.

-H ip-address
Specify the IP address of the remote server to check.

-p port
Specify the port of the http server on the remote host.

-u unit
Specify an optional unit string which is placed after the remote value and which is visible in nagios.

-t timeout
The plugins internal timeout in seconds (default: 10).

-TO
On timeout return OK instead of UNKNOWN.

-TW
On timeout return WARNING instead of UNKNOWN.

-TC
On timeout return CRITICAL instead of UNKNOWN.

-L
Show additional data as link.

-A(0|1|2|3|4)
Specify the level of the remote value which must be reached to print the additional data. "-A0" causes printing if state is "OK" and "-A4" will disable printing. "-A1" is currently the default setting.

-D
Use TCP_DEFER_ACCEPT (see tcp(7) ). This can speed up our http-communication by approx. 10 percent, but it breaks tcp-communication by RFC - like many others too. It can also cause trouble with loadbalancers like F5 which send "early" ACK packets to the server before ACK from client.

Return Value

According to the Nagios Plugin API the Return Code is 0 for state "OK", 1 for "WARNING", 2 for "CRITICAL" and 3 for "UNKNOWN".

Files

check_remote_by_http does not use any files, a sample nagios config is shown here:

# cat /etc/nagios/msc.cfg
define service{
use service-1min

name load1

check_command check_remote_generic!8!20!load1

register 0

}
# cat /etc/nagios/remote-generic.cfg
define command{
command_name check_remote_generic

command_line $USER1$/check_remote_by_http -w $ARG1$ -c $ARG2$ -H $HOSTADDRESS$ -p 8888 $ARG3$

}

See Also

check_remote_by_http(1) , knoerre(1)

http://downloads.tuxad.de/nagios-fwb

Examples

Some examples of check_remote_by_http with knoerre as remote http server:

$ check_remote_by_http -w 100000 -c 180000 -H 192.168.1.1 -u " direntries" -p 8888 maxdirentries/2/home/www/@/html/typo3temp
REMOTE OK - 15621 direntries | maxdirentries/2/home/www/@/html/typo3temp=15621direntries;100000;180000

$ check_remote_by_http -w 25 -c 35 -H 192.168.1.1 -p 8888 dirlevels/home/www/@/html
REMOTE OK - 14 | dirlevels/home/www/@/html=14;25;35

$ check_remote_by_http -w 5000 -c 8000 -H 192.168.1.1 -u " KB" -p 8888 filesizesbysuffix/.gif/2/home/www/@/html/typo3temp
REMOTE OK - 262 KB | filesizesbysuffix/.gif/2/home/www/@/html/typo3temp=262KB;5000;8000

$ check_remote_by_http -w 5000 -c 8000 -H 192.168.1.1 -u " KB" -p 8888 filesizesbysuffix/.jpg/2/home/www/@/html/typo3temp
REMOTE OK - 1826 KB | filesizesbysuffix/.jpg/2/home/www/@/html/typo3temp=1826KB;5000;8000

$ check_remote_by_http -w 600000 -c 1800000 -H 192.168.1.1 -u " KB" -p 8888 filesizes/home/www/@/logs/access.log
REMOTE OK - 19081 KB | filesizes/home/www/@/logs/access.log=19081KB;600000;1800000

$ check_remote_by_http -L -w 400 -c 1200 -H 192.168.1.1 -p 8888 -u " MB used" swap
REMOTE WARNING - 1108 MB used (<a href="http://192.168.1.1:8888/swap " >memtotal:2000 swaptotal:1999</a>) | swap=1108MB;400;1200

Author

Frank Bergmann, http://www.tuxad.com


Table of Contents