First Steps Hostgroup Inheritance
Nagios Hostgroup Inheritance Series — Part 2: First Steps Hostgroup Inheritance
Introduction
In the first article in this series, I introduced the concept of hostgroup inheritance and (hopefully) laid it out in a way that it can be well understood. In this article, I’m going to start walking you through setting up a solid hostgroup inheritance foundation.
By the end of this article, you should have a functional hostgroup inheritance setup; however, I do not recommend running through these steps in your production environment. There will be future articles where we will expand on the functionality laid out here.
With that said, if you are running Nagios XI, you are allowed three instances of Nagios XI: Production, Test, and Disaster Recovery. This would be a good opportunity to fire up that “Test” instance of Nagios XI.
Begin by Beginning
For this first example, we’re going to setup hostgroup inheritance with a fresh install of Nagios XI. Once we’re done with this, you should have a good idea of how to retro fit an existing XI instance.
We’ll start this off by running a Configuration Wizard against a host that you want to monitor. The host that you want to monitor will, presumably, be one of a large number of similar hosts. In our example, we’ll use a basic Windows host being monitored using NCPA.
Now I don’t want to walk you through running the NCPA Wizard to monitor your Windows host. I’ll leave that as an exercise to you. The end result is that in the Core Configuration Manager (CCM), you now have a host with multiple services being monitored. If you go to the Services section of the CCM and display the config for the Windows machine you are monitoring, you should see something similar to this:

Changing a Single Service Check
You can see we’ve got CPU, disk, bandwidth, memory, and a service that we’re monitoring on this Windows box. Now we know that for all of our servers, whether Windows or Linux (or AIX, or Solaris, or FreeBSD, etc.), we want to monitor CPU and memory usage. Why create that over and over again? Why not just have that in some kind of template that can be applied to each server as you add it?
That’s what we’re going to do here. Before we modify that service, let’s create a hostgroup that will hold service checks for any OS. Click on Monitoring -> Host Groups -> Add New. Now for the Host Group Name and Alias fields, I like to keep this brief, yet descriptive. For this one I’m going to call it ncpa-anyos. Meaning the system is monitored using NCPA, and the service checks apply to any operating system. Click save.
Now go back to Monitoring -> Services and open up the CPU Usage service check definition (or whatever service you want to make available via hostgroup inheritance) and let’s convert it.
The first field we want to change is the Config Name field. In Nagios XI, this field typically lines up with the name or IP of the host it is tied to. But it doesn’t have to be that way. Let’s create a new config name by changing this to AnyOS. Meaning the service checks in this config will apply to any operating system.
Next, click the Manage Hosts button and remove the assigned host. And finally, click the Manage Host Groups button, and add the service check to the ncpa-anyos hostgroup. Realistically, that’s it. Now any host that you put in the ncpa-anyos hostgroup will have that CPU Usage service check. Go ahead and add a host to the ncpa-anyos hostgroup, apply the configuration, and check your host status screen.
Limitations
There are some immediate limitations with this setup as it is right now. We’ll dive into the fixes for them in my next article for this series. For now, I just want to call out one in particular.
Not all of your hosts will have the same CPU warning and/or critical thresholds. Or maybe they have different NCPA tokens. For those of you who don’t want to wait for the next article, I’ll point you in the right direction. In the next article, we’ll touch on using custom host variables and host templates to deal with the limitation of needing to customize different pieces of a service check. We’ll also be touching on creating a new command.
Additional Reading for Overachievers
Managing Plugins in Nagios XI 2024. Specifically, we will be looking at the Define A Command section of this document.
And since we’ll be talking about host and service templates, it might be good to brush up on Object Inheritance.



