Ask Your Question

how do i add hosts as members to a nagios hostgroup?

asked 2014-06-20 16:19:18 -0600

kbspot gravatar image


I have no idea why this isn't working. i'm using puppet to automatically add nodes to my nagios server. So far i can add the nodes as hosts and add the services just fine (with a workaround with permissions). But when i try to add a host to a host group, i'm only seeing it being defined in the host.cfg definition not in the hostgroup.cfg file as a member. The host group got created but there are not members in the cfg file.

Here is the current definition. which i know currently works as it should, where it adds the host group name in the host definition. I've fiddled with these configs a bunch to try and get the member added but just can't figure it out. Any help would be AMAZING!

my puppet configs are:

Server side-

class nagios_server::import{

Nagioshost <<||>>{ require => Class['nagiosserver::install'], notify => File['hosts'] }

Nagiosservice <<||>>{ require => Class['nagiosserver::install'], notify => File['services'] }

Nagioshostgroup {require => Class['nagiosserver::install'], notify => File['hostgroups'],}

nagios_hostgroup { "all-hosts": target => "/etc/nagios3/objects/hostgroups/all-hosts.cfg", notify => File['hostgroups'], }


client side-

class nagios_client::targets {

@@nagios_host { $fqdn: ensure => present, alias => $hostname, address => $ipaddress, use => "linux-server", hostgroups => "all-hosts", target => "/etc/nagios3/objects/hosts/${::hostname}.cfg",


@@nagiosservice { "checkping${hostname}": checkcommand => "checkping!100.0,20%!500.0,60%", use => "generic-service", hostname => "$fqdn", notificationperiod => "24x7", servicedescription => "PING", target => "/etc/nagios3/objects/services/ping.cfg", }


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-06-23 16:27:45 -0600

cwalstrom gravatar image

I'm making these suggestions by convention rather than strict rules. In general, your Nagios hostgroup definition should,

  1. Be defined locally on the Nagios Server
  2. Never be define as an Exported Resource
  3. Not contain "members" directives
  4. Resolve from populating the hostgroups parameter on nagios_host resources (either local or @@ exported)

Essentially, I use hostgroups object is for aggregating service checks.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-06-20 16:19:18 -0600

Seen: 1,317 times

Last updated: Jun 23 '14