Intro To Hostgroup Inheritance

Picture of Michael Bellerue
Michael Bellerue
Technical Sales Engineer
Intro To Hostgroup Inheritance
Nagios Hostgroup Inheritance Series — Part 1: Intro To Hostgroup Inheritance

This article kicks off our Nagios Hostgroup Inheritance Series, where you will learn helpful tips and best practices for Hostgroup Inheritance.

Hostgroup Inheritance: What Is It?

Having worked in support and technical sales here at Nagios Enterprises, one of the requests I’ve regularly seen is the ability to have a “template of services” that can be assigned to a host. I put “template of services” in quotes because I don’t want you to confuse them with Service Templates, which are already a thing in Nagios, but they are distinctly not what people are looking for.

Currently, we don’t have an Easy Button for this, but there is a process called Hostgroup Inheritance that effectively gives people that “template of services” option. Upfront, there is a good chunk of work to be done. But in large environments, it will save you a ton of time.

It should also be noted that for smaller environments, Nagios XI has the Bulk Host Cloning & Import Wizard. This wizard can serve as a happy medium between running wizards against all of your hosts individually and implementing Hostgroup Inheritance.

The goal of this article series is to lay out the best features to use with Hostgroup Inheritance and how to set it up. I’ll be taking you through step by step, introducing each feature and the issue that it solves as we go.

In this article, I’m going to talk about configuration management and growing that configuration management, then I’ll be listing off all of the features we’ll be going over in the coming articles. In addition to all of that, I’ll lay out how to build a service check to use Hostgroup Inheritance from the ground up, followed by a shortcut that is specific to Nagios XI users.

There is a lot to cover, so let’s get started.

Out-Of-The-Box Nagios XI Config Management

The way that a person defines objects like hosts and services within Nagios Core (and by extension, Nagios XI) is through the use of plain text configuration files. There is no specific directory structure that you must use, which is somewhat of a double-edged sword. On the one hand, it offers maximum flexibility. On the other hand, I’ve seen countless systems where all hosts were defined in host.cfg, and all services were defined in services.cfg. Certainly, a valid way to do it. But that can get tricky when you try to implement it in larger environments.

The way Nagios XI manages configuration files is by using hosts and services directories. Each host has its host definition in the hosts directory. All of its services are defined in the services directory, in a file named after the hostname in the host definition.

So, in Nagios XI, when you look at a service definition in the Core Config Manager, you’ll see Config Name as the first setting. On the surface, this is a very safe and clean way to manage host and service configuration files. But there may be some issues of scaling when we look at larger environments.

Making Config Management Scale

The standard Nagios XI configuration management scheme does have plenty of upsides. However, I don’t feel like it scales very well. If you think about it, if you’re monitoring 100 servers, you’ve got 100 CPU service check definitions hanging out. Now, if you need to change the baseline for all 100 CPU service checks, you have to change 100 configuration entries.

Now that’s something that could be mitigated by the Bulk Modification Tools, Bulk Host Cloning & Import, or even some handy scripting with the Nagios XI API. But what if we also added configuration standardization into the mix?

Let’s say you’ve got a thousand or more servers you need to monitor properly. And let’s also say that a good chunk of them run Microsoft SQL Server. Like a good SQL Server admin, you configured those systems to have a drive for the OS, a drive for the data, and a drive for the transaction logs. Your other Windows servers only have a single drive. But these have three.

Do you want to remember to add monitoring for the two additional drives? Or do you want to assign a handy template to the host, a template with the name of the software the host is running, and have all of the appropriate service checks just show up? One of these sounds a heck of a lot better to me.

Why Doesn’t Nagios XI Just Do This?

Hostgroup Inheritance takes more than a little bit of setup. I’ve got dreams and aspirations of making a configuration wizard to help streamline the setup of Hostgroup Inheritance, but for right now, it does require a certain amount of thought, planning, and execution. More so than just standing up Nagios XI and running wizards against everything you need to monitor.

Thus, for many of our smaller customers, Hostgroup Inheritance isn’t worth the price of entry. Now, Nagios has always been about customization and fitting into as many environments as possible. To that end, I do want to see Hostgroup Inheritance made easier, making that price of entry come down, and making it available to more of our customers who fall somewhere between small and large environments.

Features You Need To Know

This article is already getting long. So, I’m going to lay out some additional reading that will help you in your Hostgroup Inheritance journey. I’ll cover the need-to-know in future articles related to Hostgroup Inheritance. But if you’re interested in the nitty-gritty, you might get a kick out of the features below.

Hostgroups

Well, we’re working with Hostgroup Inheritance. So, it’s best to know about hostgroups.
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/objectdefinitions.html#hostgroup

Inheritance

The second word in Hostgroup Inheritance, is worth knowing about.
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/objectinheritance.html

Host Templates

Host Templates will be key in our configuration of Hostgroup Inheritance.
https://support.nagios.com/kb/article/managing-host-templates-906.html

Custom Variables

Custom Variables will also be extremely important later in this series.
https://library.nagios.com/techtips/custom-variables-in-nagios-xi/

Stay tuned for Part 2 in the next article of the Nagios Hostgroup Inheritance Series!

Share: