check_https: connection refused by host
-
- Posts: 29
- Joined: Wed Sep 27, 2017 11:27 am
check_https: connection refused by host
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.
-
- Posts: 29
- Joined: Wed Sep 27, 2017 11:27 am
Re: check_https: connection refused by host
Internally it is open over port 80, but externally you should be redirected to HTTPS. I'm not sure if that answers your question.
Re: check_https: connection refused by host
Change the command definition to:
Code: Select all
# 'check_https' command definition
define command{
command_name check_https
command_line $USER1$/check_https -H $HOSTADDRESS$
}
-
- Posts: 29
- Joined: Wed Sep 27, 2017 11:27 am
Re: check_https: connection refused by host
Connection still refused by host. should I pm you the url?
Re: check_https: connection refused by host
Yes please that will be very helpful to troubleshoot your issue
Re: check_https: connection refused by host
Sorry about that i got it and working on it.
Re: check_https: connection refused by host
Please remove the from check_https so that means your command definition should be:
That should work well. I tested its on my server and it worked.
Let me PM the output from the command when i ran it with your host name.
Also go to your command line and run to test
Aslo run -S is if you have ssl enabled.
Let me know what you get.
Code: Select all
s
Code: Select all
# 'check_https' command definition
define command{
command_name check_https
command_line $USER1$/check_http -H $HOSTADDRESS$
}
Let me PM the output from the command when i ran it with your host name.
Also go to your command line and run
Code: Select all
/usr/local/nagios/libexec/check_http -H <your address>
Aslo run
Code: Select all
/usr/local/nagios/libexec/check_http -H <your address> -S
Let me know what you get.
-
- Posts: 29
- Joined: Wed Sep 27, 2017 11:27 am
Re: check_https: connection refused by host
This is what I am receiving
check_http: Invalid option - SSL is not available
check_http: Invalid option - SSL is not available
Re: check_https: connection refused by host
Hi @ nickanderson82,
What linux distribution are you using,centos or ubuntu?
It seems you don't have SSL installed and enabled? Do you?
Can you please also post how you defined your service because its supposed to be:
Some information about configuring SSL on core..https://support.nagios.com/kb/article/n ... l-tls.html
What linux distribution are you using,centos or ubuntu?
It seems you don't have SSL installed and enabled? Do you?
Can you please also post how you defined your service because its supposed to be:
Code: Select all
define service{
use generic-service ; Name of service template to use
host_name xxx.xxx.com
service_description HTTPS
check_command check_http
notifications_enabled 0
}