Random Project

A Built-in Alternative Solution

I did try your script but it was little bit unstable.

Suddenly I have checked the check_http which is already there in the /nagios/libexec/check_http

check_http -S www.sitename.or.ip -w seconds -c seconds

-S Connect via SSL. Port defaults to 443.
-w Response time to result in warning status (seconds)
-c Response time to result in critical status (seconds)

you can add –ssl=1.2 for TLS1.2 (read help)

for example:

/usr/local//nagios/libexec/./check_http -S www.google.com -w 2 -c 5

or

/usr/local//nagios/libexec/./check_http –ssl=1.2 www.google.com -w 2 -c 5

Next

Define The Command Inside commands.cfg

define command {

command_name check_https
command_line $USER1$/check_http -S $ARG1$ -w $ARG2$ -c $ARG3$
}

Define Service

define service {

use local-service ; Name of service template to use
host_name LOCALHOST
service_description HTTPS
check_command check_https!localhost!0.500!0.900
notifications_enabled 1
}

-w -c 0.0 accept millisecond

It’s handy when you check multiple internet links either the links is up or down, sites functions, port status.