Page 1 of 1

Service Inheritance and Service Groups

Posted: Wed Mar 20, 2019 10:43 am
by NCATmax
Red Hat Enterprise Linux 7.6
64 bit
Manual installation
We are using SSL on the web interface. The databases are also run on a separate server.


I have been considering the best way to organize hosts and services within Nagios. I will give an actual example to show the issue I have experienced.

We have an application that has servers in two datacenters. I have realized that it makes sense to group hosts and services by datacenter, because A) there are sometimes datacenter-specific differences, and B) Issues sometimes affect everything in one datacenter.

One successful example is performing DNS checks. The DNS servers at each datacenter are different. So for each server, I created DNS a service that queries the datacenter's DNS server, for the relevant domain names. The important part is that there are individual services created for the host.

I am easily able to put those individually-created services into Service Groups. And this achieves my goal of being able to see "all DNS checks for datacenter A".

However, I typically use inheritance to assign services to host groups. For example, to assign "hardware checks" such as CPU usage, RAM usage, disk usage, etc., I will create a Host Group, and assign hosts to the Host Group. (I do this on the Host Group page.) Then I will create the service and assign the service to the Host Group.

This allows me to create a new host, assign it a host template, and have the host automatically receive certain services. The issue I'm having occurs when I want to make Service Groups out of these inherited services. The inherited services are not available in the listed services. I suspect this is because the inherited services are not defined in their own service configuration files, so there is no way to know how many inherited services actually exist (and what they are).

Some questions;
  • Is there any way that I can group these inherited services?
  • Is my use of inheritance reasonable? Can it be improved?
  • Should I be approaching this or handling this in a different manner?
I am at the point where I feel comfortable setting things up in Nagios, but I want to aim to be as optimal as possible. The goal being keeping everything organized, and minimizing administrative effort. Especially considering new hosts and services are frequently added, I would like new things to fit right into the existing "structure". I want to make sure the "Nagios structure" makes sense.


Thank you, your time is greatly appreciated.

Re: Service Inheritance and Service Groups

Posted: Wed Mar 20, 2019 1:20 pm
by benjaminsmith
Hi @NCATmax,

So it looks like you would like to be able to create templates, organize them into groups and then apply those template grouping to hosts or services.

Organizing your network by geography or other logical groupings and using templates to simply configuration is a best practice. However, you'll want to layer your templates instead of using host or service groupings. In Nagios, a host is really anything with an IP address, and services are linked to hosts, and template files do not define hosts or services.

So for example, your data center A and B may share the same templates except for one template with data specific differences. When assigning templates, you also have the option of assigning an order of preference.

You'll find a detailed explanation of templates and template inheritance on the Nagios Core documentation. These same concepts apply to Nagios XI.

Object Inheritance With Templates
https://assets.nagios.com/downloads/nag ... tance.html

Let me know if you have further questions.