From 9625e5519ef3d9633a76b28b7ce3fbf1eae1ad41 Mon Sep 17 00:00:00 2001 From: jim-p Date: Tue, 3 Jul 2012 13:44:16 -0400 Subject: Fix nrpe2 for 2.1, also fix service status. --- config/nrpe2/nrpe2.inc | 33 ++++++++++++++++++++++----------- config/nrpe2/nrpe2.xml | 2 +- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/config/nrpe2/nrpe2.inc b/config/nrpe2/nrpe2.inc index ca6f00ab..cd3fa013 100644 --- a/config/nrpe2/nrpe2.inc +++ b/config/nrpe2/nrpe2.inc @@ -25,9 +25,20 @@ require_once('filter.inc'); +if (substr(trim(file_get_contents("/etc/version")),0,3) == "2.0") { + define('NRPE_BASE', '/usr/local'); +} else { + define('NRPE_BASE', '/usr/pbi/nrpe-' . php_uname("m")); +} +define('NRPE_CONFIG_DIR', NRPE_BASE . '/etc'); +define('NRPE_RCFILE', '/usr/local/etc/rc.d/nrpe2.sh'); + + function nrpe2_custom_php_install_command() { global $g, $config; conf_mount_rw(); + $NRPE_BASE = NRPE_BASE; + $NRPE_CONFIG_DIR = NRPE_CONFIG_DIR; $ip = $config['interfaces']['lan']['ipaddr']; @@ -81,8 +92,8 @@ function nrpe2_custom_php_install_command() { ) ); } - unlink_if_exists('/usr/local/etc/rc.d/nrpe2'); - $fd = fopen('/usr/local/etc/rc.d/nrpe2.sh', 'w'); + unlink_if_exists(NRPE_CONFIG_DIR . '/rc.d/nrpe2'); + $fd = fopen(NRPE_RCFILE, 'w'); $rc_file = << nrpe2 - nrpe2 + nrpe2.sh nrpe2 Nagios NRPE Daemon -- cgit v1.2.3