check_http It seems easy but ...

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
User avatar
nlabardi
Posts: 8
Joined: Fri Dec 14, 2018 8:50 am

check_http It seems easy but ...

Post 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$
}
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: check_http It seems easy but ...

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: check_http It seems easy but ...

Post 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.
Former Nagios employee
https://www.mcapra.com/
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: check_http It seems easy but ...

Post by lmiltchev »

@nlabardi, let us know if @benjaminsmith and @mcapra answered your question.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
nlabardi
Posts: 8
Joined: Fri Dec 14, 2018 8:50 am

Re: check_http It seems easy but ...

Post 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)
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: check_http It seems easy but ...

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
nlabardi
Posts: 8
Joined: Fri Dec 14, 2018 8:50 am

Re: check_http It seems easy but ...

Post by nlabardi »

Bingo!


it's work fine !


thank you and merry new year
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: check_http It seems easy but ...

Post by npolovenko »

@nlabardi, Happy new year!
Closing the thread as resolved.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked