Closed jskarpe closed 11 years ago
I fixed this issue by adding a drity hack to target.pp
It should probably be patched properly, such that target.pp reuse the same $customdir as defined in init.pp
This is actually a problem I'm aware of, and the quick solution, for the moment is to set the value of $customconfigdir as acceptable by the distro of the Nagios server. (/etc/nagios3/auto.d or /etc/nagios/auto.d according to cases).
For nagios 3.4.4 on CentOS 6, cfg_dir should be '/etc/nagios/objects' as there are no '/etc/nagios/auto.d/' or '/etc/nagios/modules' directories.
actually it makes sense to keep the config_dir to /etc/nagios[3] as that's the whole configuration directory. /etc/nagios/auto.d is created by the module to place all the exported resources. The reason behind a top scope $:: nagios_customconfigdir (as in target.pp) is to work around the problem that a directory whose path is relevant to the server's os, has to be used in files exported from other hosts, which may have a different os.
setting cfg_dir=/etc/nagios in file nagios.cfg on CentOS 6 with nagios 3.4.4 would fail checkconfig.
By the way, 'include nagios' would fail bringing up nagios on a managed host due to cmd file (command_file=/var/spool/nagios/cmd ) should be a pipe, not a directory. The directory seems to be created by puppet agent; without deleting it, nagios service won't start.
Oops, sorry, I misunderstood. The cfg_dir in the (module's default) nagios configuration file points to /etc/nagios/auto.d/ because there is were all the configurations are automatically placed. For the command_file issue are you referring to the lines in skel.pp? (don't remember why they are there..):
if $::operatingsystem =~ /(?i:Debian|Ubuntu|Mint)/ {
file { '/var/lib/nagios3/rw':
ensure => directory,
mode => '0770',
require => Package["nagios"],
}
}
probably because on different distros is in different places (params.pp)
$commandfile = $::operatingsystem ? {
/(?i:RedHat|Centos|Scientific|Fedora|Amazon|Linux)/ => '/var/spool/nagios/cmd',
/(?i:Debian|Ubuntu|Mint)/ => '/var/lib/nagios3/rw/nagios.cmd',
default => '/var/lib/nagios/rw/nagios.cmd',
}
With regard to issue relating to cmd, it works after I commented out the section of code in file 'skel.pp' on "file{'nagios.cmd': ... }" I think this is where puppet agent creates this directory instead of leaving it to nagios service to create a pipe on the same path.
Erm, but that part is already commented in the current skel.pp https://github.com/example42/puppet-nagios/blob/master/manifests/skel.pp From where (and when) did you get the module?
Interesting. I used command 'puppet module install example42-nagios'; although Modulefile shows version '2.0.8', the files are slightly different. puppet comes from package built at puppetlabs.net
Actually the modules on the forge are not updated, and I don't always skip the version number when I make changes (I suppose I need to be more strict about that)
How i cat defiene variable nagios_customconfigdir?
I neet to place it in node class?
That should be a top scope variable, and should refer to the nagios conf dir appropriate for the operating system of the nagios server, by default is /etc/nagios/auto.d just set it to /etc/nagios3/auto.d if your Nagios servers runs on ubuntu or debian
[Yes, the documentation of the module sucks]
As in #11
I'm running nagios on Ubuntu 12.04 LTS, and enabling $debug shows that the $customconfigdir points to /etc/nagios3/auto.d/hosts/
as expected, however, the storedconfigs are all written to:
Am I missing an option to get the storedconfigs into the right place?