check_http
check_http
Hi All
We are using Nagios Core 4.0.8
And we are using Check_by method instead of NRPE.
We are trying to monitor json in our web server.
when we run below command it gives specific output.
curl https://api.dev.google.com/versions.json --proxy proxyserver.com:8080 -o /dev/null;echo $?
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1107 100 1107 0 0 3097 0 --:--:-- --:--:-- --:--:-- 3395
0
And when we try to run From nagios it gives error. Like socket timed out and Name or service not known
HTTP CRITICAL - Unable to open TCP socket.
And command.cfg
# 'check_http' command definition
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
define command{
command_name check_http_content_hh
command_line $USER1$/check_http -H $HOSTADDRESS$ -w 5 -c 10 --ssl -u $ARG1$ -s $ARG2$
}
# 'check_http_content_proxy' command definition
define command{
command_name check_http_content_proxy
command_line $USER1$/check_http -I $ARG1$ -P $ARG2$ -H $HOSTADDRESS$ -w 5 -c 10 --ssl -u $ARG3$ -s $ARG4$
}
and have defined service as
define service{
use generic-service
host_name above-property-stg
service_description https
check_command check_http! -H api.dev.google.com -u /versions.json -S -w 10 -c 20
}
This command gives socket timed out after 10 seconds error.
define service{
use generic-service
host_name above-property-stg
service_description https
check_command check_http_content_proxy! -I proxyserver.com -p 8080 -H api.dev.google.com -u /versions.json -S -w 10 -c 20
}
And this command gives Name or service not known
HTTP CRITICAL - Unable to open TCP socket.
So how can i monitor if there is any issue with command line, please let me know.
Thank you Everyone.
We are using Nagios Core 4.0.8
And we are using Check_by method instead of NRPE.
We are trying to monitor json in our web server.
when we run below command it gives specific output.
curl https://api.dev.google.com/versions.json --proxy proxyserver.com:8080 -o /dev/null;echo $?
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1107 100 1107 0 0 3097 0 --:--:-- --:--:-- --:--:-- 3395
0
And when we try to run From nagios it gives error. Like socket timed out and Name or service not known
HTTP CRITICAL - Unable to open TCP socket.
And command.cfg
# 'check_http' command definition
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
define command{
command_name check_http_content_hh
command_line $USER1$/check_http -H $HOSTADDRESS$ -w 5 -c 10 --ssl -u $ARG1$ -s $ARG2$
}
# 'check_http_content_proxy' command definition
define command{
command_name check_http_content_proxy
command_line $USER1$/check_http -I $ARG1$ -P $ARG2$ -H $HOSTADDRESS$ -w 5 -c 10 --ssl -u $ARG3$ -s $ARG4$
}
and have defined service as
define service{
use generic-service
host_name above-property-stg
service_description https
check_command check_http! -H api.dev.google.com -u /versions.json -S -w 10 -c 20
}
This command gives socket timed out after 10 seconds error.
define service{
use generic-service
host_name above-property-stg
service_description https
check_command check_http_content_proxy! -I proxyserver.com -p 8080 -H api.dev.google.com -u /versions.json -S -w 10 -c 20
}
And this command gives Name or service not known
HTTP CRITICAL - Unable to open TCP socket.
So how can i monitor if there is any issue with command line, please let me know.
Thank you Everyone.
Re: check_http
Your service definition contains parameters that are already being passed the the command -
Your check_command is not using ! to differentiate the $ARG$ values, so all of this is still going to classify as $ARG1$.
Looking at the command_line, it's -
You'll need to adjust this accordingly, one suggestion would be -
which would let you pass everything in the check_command as you're doing now.
Code: Select all
define service{
use generic-service
host_name above-property-stg
service_description https
check_command check_http_content_proxy! -I proxyserver.com -p 8080 -H api.dev.google.com -u /versions.json -S -w 10 -c 20
Looking at the command_line, it's -
Code: Select all
command_name check_http_content_proxy
command_line $USER1$/check_http -I $ARG1$ -P $ARG2$ -H $HOSTADDRESS$ -w 5 -c 10 --ssl -u $ARG3$ -s $ARG4$
Code: Select all
command_name check_http_content_proxy
command_line $USER1$/check_http $ARG1$
Former Nagios Employee
Re: check_http
I tried and made changes
changed command line to
defined service as
define command{
command_name check_http_content_proxy1
command_line $USER1$/check_http $ARG1$
}
define service{
use generic-service
host_name above-property-stg
service_description https
check_command check_http_content_proxy1! -I proxyserver.com -p 8080 -H api.dev.google.com -u /versions.json -S -w 10 -c 20
}
But now it gives error CRITICAL - Cannot make SSL connection.
changed command line to
defined service as
define command{
command_name check_http_content_proxy1
command_line $USER1$/check_http $ARG1$
}
define service{
use generic-service
host_name above-property-stg
service_description https
check_command check_http_content_proxy1! -I proxyserver.com -p 8080 -H api.dev.google.com -u /versions.json -S -w 10 -c 20
}
But now it gives error CRITICAL - Cannot make SSL connection.
Re: check_http
It gives socket timed out after 21 seconds.
Re: check_http
Please SSH into your Nagios server and test from the command line (using this exact command):
Pleaseend us the entire output.
Thank you
Code: Select all
/usr/local/nagios/libexec/check_http -I proxyserver.com -p 8080 -u https://api.dev.google.com/versions.json -S -H api.dev.google.com -vvvThank you
Re: check_http
It gives that it cannot make ssl connection.
Re: check_http
Please post the entire output, as @ssax mentioned. The -vvv will provide us with verbosity on what's going on with your headers, so we can actually have something to work with.Bryan wrote:It gives that it cannot make ssl connection.
Former Nagios Employee
Re: check_http
bash-4.1$ /usr/local/nagios/libexec/check_http -I proxyserver.com -p 8080 -u https://api.dev.google.com/versions.json -S -H api.dev.google.com -vvv
CRITICAL - Cannot make SSL connection.
This is what output was @rkennedy and @ssax. It just showed me that much details.
CRITICAL - Cannot make SSL connection.
This is what output was @rkennedy and @ssax. It just showed me that much details.
Re: check_http
Perhaps others will have different troubleshooting steps to suggest, but I'm curious what a tcpdump conducted on the Proxy server, while reproducing, will show us.
If you have access to the proxy server's CLI run this command, then reproduce the issue:
tcpdump -s 0 -i any host <Nagios XI server IP address> -w capture.pcap
(Ctl+C to stop capture)
Post the capture file here, but if it contains sensitive data PM it to me.
***get a capture of the successful curl example, this way we can compare working vs non-working --- if you can do this quickly within the same tcpdump, great. If not then two pcaps will suffice: 1 curl, 1 Nagios check. Please title them accordingly***
If you have access to the proxy server's CLI run this command, then reproduce the issue:
tcpdump -s 0 -i any host <Nagios XI server IP address> -w capture.pcap
(Ctl+C to stop capture)
Post the capture file here, but if it contains sensitive data PM it to me.
***get a capture of the successful curl example, this way we can compare working vs non-working --- if you can do this quickly within the same tcpdump, great. If not then two pcaps will suffice: 1 curl, 1 Nagios check. Please title them accordingly***
Be sure to check out the Knowledgebase for helpful articles and solutions!