-   Linux - Software (
-   -   Nagios - Assign a contactgroup to a hostgroup. (

bpwoods 08-14-2009 04:12 PM

Nagios - Assign a contactgroup to a hostgroup.
I am in a rather large environment and have a large group of folks covering our servers. In many cases, these groups overlap.

I have created a script the scans a system, builds a Nagios services profile, then uploads it.

I have a list of contact groups that I statically entered.

What I would like to do, is assign a contactgroup to a hostgroup. For this to work, I can NOT edit the "define host" for each server. I need to do it with a separate entity.

Escilations would seem to fit the bill, but I would need to make an entry for every server\server to every group (tens of thousands of entries).

Ideas? Is this possible?

carltm 08-16-2009 08:51 AM

I don't know of a way to do what you're describing using hostgroups.

I have a rather complex setup and I use templates to get similar functionality.
For example, we have different requirements for production and staging environments,
several networks and many projects. I create a template named prod-env and stage-env;
one for internal-net, dmz1-net, dmz2-net, offsite-net and internet-net; and one for
each project, such as old-project, hot-project, etc.

For every host I have a "use +some-project,some-env,some-net" statement that
calls the templates. The + means to inherit whatever settings it can, but then
override with the some-net settings, followed by the some-env settings, followed
by the some-project settings, followed by the settings for the host definition.
In other words it inherits, applies the templates in reverse order, then uses host
settings, and the last setting applied wins.

This lets you easily set parents, check commands and contact info based on the
network of the hosts. Set the times and escalations based on the environment.
Set the contacts and override other settings if needed for specific projects in
the project templates.

I'd be interested to see your script if you can share it.

All times are GMT -5. The time now is 06:33 AM.