Page 1 of 1
check_http It seems easy but ...
Posted: Mon Dec 24, 2018 5:54 am
by nlabardi
merry xmas !!
I've to check an https site
https check
./check_http -H
www.mysite.it -f follow -S
HTTP OK: HTTP/1.1 200 OK - 183891 bytes in 0,079 second response time |time=0,078572s;;;0,000000 size=183891B;;;0
in Nagios check...
define service{
use generic-service ; Name of service template to use
host_name
www.mysite.it
service_description Https
check_command check_http!-f follow -S
}
the replay is..
HTTP WARNING: HTTP/1.1 404 Not Found - 492 bytes in 0,020 second response time
the commandi is...
# 'check_http' command definition
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
Re: check_http It seems easy but ...
Posted: Wed Dec 26, 2018 11:09 am
by benjaminsmith
Hello
@nlabardi,
Thank you. Happy Holidays!
Since you are passing the hostname, please try changing the -I to -H in the check command definition:
Code: Select all
define command {
command_name check_http
command_line $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
}
Let me know if that resolve the issue.
Re: check_http It seems easy but ...
Posted: Wed Dec 26, 2018 2:12 pm
by mcapra
It might also be worthwhile to review the parent host definition (for
www.mysite.it) and make sure
address and
host_name are the same, in this case.
Re: check_http It seems easy but ...
Posted: Wed Dec 26, 2018 5:37 pm
by lmiltchev
@nlabardi, let us know if @benjaminsmith and @mcapra answered your question.
Re: check_http It seems easy but ...
Posted: Thu Dec 27, 2018 3:46 am
by nlabardi
so..
I've fixed the command in ...
command_line $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
the host name and ip address are consistent with how they should be
define host{
use cloud-server ; Inherit default values from a template
host_name
http://www.mysite.it ; The name we're giving to this host
alias mysite.it SITO ; A longer name associated with the host
address xxx.yyy.xxx.yyy ; IP address of the host
}
ping
http://www.mysite.it
replay from xxx.yyy.xxx.yyy
ping mysite.it
replay from xxx.yyy.xxx.yyy
am I ignoring something?
(I use -f follow)
Re: check_http It seems easy but ...
Posted: Thu Dec 27, 2018 1:05 pm
by npolovenko
@nlabardi, Please change $HOSTADDRESS$ to $HOSTNAME$ in your command.
command_line $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
OR change the address to
http://www.mysite.it in the host definition:
define host{
use cloud-server ; Inherit default values from a template
host_name
http://www.mysite.it ; The name we're giving to this host
alias mysite.it SITO ; A longer name associated with the host
address
http://www.mysite.it
Re: check_http It seems easy but ...
Posted: Fri Dec 28, 2018 2:51 am
by nlabardi
Bingo!
it's work fine !
thank you and merry new year
Re: check_http It seems easy but ...
Posted: Fri Dec 28, 2018 12:21 pm
by npolovenko
@nlabardi, Happy new year!
Closing the thread as resolved.