Hello,
I am using check_http for external nodes that I have no access to other than through port 80. Nagios shows the host status as down, even though the http service (page) is coming back ok. Is there a way to tell nagios that the host status should be up if the service is up, or get rid of the host displaying as down? I have no way to determine the host status since it isn't my server.
Regards,
Randy.
Don't want Host Check
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Don't want Host Check
What is the status information for the check? What is it telling you in text is wrong. If you have access to a SSH terminal on the Nagios Server could you also run the following:
And let me know what it outputs.
Code: Select all
/usr/local/nagios/libexec/check_http -H www.nagios.comRe: Don't want Host Check
I made a mistake on this post. I meant to post for the plugin check_curl_http, not check_http.
The command line works fine in Linux: php check_curl_http.php -U https://node1.test.com and it results in:
Page OK: HTTP Status Code 200 - 689 bytes in 0.180142 seconds |time=0.18 size=689
The service status comes back as this:
Current Status: OK
(for 0d 2h 54m 29s)
Status Information: Usage: php [options] [-f] <file> [--] [args...]
php [options] -r <code> [--] [args...]
php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
php [options] -- [args...]
php [options] -a
-a Run as interactive shell
-c <path>
Performance Data: <file> Look for php.ini file in this directory -n No php.ini file will be used -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler -f <file> Parse and execute <file>. -h This help -i PHP information -l Syntax check only (lint) -m Show compiled in modules -r <code> Run PHP <code> without using script tags <?..?> -B <begin_code> Run PHP <begin_code> before processing input lines -R <code> Run PHP <code> for every input line -F <file> Parse and execute <file> for every input line -E <end_code> Run PHP <end_code> after processing all input lines -H Hide any passed arguments from external tools. -S <addr>:<port> Run with built-in web server. -t <docroot> Specify document root <docroot> for built-in web server. -s Output HTML syntax highlighted source. -v Version number -w Output source with stripped comments and whitespace. -z <file> Load Zend extension <file>. args... Arguments passed to script. Use -- args when first argument starts with - or script is read from stdin --ini Show configuration file names --rf <name> Show information about function <name>. --rc <name> Show information about class <name>. --re <name> Show information about extension <name>. --rz <name> Show information about Zend extension <name>. --ri <name> Show configuration for extension <name>.
Current Attempt: 1/3 (HARD state)
Last Check Time: 11-28-2012 13:32:38
Check Type: ACTIVE
Check Latency / Duration: 0.057 / 0.005 seconds
Next Scheduled Check: 11-28-2012 13:42:38
Last State Change: 11-28-2012 10:43:07
Last Notification: N/A (notification 0)
Is This Service Flapping? NO
(3.75% state change)
In Scheduled Downtime? NO
Last Update: 11-28-2012 13:37:33 ( 0d 0h 0m 3s ago)
Here are my definitions:
Externalnodes.cfg
define host{
use windows-server ; Inherit default values from a template
host_name sbrdsgw8 ; The name we're giving to this host
hostgroups external-servers
alias Remote Access Page ; A longer name associated with the host
address sbrdsgw8.eil-infra.com ; IP address of the host
}
define service{
use generic-service
host_name sbrdsgw8
service_description http monitor
servicegroups statservices,websites
check_command check_curl_http!https://node1.test.com
}
commands.cfg
define command{
command_name check_curl_http
command_line $USER1$/check_curl_http.php -U $ARG1$ $ARG2$
}
The command line works fine in Linux: php check_curl_http.php -U https://node1.test.com and it results in:
Page OK: HTTP Status Code 200 - 689 bytes in 0.180142 seconds |time=0.18 size=689
The service status comes back as this:
Current Status: OK
(for 0d 2h 54m 29s)
Status Information: Usage: php [options] [-f] <file> [--] [args...]
php [options] -r <code> [--] [args...]
php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
php [options] -- [args...]
php [options] -a
-a Run as interactive shell
-c <path>
Performance Data: <file> Look for php.ini file in this directory -n No php.ini file will be used -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler -f <file> Parse and execute <file>. -h This help -i PHP information -l Syntax check only (lint) -m Show compiled in modules -r <code> Run PHP <code> without using script tags <?..?> -B <begin_code> Run PHP <begin_code> before processing input lines -R <code> Run PHP <code> for every input line -F <file> Parse and execute <file> for every input line -E <end_code> Run PHP <end_code> after processing all input lines -H Hide any passed arguments from external tools. -S <addr>:<port> Run with built-in web server. -t <docroot> Specify document root <docroot> for built-in web server. -s Output HTML syntax highlighted source. -v Version number -w Output source with stripped comments and whitespace. -z <file> Load Zend extension <file>. args... Arguments passed to script. Use -- args when first argument starts with - or script is read from stdin --ini Show configuration file names --rf <name> Show information about function <name>. --rc <name> Show information about class <name>. --re <name> Show information about extension <name>. --rz <name> Show information about Zend extension <name>. --ri <name> Show configuration for extension <name>.
Current Attempt: 1/3 (HARD state)
Last Check Time: 11-28-2012 13:32:38
Check Type: ACTIVE
Check Latency / Duration: 0.057 / 0.005 seconds
Next Scheduled Check: 11-28-2012 13:42:38
Last State Change: 11-28-2012 10:43:07
Last Notification: N/A (notification 0)
Is This Service Flapping? NO
(3.75% state change)
In Scheduled Downtime? NO
Last Update: 11-28-2012 13:37:33 ( 0d 0h 0m 3s ago)
Here are my definitions:
Externalnodes.cfg
define host{
use windows-server ; Inherit default values from a template
host_name sbrdsgw8 ; The name we're giving to this host
hostgroups external-servers
alias Remote Access Page ; A longer name associated with the host
address sbrdsgw8.eil-infra.com ; IP address of the host
}
define service{
use generic-service
host_name sbrdsgw8
service_description http monitor
servicegroups statservices,websites
check_command check_curl_http!https://node1.test.com
}
commands.cfg
define command{
command_name check_curl_http
command_line $USER1$/check_curl_http.php -U $ARG1$ $ARG2$
}
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Don't want Host Check
Odd, your definitions look fine, and you get the information returned fine from your SSH terminal, have you tried restarting nagios and then forcing the check from the UI?
Re: Don't want Host Check
I just made a change. In the commands.cfg I added php to the front of the command. It now reads:
define command{
command_name check_curl_http
command_line php $USER1$/check_curl_http.php -U $ARG1$ $ARG2$
}
The service now comes back with the correct error code 200 ok status within Nagios, and it shows the service up. The node check is still showing as down. Does the node check rely on an ICMP ping? If so, these nodes are not pingable.
define command{
command_name check_curl_http
command_line php $USER1$/check_curl_http.php -U $ARG1$ $ARG2$
}
The service now comes back with the correct error code 200 ok status within Nagios, and it shows the service up. The node check is still showing as down. Does the node check rely on an ICMP ping? If so, these nodes are not pingable.