From 9ce0591c715170467dd31533f6f0afc08ab75fe6 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Thu, 6 Aug 2015 17:16:15 +0200 Subject: nrpe2 - code style fixes - Add copyright header (from git history) - Nuke useless tags and fix file permissions. - Descriptions cosmetics. --- config/nrpe2/nrpe2.xml | 56 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 8 deletions(-) (limited to 'config/nrpe2') diff --git a/config/nrpe2/nrpe2.xml b/config/nrpe2/nrpe2.xml index 8d6f0b09..1204e8ec 100644 --- a/config/nrpe2/nrpe2.xml +++ b/config/nrpe2/nrpe2.xml @@ -1,9 +1,50 @@ + + + + + Nagios NRPEv2 - Describe your package requirements here nrpe2 - 2.2 + 2.2.1 NRPEv2 /pkg_edit.php?xml=nrpe2.xml&id=0 /usr/local/pkg/nrpe2.inc @@ -22,7 +63,6 @@ installedpackages->package->nrpe2 /usr/local/pkg/ - 077 https://packages.pfsense.org/packages/config/nrpe2/nrpe2.inc @@ -34,7 +74,7 @@ Enabled enabled - Check this to enable NRPE daemon + Check this to enable NRPE daemon. checkbox @@ -52,20 +92,20 @@ Bind IP Address server_address - Set this to the IP address of the interface you want the daemon to listen on. (optional) + Set this to the IP address of the interface you want the daemon to listen on. (Optional) input Nagios Server(s) allowed_hosts - IP Address of Nagios server, usualy a single IP, but if multiple delimit by comma + IP Address of Nagios server. Usually a single IP; multiple IPs must be delimited by comma. input Allow Arguments (dont_blame_nrpe) dont_blame_nrpe - Check this to enable accept NRPE arguments (Default: 0) + Check this to enable accept NRPE arguments. (Default: 0) checkbox @@ -118,7 +158,7 @@ Extra Options (Example: -s Z \$ARG1\$ \$ARG2\$) extra - Warning! Use at your own risk, incorrect settings here may prevent NRPE from starting! + Warning! Use at your own risk, incorrect settings here may prevent NRPE from starting!]]> input 25 -- cgit v1.2.3 From 4fc734a803daea64bb429ee22988f9555c227730 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Thu, 6 Aug 2015 17:47:05 +0200 Subject: nrpe2.inc - code style and other fixes - Fix copyright header - Code style - FIx NRPE_BASE for pfSense 2.3 --- config/nrpe2/nrpe2.inc | 82 +++++++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 38 deletions(-) (limited to 'config/nrpe2') diff --git a/config/nrpe2/nrpe2.inc b/config/nrpe2/nrpe2.inc index 7d541e6b..b5e6a7d9 100644 --- a/config/nrpe2/nrpe2.inc +++ b/config/nrpe2/nrpe2.inc @@ -1,42 +1,49 @@ nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - +/* + nrpe2.inc + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 Erik Kristensen + Copyright (C) 2011-2013 Jim Pingle + Copyright (C) 2015 ESF, LLC + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ require_once('filter.inc'); -$pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); +global $pfs_version; +$pfs_version = substr(trim(file_get_contents("/etc/version")), 0, 3); -if ($pfs_version == "2.0") { - define('NRPE_BASE', '/usr/local'); -} else { +if ($pfs_version == "2.1" || $pfs_version == "2.2") { define('NRPE_BASE', '/usr/pbi/nrpe-' . php_uname("m")); +} else { + define('NRPE_BASE', '/usr/local'); } -if ($pfs_version == "2.1") +if ($pfs_version == "2.1") { define('NRPE_BINARY', NRPE_BASE . "/sbin/nrpe2"); -else +} else { define('NRPE_BINARY', "/usr/local/sbin/nrpe2"); +} define('NRPE_CONFIG_DIR', NRPE_BASE . '/etc'); define('NRPE_RCFILE', '/usr/local/etc/rc.d/nrpe2.sh'); @@ -202,22 +209,21 @@ connection_timeout=300 {$commands} EOD; if (defined($config['installedpackages']['nrpe2']['config'][0]['server_address'])) { - $server_address = $config['installedpackages']['nrpe2']['config'][0]['server_address']; - $nrpe_cfg .= "server_address={$server_address}"; - } + $server_address = $config['installedpackages']['nrpe2']['config'][0]['server_address']; + $nrpe_cfg .= "server_address={$server_address}"; + } fwrite($fd, $nrpe_cfg); fclose($fd); conf_mount_ro(); } function nrpe2_custom_php_service() { - global $g, $config; + global $config; if ($config['installedpackages']['nrpe2']['config'][0]['enabled'] == "on") { - exec(NRPE_RCFILE . " restart"); - } - else { - exec(NRPE_RCFILE . " stop"); + restart_service("nrpe2"); + } else { + stop_service("nrpe2"); } } -- cgit v1.2.3