diff options
author | jim-p <jimp@pfsense.org> | 2013-08-14 11:24:16 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-08-14 11:25:20 -0400 |
commit | bb9868cafa6bc1be95bf2a1ae80b0bccc1dfc7fa (patch) | |
tree | 2fc5cc3208729a5358fac7dfc67c1ce530571cc8 | |
parent | f8d6395415784c7a9ca20d76d61942b7906d5e17 (diff) | |
download | pfsense-packages-bb9868cafa6bc1be95bf2a1ae80b0bccc1dfc7fa.tar.gz pfsense-packages-bb9868cafa6bc1be95bf2a1ae80b0bccc1dfc7fa.tar.bz2 pfsense-packages-bb9868cafa6bc1be95bf2a1ae80b0bccc1dfc7fa.zip |
For NRPE2, honor the "sudo" checkbox if it's checked and sudo exists on the system. Also, only add -w and -c if the boxes are filled in. Fixes #3145
-rw-r--r-- | config/nrpe2/nrpe2.inc | 6 | ||||
-rw-r--r-- | config/nrpe2/nrpe2.xml | 2 | ||||
-rw-r--r-- | pkg_config.8.xml | 2 | ||||
-rw-r--r-- | pkg_config.8.xml.amd64 | 2 |
4 files changed, 8 insertions, 4 deletions
diff --git a/config/nrpe2/nrpe2.inc b/config/nrpe2/nrpe2.inc index cd3fa013..25964b16 100644 --- a/config/nrpe2/nrpe2.inc +++ b/config/nrpe2/nrpe2.inc @@ -159,8 +159,12 @@ function nrpe2_custom_php_write_config() { conf_mount_rw(); $cmds = array(); foreach ($config['installedpackages']['nrpe2']['config'][0]['row'] as $cmd) { + $sudo_bin = "/usr/local/bin/sudo"; + $sudo = (isset($cmd['sudo']) && is_executable($sudo_bin)) ? "{$sudo_bin} " : ""; + $wcmd = !empty($cmd['warning']) ? "-w {$cmd['warning']}" : ""; + $ccmd = !empty($cmd['critical']) ? "-c {$cmd['critical']}" : ""; if (is_executable("{$nagios_check_path}/{$cmd['command']}")) - $cmds[] = "command[{$cmd['name']}]={$nagios_check_path}/{$cmd['command']} -w {$cmd['warning']} -c {$cmd['critical']} {$cmd['extra']}\n"; + $cmds[] = "command[{$cmd['name']}]={$sudo}{$nagios_check_path}/{$cmd['command']} {$wcmd} {$ccmd} {$cmd['extra']}\n"; } $commands = implode($cmds); diff --git a/config/nrpe2/nrpe2.xml b/config/nrpe2/nrpe2.xml index e013b47c..5b84b97f 100644 --- a/config/nrpe2/nrpe2.xml +++ b/config/nrpe2/nrpe2.xml @@ -3,7 +3,7 @@ <description>Nagios NRPEv2</description> <requirements>Describe your package requirements here</requirements> <name>nrpe2</name> - <version>2.11</version> + <version>2.2</version> <title>NRPEv2</title> <aftersaveredirect>/pkg_edit.php?xml=nrpe2.xml&id=0</aftersaveredirect> <include_file>/usr/local/pkg/nrpe2.inc</include_file> diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 95c504d5..72fba445 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -1648,7 +1648,7 @@ </build_pbi> <build_options>nrpe2_SET=SSL;nrpe2_UNSET=ARGS</build_options> <config_file>http://www.pfsense.com/packages/config/nrpe2/nrpe2.xml</config_file> - <version>2.12_3 v2.1</version> + <version>2.12_3 v2.2</version> <status>Beta</status> <required_version>1.2</required_version> <maintainer>erik@erikkristensen.com</maintainer> diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index b6730f72..d8e9b461 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -1635,7 +1635,7 @@ </build_pbi> <build_options>nrpe2_SET=SSL;nrpe2_UNSET=ARGS</build_options> <config_file>http://www.pfsense.com/packages/config/nrpe2/nrpe2.xml</config_file> - <version>2.12_3 v2.1</version> + <version>2.12_3 v2.2</version> <status>Beta</status> <required_version>1.2</required_version> <maintainer>erik@erikkristensen.com</maintainer> |