aboutsummaryrefslogtreecommitdiffstats
path: root/config/nrpe2
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2012-02-09 09:35:06 -0500
committerjim-p <jimp@pfsense.org>2012-02-09 09:35:06 -0500
commited217d2e1bc3d6f34567541e7113ef0e695cfb4a (patch)
tree847ae34f86cba9ddf273bbedced2d7e4cf50e70d /config/nrpe2
parent3c7a227b885a03e1182bb25475e8f47519d634e9 (diff)
downloadpfsense-packages-ed217d2e1bc3d6f34567541e7113ef0e695cfb4a.tar.gz
pfsense-packages-ed217d2e1bc3d6f34567541e7113ef0e695cfb4a.tar.bz2
pfsense-packages-ed217d2e1bc3d6f34567541e7113ef0e695cfb4a.zip
Only add default settings for nrpe2 if there are no settings. Otherwise the config is overwritten.
Diffstat (limited to 'config/nrpe2')
-rw-r--r--config/nrpe2/nrpe2.inc96
1 files changed, 50 insertions, 46 deletions
diff --git a/config/nrpe2/nrpe2.inc b/config/nrpe2/nrpe2.inc
index e60e5d2e..ca6f00ab 100644
--- a/config/nrpe2/nrpe2.inc
+++ b/config/nrpe2/nrpe2.inc
@@ -31,52 +31,56 @@ function nrpe2_custom_php_install_command() {
$ip = $config['interfaces']['lan']['ipaddr'];
- $config['installedpackages']['nrpe2']['config'][0]['enabled'] = "on";
- $config['installedpackages']['nrpe2']['config'][0]['server_address'] = $ip;
- $config['installedpackages']['nrpe2']['config'][0]['server_port'] = 5666;
- $config['installedpackages']['nrpe2']['config'][0]['allowed_hosts'] = "127.0.0.1";
-
- $config['installedpackages']['nrpe2']['config'][0]['row'] = array(
- 0 => array(
- 'name' => 'check_users',
- 'command' => 'check_users',
- 'warning' => '5',
- 'critical' => '10'
- ),
- 1 => array(
- 'name' => 'check_load',
- 'command' => 'check_load',
- 'warning' => '15,10,5',
- 'critical' => '30,25,20',
- ),
- 2 => array(
- 'name' => 'check_root',
- 'command' => 'check_disk',
- 'warning' => '20%',
- 'critical' => '10%',
- 'extra' => '-p /'
- ),
- 3 => array(
- 'name' => 'check_var',
- 'command' => 'check_disk',
- 'warning' => '20%',
- 'critical' => '10%',
- 'extra' => '-p /var/run'
- ),
- 4 => array(
- 'name' => 'check_zombie_procs',
- 'command' => 'check_procs',
- 'warning' => '5',
- 'critical' => '10',
- 'extra' => '-s Z'
- ),
- 5 => array(
- 'name' => 'check_total_procs',
- 'command' => 'check_procs',
- 'warning' => '150',
- 'critical' => '200'
- )
- );
+ if (!is_array($config['installedpackages']['nrpe2'])) {
+ $config['installedpackages']['nrpe2']['config'][0]['enabled'] = "on";
+ $config['installedpackages']['nrpe2']['config'][0]['server_address'] = $ip;
+ $config['installedpackages']['nrpe2']['config'][0]['server_port'] = 5666;
+ $config['installedpackages']['nrpe2']['config'][0]['allowed_hosts'] = "127.0.0.1";
+ }
+
+ if (!is_array($config['installedpackages']['nrpe2']['config'][0]['row'])) {
+ $config['installedpackages']['nrpe2']['config'][0]['row'] = array(
+ 0 => array(
+ 'name' => 'check_users',
+ 'command' => 'check_users',
+ 'warning' => '5',
+ 'critical' => '10'
+ ),
+ 1 => array(
+ 'name' => 'check_load',
+ 'command' => 'check_load',
+ 'warning' => '15,10,5',
+ 'critical' => '30,25,20',
+ ),
+ 2 => array(
+ 'name' => 'check_root',
+ 'command' => 'check_disk',
+ 'warning' => '20%',
+ 'critical' => '10%',
+ 'extra' => '-p /'
+ ),
+ 3 => array(
+ 'name' => 'check_var',
+ 'command' => 'check_disk',
+ 'warning' => '20%',
+ 'critical' => '10%',
+ 'extra' => '-p /var/run'
+ ),
+ 4 => array(
+ 'name' => 'check_zombie_procs',
+ 'command' => 'check_procs',
+ 'warning' => '5',
+ 'critical' => '10',
+ 'extra' => '-s Z'
+ ),
+ 5 => array(
+ 'name' => 'check_total_procs',
+ 'command' => 'check_procs',
+ 'warning' => '150',
+ 'critical' => '200'
+ )
+ );
+ }
unlink_if_exists('/usr/local/etc/rc.d/nrpe2');
$fd = fopen('/usr/local/etc/rc.d/nrpe2.sh', 'w');
$rc_file = <<<EOD