1

I have a little problem when I try to integrate Puppet with Nagios.

This is my configuration (I know, it's so simple but it's my first try)

/etc/puppet/modules/nagios/manifests/init.pp

class nagios::server {
  package { ["nagios"]:
    ensure => installed,
  }
  service { nagios:
    ensure  => running,
    enable  => true,
  }
  file { 'resource-d':
    path   => '/etc/nagios/objects',
    ensure => directory,
    owner  => 'nagios',
  }
  # Collect the nagios_host resources
  Nagios_host <<||>> {
    require => File[resource-d],
    notify  => [Service[nagios]],
  }
}

/etc/puppet/modules/nagios/manifests/export.pp

class nagios::export {
  @@nagios_host { $::fqdn:
    address       => $::ipaddress,
    check_command => 'check-host-alive!3000.0,80%!5000.0,100%!10',
    hostgroups    => 'all-servers',
    target        => "/etc/nagios/objects/host_${::fqdn}.cfg"
  }
}

/etc/puppet/manifests/site.pp

node 'server-1'
{
        include nagios::server
        include nagios::export
}

All this stuff is working but the cfgs with Nagios configuration are created in the remote node "server-1" instead of Nagios server (Nagios and Puppet are running in the same server) and I cannot get this configuration from server-1 to be shown in Nagios server. Do you have any idea of what is happening?.

Regards

Javi
  • 11
  • 2
  • Is server-1 not the nagios/puppet server? I am confused. You are doing `include nagios::server` on your `server-1` node, so what do you expect? Include that on the nagios server node. – Zoredache Nov 24 '15 at 19:06
  • Hi Zoredache. server-1 is the remote server, the server to be monitored by Nagios. The configuration in /etc/puppet/manifests/site.pp file is stored in Nagios-Puppet server. Do I need to put this config in the remote server too? – Javi Nov 25 '15 at 07:17
  • on the server that you need to monitor you need "include nagios::export" and on the nagios server "include nagios::server" – c4f4t0r Dec 14 '15 at 22:16

1 Answers1

0

Resources need to be exported on the server being monitored and collected on the server running Nagios. You say that "server-1" is the server being monitored and that you're running Nagios and Puppet on the same server, so I'll assume that second, monitoring server is named "puppet". Consequently, your Puppet site.pp should look like this:

node 'puppet' {
    include nagios::server
}
node 'server-1' {
    include nagios::export
}
asciiphil
  • 3,086
  • 3
  • 28
  • 53