Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a puppet set up using the nagios types. Mostly it works fine, but sometimes I find that the generated puppet-hosts.cfg file keeps growing - the hosts are just added and re-added ad nauseam. Deleting the file and running puppetd -t regenerates it fine.

Our nagios host bit in the puppet nagios module is:

# set up alias
$real_nagios_alias = $nagios_alias ? { '' => $hostname, default => $nagios_alias }
$real_nagios_contact_groups = $nagios_contact_groups ? 
  { '' => 'admins', default => $nagios_contact_groups }
$real_nagios_parents = $nagios_parents ? { '' => '', default => $nagios_parents }

$default_nagios_hostgroups = 'all-servers'
$real_nagios_hostgroups = $nagios_hostgroups ? 
  { '' => $default_nagios_hostgroups, default => $nagios_hostgroups }

@@nagios_host { $hostname:
  ensure          => present,
  address         => $fqdn,
  alias           => $real_nagios_alias,
  contact_groups  => $real_nagios_contact_groups,
  hostgroups      => $real_nagios_hostgroups,
  parents         => $real_nagios_parents,
  use             => 'generic-host',
  target          => $nagios_puppet_host_file,

($nagios_puppet_host_file is defined in the main manifests/site.pp file). In the nagios server class we have the line:

Nagios_host              <<||>> { notify => Service['nagios'] }

When running puppetd -t on the nagios server, I often get an error along the lines of:

err: Could not prefetch nagios_host provider 'naginator': Could not parse configuration for nagios_host: line 15: syntax error at '
' in /usr/local/nagios/etc/puppet-hosts.cfg

The line number varies, but when I look in the file, the line number will line up with something like:

define host {
  contact_groups                 admins

The line number will be the line with "address" on it. Apart from that I've not spotted a pattern to which host it complains about.

So is there any reason why the hosts keep getting regenerated?

Puppet version is 0.25.4 generally, including on the puppet server, though it is 2.6.2 on the nagios server, which I guess may be the problem.

share|improve this question
up vote 2 down vote accepted

I think you're running into something related to Puppet Bug #4076. One workaround is to use David Schmitt's nagios module instead.

share|improve this answer
Not only is the performance poor but but storeconfig has scaling problems as well. The auto-generated configs don't have any service information in them either. I've been thinking about moving all the service/nrpe knowledge I have encoded in Nagios over to puppet conf files but I haven't found the right module yet and may have to roll my own. – Joshua Hoblitt Aug 22 '11 at 9:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.