diff options
author | Gabriel Filion <gabriel@koumbit.org> | 2011-11-07 12:07:28 -0500 |
---|---|---|
committer | Gabriel Filion <lelutin@gmail.com> | 2012-04-10 00:09:15 -0400 |
commit | 8f24f259caa75f78ed501377c95c0a6fab0ebb11 (patch) | |
tree | fba508140fdb75b251f3da838646c997978adff9 | |
parent | b956d666681ccf20f70be65c3b57aa77928a9be9 (diff) |
Fix NRPE for FreeBSD
Plugins are found under another directory.
The pid file must be changed to /var/spool/nagios/nrpe2.pid, since this
place is writable by the daemon, and the rc script expects the pid file
to be found there.
Use a pattern instead of the rc script status command.
-rw-r--r-- | manifests/nrpe.pp | 5 | ||||
-rw-r--r-- | manifests/nrpe/base.pp | 2 | ||||
-rw-r--r-- | manifests/nrpe/freebsd.pp | 3 | ||||
-rw-r--r-- | templates/nrpe/nrpe.cfg | 2 |
4 files changed, 9 insertions, 3 deletions
diff --git a/manifests/nrpe.pp b/manifests/nrpe.pp index c9ecf75..5c05ed4 100644 --- a/manifests/nrpe.pp +++ b/manifests/nrpe.pp @@ -3,10 +3,15 @@ class nagios::nrpe { case $operatingsystem { 'FreeBSD': { if $nagios_nrpe_cfgdir == '' { $nagios_nrpe_cfgdir = '/usr/local/etc' } + if $nagios_nrpe_pid_file == '' { $nagios_nrpe_pid_file = '/var/spool/nagios/nrpe2.pid' } + if $nagios_plugin_dir == '' { $nagios_plugin_dir = '/usr/local/libexec/nagios' } include nagios::nrpe::freebsd } default: { + if $nagios_nrpe_pid_file == '' { $nagios_nrpe_pid_file = '/var/run/nrpe.pid' } + if $nagios_plugin_dir == '' { $nagios_plugin_dir = '/usr/lib/nagios/plugins' } + case $kernel { linux: { include nagios::nrpe::linux } default: { include nagios::nrpe::base } diff --git a/manifests/nrpe/base.pp b/manifests/nrpe/base.pp index f1809d7..17abb04 100644 --- a/manifests/nrpe/base.pp +++ b/manifests/nrpe/base.pp @@ -37,7 +37,7 @@ class nagios::nrpe::base { $critical_5_threshold = 9 * $processorcount $critical_15_threshold = 8 * $processorcount nagios::nrpe::command { "check_load": - command_line => "/usr/lib/nagios/plugins/check_load -w ${warning_1_threshold},${warning_5_threshold},${warning_15_threshold} -c ${critical_1_threshold},${critical_5_threshold},${critical_15_threshold}", + command_line => "${nagios_plugin_dir}/check_load -w ${warning_1_threshold},${warning_5_threshold},${warning_15_threshold} -c ${critical_1_threshold},${critical_5_threshold},${critical_15_threshold}", } service { "nagios-nrpe-server": diff --git a/manifests/nrpe/freebsd.pp b/manifests/nrpe/freebsd.pp index 4ae693c..063b79b 100644 --- a/manifests/nrpe/freebsd.pp +++ b/manifests/nrpe/freebsd.pp @@ -8,8 +8,9 @@ class nagios::nrpe::freebsd inherits nagios::nrpe::base { # TODO check_cpustats.sh is probably not working as of now. the package 'sysstat' is not available under FreeBSD Service["nagios-nrpe-server"] { - pattern => undef, + pattern => "^/usr/local/sbin/nrpe2", path => "/usr/local/etc/rc.d", name => "nrpe2", + hasstatus => "false", } } diff --git a/templates/nrpe/nrpe.cfg b/templates/nrpe/nrpe.cfg index b666e42..5368bc8 100644 --- a/templates/nrpe/nrpe.cfg +++ b/templates/nrpe/nrpe.cfg @@ -16,7 +16,7 @@ # number. The file is only written if the NRPE daemon is started by the root # user and is running in standalone mode. -pid_file=/var/run/nrpe.pid +pid_file=<%= nagios_nrpe_pid_file %> |