Problem with hostgroup members definition

Andreas Ericsson ae at op5.se
Tue Dec 7 23:42:28 CET 2010


On 12/07/2010 10:41 PM, Forrest Aldrich wrote:
> I have a new Nagios 3 installation where I am trying to include several
> hosts in a hostgroup definition (to be efficient).
> 
> The error I'm getting (from the pre-flight check):
> 
> Error: Could not expand members specified in hostgroup ...
> 
> At first, I was referring to hosts by their "alias" which is defined in
> the host definition, but it appears I cannot..   Next, I thought the
> line was too long.   There are a total of 27 hosts.
> 

If the line is longer than 64K, then it's too long. Unless your hostnames
are very very very very VERY long I doubt that's the problem.

> I want use a hostgroup definition and bind a check-host-alive to that
> group -- seems pretty efficient.  Is there a better way to accomplish this.
> 

But you can't. Hostgroups can't be used to assign host-checks. Use host
templates for that. Your check-host-alive command should be the default
that (very nearly) all templates use, and those that for some reason
deviate from the standard check-alive thing should have their commands
set in the host object definition.

> I had another person double check my work and we compared it to another
> known-working config, where I believe aliases were being used.
> 

They weren't. aliases have never worked to assign hosts to hostgroups.

> No special configuration was done, I just used the example configs and
> commented out a bunch of stuff or just defined my own objects.
> 
> At the moment, I have several hosts that belong to a production group:
> 
> 
> define hostgroup{
>          hostgroup_name prod-servers ; The name of the hostgroup
>           alias          Production Servers ; Long name of the group
>          members         host1,host2, ... (omitted here for brevity)
>          }
> 
> 
> We have 2 or 3 groups of servers that we want to configure for simple
> check-host-alive work, for some development integration with Nagios - it
> doesn't have to be sophisticated at the moment.   The "production" group
> is the largest.
> 
> I redacted the changes and put a FQHN (1) in there and it seemed to
> work.  Is there a better way to associate multiple hosts with a hostgroup?
> 

There are two ways to assign hosts to a hostgroups. Well, three actually,
but one of them happens to be an extension of the original two, so it
doesn't really count.

The first is to set the 'members' variable in the hostgroup itself and
on that line specify all the named hosts you want to include. This has
to be done using the host_name variable from the object itself. I'm
not sure if the parser groks spaces surrounding the comma yet. It didn't
a while back, causing confusion in the user-ranks.

The second is to list the hostgroups using the hostgroups directive in
the host object definitions themselves. Then you must link them to the
hostgroup_name variable from the hostgroup objects.

The third way, which is an extension of the second, is to set the
hostgroups variable in a host template and use that template in all
the hosts you want to be part of the hostgroup. That way you can get
away with specifying the check-host-alive command only once, and then
override it from each host object if you wish.


> Any pointers would be appreciated.
> 

www.nagios.org and then click your way to the online documentation.
You should probably have started there before mailing here tbh, but
I'm in a good mood today so I refrained from biting your head off.
You can thank me for that later if you like.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list