check_http from localhost.conf gives false positives.

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
badassmexican
Posts: 1
Joined: Mon Jun 20, 2016 8:22 pm

check_http from localhost.conf gives false positives.

Post by badassmexican »

Hi,

I'm trying to check URL's for a few sites. Some I control the servers and others are hosted so I can't put the client on them.

When I define a check_http service in my localhost.cfg it never shows that the URL isn't reachable even when I turn off the server. But if I add it to my windows.cfg file it works fine. Has anyone experienced this?

Also, for machines I can't install the client on and I just want to monitor the URL, should I still make a cfg file for them or can I just add the URL to an existing one? How do you handle monitoring URLs?

Thanks.

J
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_http from localhost.conf gives false positives.

Post by rkennedy »

When I define a check_http service in my localhost.cfg it never shows that the URL isn't reachable even when I turn off the server. But if I add it to my windows.cfg file it works fine. Has anyone experienced this?
Is the service for your localhost machine? If so, when you turn it off then the machine of Nagios is also going off as well so it can't continue to monitor.
Also, for machines I can't install the client on and I just want to monitor the URL, should I still make a cfg file for them or can I just add the URL to an existing one?
Yes, usually people create a config for a host, and then another config for the services under that specific host. Others use one config per host / service -- it's really up to you. The important thing to Nagios, is that you have all of your configuration files linked to nagios.cfg. You can do this using the cfg_dir= variable like so -

Code: Select all

cfg_dir=/usr/local/nagios/etc/static
How do you handle monitoring URLs?
You can do so like this -

Code: Select all

[nagios@localhost libexec]$ ./check_http -H google.com
HTTP OK: HTTP/1.1 301 Moved Permanently - 559 bytes in 0.091 second response time |time=0.091321s;;;0.000000 size=559B;;;0
Which, for a service definition would look like this -

Code: Select all

define host {
        use                             linux-server
        host_name                       google
        alias                           Google.com monitoring
        address                         google.com
        max_check_attempts              5
        check_period                    24x7
        notification_interval           30
        notification_period             24x7
}

define service {
        use                             generic-service
        host_name                       google
        service_description             HTTP
        check_command                   check_http!-H google.com
}
Former Nagios Employee
Locked