check_https: connection refused by host
Posted: Wed Oct 11, 2017 1:36 pm
Created config file for the url:
define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name xxx.xxx.com
alias xxx.xxx.com
address xxx.xxx.com
}
###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################
# Define a service to "ping" the local machine
define service{
use generic-service ; Name of service template to use
host_name xxx.xxx.com
service_description PING
check_command check_ping!100.0,20%!500.0,60% -4
}
# Define a service to check HTTPS on the local machine.
# Disable notifications for this service by default, as not all users may have HTTPS enabled.
define service{
use generic-service ; Name of service template to use
host_name xxx.xxx.com
service_description HTTPS
check_command check_https
notifications_enabled 0
}
--------------------------
command.cfg edited to
# 'check_https' command definition
define command{
command_name check_https
command_line $USER1$/check_https -H $HOSTADDRESS$ -S -e HTTP $ARG1$
}
-----------------------
check_https plugin
#!/bin/bash
wget='/usr/bin/wget --no-check-certificate --output-document=/tmp/tmp_html -S'
add_uri='https://'
end_uri='/'
PORT=''
if [ $# -gt 1 ]
then
PORT=:$2
fi
if ($wget $add_uri$1$PORT$end_uri$3 2> /tmp/tmp_rep) then
cat /tmp/tmp_rep | grep "HTTP/1"
rm /tmp/tmp_rep
rm /tmp/tmp_html
exit 0
else
cat /tmp/tmp_rep | grep "HTTP/1" || echo 'Connection refused by host'
rm /tmp/tmp_rep
rm /tmp/tmp_html
exit 2
fi;
---------------------------------
What would cause the Connection refused by host? Do I have the wrong command line? I just want the check_https to work. The only thing that worked was ping.
define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name xxx.xxx.com
alias xxx.xxx.com
address xxx.xxx.com
}
###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################
# Define a service to "ping" the local machine
define service{
use generic-service ; Name of service template to use
host_name xxx.xxx.com
service_description PING
check_command check_ping!100.0,20%!500.0,60% -4
}
# Define a service to check HTTPS on the local machine.
# Disable notifications for this service by default, as not all users may have HTTPS enabled.
define service{
use generic-service ; Name of service template to use
host_name xxx.xxx.com
service_description HTTPS
check_command check_https
notifications_enabled 0
}
--------------------------
command.cfg edited to
# 'check_https' command definition
define command{
command_name check_https
command_line $USER1$/check_https -H $HOSTADDRESS$ -S -e HTTP $ARG1$
}
-----------------------
check_https plugin
#!/bin/bash
wget='/usr/bin/wget --no-check-certificate --output-document=/tmp/tmp_html -S'
add_uri='https://'
end_uri='/'
PORT=''
if [ $# -gt 1 ]
then
PORT=:$2
fi
if ($wget $add_uri$1$PORT$end_uri$3 2> /tmp/tmp_rep) then
cat /tmp/tmp_rep | grep "HTTP/1"
rm /tmp/tmp_rep
rm /tmp/tmp_html
exit 0
else
cat /tmp/tmp_rep | grep "HTTP/1" || echo 'Connection refused by host'
rm /tmp/tmp_rep
rm /tmp/tmp_html
exit 2
fi;
---------------------------------
What would cause the Connection refused by host? Do I have the wrong command line? I just want the check_https to work. The only thing that worked was ping.