5

I am having a hard time trying to get my head around some of the more basic concepts of Nagios that I thought would be straight forward.

Basically, as well as the standard local infrastructure, I need to monitor a bunch of 3rd party web services, all of which I have web addresses for.

I simply can't decide how this should be organised. Each one requires me to create a new service which I understand, but after this...

Should I create a single host called "3rd party" along with 3 services that are linked to it, or should I create 3 new hosts with the name of the site, the 3 services and link them one to one?

My preference is to single hosts for each service as each service is independent of each other and I believe that is the way Nagios should be setup.

Along with this, these servers are not reachable by ping. By default, it reports as down. I have tried to disable the check_command check-host-alive, but, this just appears to make the host stay grey...

...Is there anyway I can make the host stay green if the only service is green and/or if I change the check_command to the service as above, will this do two checks to the web service, or even, is having the check_command on its own enough and I don't need to assign the service?

So, the real questions are...

  1. Should I be using one host per independent service as these are officially different "hosts"?
  2. When a host is only a single service and not reachable by ping, what are the best practices as above?
  3. (sort of extra) For organising Nagios, what is the best way to group these hosts? Is this what dependencies are for?
William Hilsum
  • 3,536
  • 6
  • 29
  • 39

1 Answers1

5

I think the answer to your question is not definitive, but will reveal itself over time as you develop a deeper understanding of how Nagios works. Services are generally tied directly to the host they run on, but as you are discovering, that is just a convention. A convention that works and provides some shortcuts, mind you, but a convention, nonetheless.

Also know that that you can define any check as the host check. It does not need to be ping. Perhaps check_http is better for your use.
See the image and host definition I use to check internet connectivity

define host{
use         generic-host,host-pnp       ; Name of host template to use
host_name       www.microsoft.com
alias           www.microsoft.com
address         www.microsoft.com
check_command       check_http
.
.
.
}

Given what you've said, I would create a dummy service with a bunch of you third party services tied to it for now and adjust it as you see fit.

To address your 3rd question, if you go the route of a host per service, you could use a host or service group to group them for display.

uSlackr
  • 6,412
  • 21
  • 37
  • Thank you for this... I just want to confirm, it is perfectly fine/valid to have a host with the command and no services attached to a host? ... In addition, can I have a host without any check commands at all, just so I can have a name for parent objects to drawn out the map? – William Hilsum Jul 01 '12 at 22:39
  • Let me add to this... For example, I have been looking at a few publically accessible Nagios Server such as this - http://www.0i3.com:1777/nagios/?fromugsite=true and taking 8.8.8.8 Google DNS as an example, it is listed both as the host command and as the service - I can see it is doing two checks at two different times... I just don't understand if this is correct behaviour or not. – William Hilsum Jul 01 '12 at 22:51
  • FWIW where you can't ping a remote webserver, then you might setup the host check_command as testing port 80 open, but have a service checking the content of the response to an http request. – symcbean Jul 02 '12 at 08:37
  • Nagios has few rules in this area. As I said in my answer, as you grow to better understand it, you'll get this and possibly change you approach. On your example you should see that the dns check for the host definition isn't enables (active checks enabled - no) and the check interval is 0 so the check isn't doing anything. But the alternative is to have the host check_command be active and do exactly what you want with no services defined. – uSlackr Jul 03 '12 at 01:53
  • I almost feel silly asking this, but, if active checks is set to no, what is the point of having it as a host_check? :/ ... I am marking this as answer and will just do a lot more experimenting myself. – William Hilsum Jul 03 '12 at 10:12
  • That was illustrative of the point that you could have a host check that doesn't really do anything. IN your google dns example, that is how the demo site is configured. I wasn't recommending that alternative. – uSlackr Jul 03 '12 at 11:01