Here are some of the custom facts, and manifest code we use for handling nrpe. Be sure that puppet ensures the service is setup to start at boot, and is running. Since we run Fedora 15, with an older version of puppet, be aware that some versions of puppet can't handle Fedora 15's systemd.
nrpe_plugin_directory.rb
Facter.add("nrpe_plugin_directory") do
setcode do
%x{dirs="/usr/lib/nagios/plugins /usr/lib64/nagios/plugins /usr/local/nagios/libexec"; for dir in $dirs; do [[ -e $dir ]] && [[ ! -L $dir ]] && { echo $dir; exit; }; done}.chomp
end
end
nrpe_cfg_file.rb
Facter.add("nrpe_cfg_file") do
setcode do
%x{files="/etc/nagios/nrpe.cfg /usr/local/nagios/etc/nrpe.cfg /usr/local/nagios/nrpe.cfg"; for file in $files; do [[ -f $file ]] && { echo $file; exit; }; done}.chomp
end
end
Manifest code:
file{"/nagios/plugins":
ensure => "symlink",
target => "${nrpe_plugin_directory}",
force => 'true',
}
file{"$nrpe_plugin_directory":
source => "/..../plugins",
ensure => "directory",
recurse => "true",
ignore => ".svn",
}
case $nrpe_cfg_file {
undef: { }
default:{
file{"/nagios/nrpe.cfg":
ensure => "symlink",
target => "${nrpe_cfg_file}",
require => File["/nagios"],
}
file{"$nrpe_cfg_file":
source => "/..../nrpe.cfg",
}
# ..............
}