diff --git a/net-mgmt/nrpe3/Makefile b/net-mgmt/nrpe3/Makefile new file mode 100644 index 000000000..a245d257a --- /dev/null +++ b/net-mgmt/nrpe3/Makefile @@ -0,0 +1,8 @@ +PLUGIN_NAME= nrpe +PLUGIN_VERSION= 0.1 +PLUGIN_COMMENT= Execute nagios plugins +PLUGIN_DEPENDS= nrpe3 +PLUGIN_MAINTAINER= m.muenz@gmail.com +PLUGIN_DEVEL= YES + +.include "../../Mk/plugins.mk" diff --git a/net-mgmt/nrpe3/pkg-descr b/net-mgmt/nrpe3/pkg-descr new file mode 100644 index 000000000..483177b58 --- /dev/null +++ b/net-mgmt/nrpe3/pkg-descr @@ -0,0 +1,9 @@ +nrpe is used to execute Nagios plugins on remote hosts and report the results +to the main Nagios server. From the Nagios homepage: + +Allows you to execute "local" plugins (like check_disk, check_procs, etc.) on +remote hosts. The check_nrpe plugin is called from Nagios and actually makes +the plugin requests to the remote host. Requires that nrpe be running on the +remote host (either as a standalone daemon or as a service under inetd). + +WWW: http://www.nagios.org/ diff --git a/net-mgmt/nrpe3/src/etc/inc/plugins.inc.d/nrpe.inc b/net-mgmt/nrpe3/src/etc/inc/plugins.inc.d/nrpe.inc new file mode 100644 index 000000000..59a70977d --- /dev/null +++ b/net-mgmt/nrpe3/src/etc/inc/plugins.inc.d/nrpe.inc @@ -0,0 +1,55 @@ + + 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. +*/ + +function nrpe_enabled() +{ + $model = new \OPNsense\Nrpe\General(); + return (string)$model->enabled == '1'; +} + +function nrpe_services() +{ + $services = array(); + + if (!nrpe_enabled()) { + return $services; + } + + $services[] = array( + 'description' => gettext('NRPE'), + 'configd' => array( + 'restart' => array('nrpe restart'), + 'start' => array('nrpe start'), + 'stop' => array('nrpe stop'), + ), + 'name' => 'nrpe3', + 'pid' => '/var/run/nrpe.pid' + ); + + return $services; +} diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/Api/CommandController.php b/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/Api/CommandController.php new file mode 100644 index 000000000..4e05c4db3 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/Api/CommandController.php @@ -0,0 +1,64 @@ + + * + * 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. + * + */ + +namespace OPNsense\Nrpe\Api; + +use \OPNsense\Base\ApiMutableModelControllerBase; + +class CommandController extends ApiMutableModelControllerBase +{ + protected static $internalModelName = 'command'; + protected static $internalModelClass = '\OPNsense\Nrpe\Command'; + + public function searchCommandAction() + { + return $this->searchBase('commands.command', array("enabled", "name", "nrpecommand", "arguments")); + } + public function getCommandAction($uuid = null) + { + $this->sessionClose(); + return $this->getBase('command', 'commands.command', $uuid); + } + public function addCommandAction() + { + return $this->addBase('command', 'commands.command'); + } + public function delCommandAction($uuid) + { + return $this->delBase('commands.command', $uuid); + } + public function setCommandAction($uuid) + { + return $this->setBase('command', 'commands.command', $uuid); + } + public function toggleCommandAction($uuid) + { + return $this->toggleBase('commands.command', $uuid); + } +} diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/Api/GeneralController.php b/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/Api/GeneralController.php new file mode 100644 index 000000000..6e7559af3 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/Api/GeneralController.php @@ -0,0 +1,39 @@ + + * + * 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. + * + */ + +namespace OPNsense\Nrpe\Api; + +use OPNsense\Base\ApiMutableModelControllerBase; + +class GeneralController extends ApiMutableModelControllerBase +{ + protected static $internalModelClass = '\OPNsense\Nrpe\General'; + protected static $internalModelName = 'general'; +} diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/Api/ServiceController.php b/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/Api/ServiceController.php new file mode 100644 index 000000000..f8d8cf323 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/Api/ServiceController.php @@ -0,0 +1,46 @@ + + * + * 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. + * + */ + +namespace OPNsense\Nrpe\Api; + +use OPNsense\Base\ApiMutableServiceControllerBase; +use OPNsense\Nrpe\General; + +/** + * Class ServiceController + * @package OPNsense\Nrpe + */ +class ServiceController extends ApiMutableServiceControllerBase +{ + protected static $internalServiceClass = '\OPNsense\Nrpe\General'; + protected static $internalServiceTemplate = 'OPNsense/Nrpe'; + protected static $internalServiceEnabled = 'enabled'; + protected static $internalServiceName = 'nrpe'; +} diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/GeneralController.php b/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/GeneralController.php new file mode 100644 index 000000000..87b9e750c --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/GeneralController.php @@ -0,0 +1,39 @@ + + 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. +*/ + +namespace OPNsense\Nrpe; + +class GeneralController extends \OPNsense\Base\IndexController +{ + public function indexAction() + { + $this->view->generalForm = $this->getForm("general"); + $this->view->formDialogEditNrpeCommand = $this->getForm("dialogEditNrpeCommand"); + $this->view->pick('OPNsense/Nrpe/general'); + } +} diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/forms/dialogEditNrpeCommand.xml b/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/forms/dialogEditNrpeCommand.xml new file mode 100644 index 000000000..2cffa3724 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/forms/dialogEditNrpeCommand.xml @@ -0,0 +1,26 @@ +
diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/forms/general.xml b/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/forms/general.xml new file mode 100644 index 000000000..78a726b62 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/controllers/OPNsense/Nrpe/forms/general.xml @@ -0,0 +1,54 @@ + diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/ACL/ACL.xml b/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/ACL/ACL.xml new file mode 100644 index 000000000..7c795dda4 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/ACL/ACL.xml @@ -0,0 +1,9 @@ +| {{ lang._('Enabled') }} | +{{ lang._('Name') }} | +{{ lang._('Command') }} | +{{ lang._('Arguments') }} | +{{ lang._('ID') }} | +{{ lang._('Commands') }} | +
|---|---|---|---|---|---|
| + | + + | +||||