Best practice for Nagios Object relationships

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
toneill2000
Posts: 29
Joined: Sun Jan 14, 2018 12:56 pm
Location: Madison, WI

Best practice for Nagios Object relationships

Post by toneill2000 »

Nagios community,
I'm looking for feedback on Nagios best practices for establishing relationships between hosts, host templates, and host groups. I will add in the contacts and contact groups later but getting feedback on this should spring me in the right direction.

Please see my attached diagram. I've analyzed the Nagios table structure quite a bit and understand how these relationships are built behind the scenes. The trouble I'm having is that Nagios seems so flexible that creates opportunities to make a mess of things. For example, it seems to me that defining a host to host group relationship should happen from the host group perspective - NOT from the host perspective. The reason is you can maintain all hosts to a host group from one location which makes changes and maintenance easier. Again, this is one example but I would like feedback on my diagram that I've attached.

More specifically, please review my green, yellow, and red notations where I believe the good, bad and neutral practices exists. The ones I've marked neutral just means that it may be okay to do this but use caution as there may be a better way. Thank you in advance for feedback on this. I'm going to use this in building out solutions and perhaps reconfiguring existing installation of Nagios.
Todd

p.s., I just re-uploaded my image as I noticed there were some crows-feet lines I had backwards.
nagios.jpg
You do not have the required permissions to view the files attached to this post.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Best practice for Nagios Object relationships

Post by tmcdonald »

First off, impressive diagram :) I wish all DB questions were this precise.

In regards to "Best Practice" I always say "The best practice is the one you document and adhere to". This applies to many things in Nagios, but oddly enough the question that sparked that response years ago was exactly one of the questions you had: how best to organize host <-> hostgroup relations?

I personally agree with your thoughts that the hostgroup definition is the proper place to create associations between hosts and their hostgroups (and between services and their servicegroups). XI tends to do it the opposite way, however: a new host is created and on that host definition is defined what groups it belongs to. As far back as I can remember, this is how the config wizards have always done it. Both have the same effect, so it practically comes down to a matter of preference.

Regarding host <-> template, I don't think your red line would even be possible in XI. You can either have a host that is actually being monitored, or you can have a template that is not monitored, but it cannot be both. In other words, you cannot use a host as a template for another host (at least not in any way that I am familiar with). So then by definition, your red line goes away and the yellow turns to green.

(Edit: For clarity, this sort of thing is possible in Core and XI if you are editing the config files directly, but not via the CCM. I am not sure what effects there would be if you forced this through the DB - exercise for the curious)

For the rest, I guess I would need specific questions about what you believe to be possibly bad practice.
Former Nagios employee
toneill2000
Posts: 29
Joined: Sun Jan 14, 2018 12:56 pm
Location: Madison, WI

Re: Best practice for Nagios Object relationships

Post by toneill2000 »

First off, impressive diagram :) I wish all DB questions were this precise.

Thanks! :D
I personally agree with your thoughts that the hostgroup definition is the proper place to create associations between hosts and their hostgroups (and between services and their servicegroups). XI tends to do it the opposite way, however: a new host is created and on that host definition is defined what groups it belongs to. As far back as I can remember, this is how the config wizards have always done it. Both have the same effect, so it practically comes down to a matter of preference.
Thanks for your thoughts and feedback. I had a feeling that would be the answer but was hoping for more of a "it's always recommended to do it..." kind of a answer.
Regarding host <-> template, I don't think your red line would even be possible in XI. You can either have a host that is actually being monitored, or you can have a template that is not monitored, but it cannot be both. In other words, you cannot use a host as a template for another host (at least not in any way that I am familiar with). So then by definition, your red line goes away and the yellow turns to green.
I'm running Nagios XI 5.4.8 and I am able to add a host as a host template. Notice on the Host edit page under the Misc Settings tab, there is a field called "Use this configuration as a template." When I enter a value there, it saves a record in the table called HostToHostTemplate but uses a column on that table called idTable to indicate the template is stored in the hosts table instead of the hostTemplates table. See my images that I've attached which shows these new records after adding a host as a template. After doing this, this host becomes available as a template to other hosts. To me, this also seems like bad practice except for the fact that if you already have a host setup, you can avoid retyping everything as a template. related post where I described this too

I guess for now, my questions have been addressed. I may be posting more specific questions in the near future. Again, thanks for you time.
Todd
hostAsTemplate.jpg
hostTemplateRelationship.jpg
hostTemplateResult.jpg
You do not have the required permissions to view the files attached to this post.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Best practice for Nagios Object relationships

Post by tmcdonald »

In all my years I have never seen that option...

Well, thanks for showing me something new at any rate! I might have to poke around some of the other tables and see what else I can dig up.

I would tend to agree with you on this being bad practice, since you have to hunt around to find hosts that are templates instead of them being in one central place.
Former Nagios employee
toneill2000
Posts: 29
Joined: Sun Jan 14, 2018 12:56 pm
Location: Madison, WI

Re: Best practice for Nagios Object relationships

Post by toneill2000 »

thanks @tmcdonald, you can lock this down.
Locked