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 @@ +
+ + command.enabled + + checkbox + This will enable or disable the check command. + + + command.name + + text + Set the name for this check. + + + command.nrpecommand + + text + Full path to the check command. + + + command.arguments + + text + Set the arguments for this check commands. + +
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 @@ +
+ + general.enabled + + checkbox + This will activate the NRPE service. + + + general.server_port + + text + Set the port the daemon is listening to. + + + general.server_address + + + select_multiple + true + Set the address the daemon is listening to. Empty means listen to all addresses. + + + general.allowed_hosts + + + select_multiple + true + Set the list of allowed hosts which can query this system. + + + general.dont_blame_nrpe + + checkbox + Enable to allow arguments sent to NRPE. Enabling this option is a high security risk. + + + general.allow_bash_command_substitution + + checkbox + This option determines whether or not the NRPE daemon will allow clients to specify arguments that contain bash command substitutions of the form $(...). Enabling this option is a high security risk. + + + general.command_timeout + + text + This specifies the maximum number of seconds that the NRPE daemon will allow plugins to finish executing before killing them off. + + + general.connection_timeout + + text + This specifies the maximum number of seconds that the NRPE daemon will wait for a connection to be established before exiting. + +
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 @@ + + + Services: NRPE + + ui/nrpe/* + api/nrpe/* + + + diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/Command.php b/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/Command.php new file mode 100644 index 000000000..59cc60839 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/Command.php @@ -0,0 +1,31 @@ + + 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; + +use OPNsense\Base\BaseModel; + +class Command extends BaseModel +{ +} diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/Command.xml b/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/Command.xml new file mode 100644 index 000000000..594bf0845 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/Command.xml @@ -0,0 +1,27 @@ + + //OPNsense/nrpe/command + NRPE command configuration + 0.0.1 + + + + + 1 + Y + + + + Y + /^[0-9a-z_\-]{1,32}$/ui + Only alphanumeric characters, dashes and underscores allowed. + + + Y + + + Y + + + + + diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/General.php b/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/General.php new file mode 100644 index 000000000..2090a26e2 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/General.php @@ -0,0 +1,35 @@ + + 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; + +use OPNsense\Base\BaseModel; + +class General extends BaseModel +{ +} diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/General.xml b/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/General.xml new file mode 100644 index 000000000..8f7907e74 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/General.xml @@ -0,0 +1,49 @@ + + //OPNsense/nrpe/general + NRPE configuration + 0.0.1 + + + 0 + Y + + + 5666 + Y + + + 127.0.0.1 + Y + , + Y + + + 127.0.0.1,::1 + Y + , + Y + + + 0 + Y + + + 0 + Y + + + 60 + Y + 1 + 900 + Value must be between 1 and 900. + + + 300 + Y + 1 + 900 + Value must be between 1 and 900. + + + diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/Menu/Menu.xml b/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/Menu/Menu.xml new file mode 100644 index 000000000..711b4d5a1 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/models/OPNsense/Nrpe/Menu/Menu.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/net-mgmt/nrpe3/src/opnsense/mvc/app/views/OPNsense/Nrpe/general.volt b/net-mgmt/nrpe3/src/opnsense/mvc/app/views/OPNsense/Nrpe/general.volt new file mode 100644 index 000000000..fd6e0cd3d --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/mvc/app/views/OPNsense/Nrpe/general.volt @@ -0,0 +1,120 @@ +{# + +OPNsense® is Copyright © 2014 – 2018 by Deciso B.V. +This file is Copyright © 2019 by Michael Muenz +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. + +#} + + + + +
+
+
+ {{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}} +
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + +
{{ lang._('Enabled') }}{{ lang._('Name') }}{{ lang._('Command') }}{{ lang._('Arguments') }}{{ lang._('ID') }}{{ lang._('Commands') }}
+ +
+
+
+ +

+
+
+
+ +{{ partial("layout_partials/base_dialog",['fields':formDialogEditNrpeCommand,'id':'dialogEditNrpeCommand','label':lang._('Edit Commands')])}} + + diff --git a/net-mgmt/nrpe3/src/opnsense/scripts/OPNsense/Nrpe/setup.sh b/net-mgmt/nrpe3/src/opnsense/scripts/OPNsense/Nrpe/setup.sh new file mode 100644 index 000000000..9e4ee4d70 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/scripts/OPNsense/Nrpe/setup.sh @@ -0,0 +1,2 @@ +mkdir -p /var/run/nrpe3/ +chown nagios:nagios /var/run/nrpe3/ diff --git a/net-mgmt/nrpe3/src/opnsense/service/conf/actions.d/actions_nrpe.conf b/net-mgmt/nrpe3/src/opnsense/service/conf/actions.d/actions_nrpe.conf new file mode 100644 index 000000000..9411074a8 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/service/conf/actions.d/actions_nrpe.conf @@ -0,0 +1,23 @@ +[start] +command:/usr/local/opnsense/scripts/OPNsense/Nrpe/setup.sh;/usr/local/etc/rc.d/nrpe3 start +parameters: +type:script +message:starting nrpe + +[stop] +command:/usr/local/etc/rc.d/nrpe3 stop +parameters: +type:script +message:stopping nrpe + +[restart] +command:/usr/local/opnsense/scripts/OPNsense/Nrpe/setup.sh;/usr/local/etc/rc.d/nrpe3 restart +parameters: +type:script +message:restarting nrpe + +[status] +command:/usr/local/etc/rc.d/nrpe3 status; exit 0 +parameters: +type:script_output +message:request nrpe status diff --git a/net-mgmt/nrpe3/src/opnsense/service/templates/OPNsense/Nrpe/+TARGETS b/net-mgmt/nrpe3/src/opnsense/service/templates/OPNsense/Nrpe/+TARGETS new file mode 100644 index 000000000..f0f104196 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/service/templates/OPNsense/Nrpe/+TARGETS @@ -0,0 +1,3 @@ +nrpe:/etc/rc.conf.d/nrpe3 +nrpe.cfg:/usr/local/etc/nrpe.cfg +nrpe_commands.cfg:/usr/local/etc/nrpe_commands.cfg diff --git a/net-mgmt/nrpe3/src/opnsense/service/templates/OPNsense/Nrpe/nrpe b/net-mgmt/nrpe3/src/opnsense/service/templates/OPNsense/Nrpe/nrpe new file mode 100644 index 000000000..d1afd25d2 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/service/templates/OPNsense/Nrpe/nrpe @@ -0,0 +1,5 @@ +{% if helpers.exists('OPNsense.nrpe.general.enabled') and OPNsense.nrpe.general.enabled == '1' %} +nrpe3_enable="YES" +{% else %} +nrpe3_enable="NO" +{% endif %} diff --git a/net-mgmt/nrpe3/src/opnsense/service/templates/OPNsense/Nrpe/nrpe.cfg b/net-mgmt/nrpe3/src/opnsense/service/templates/OPNsense/Nrpe/nrpe.cfg new file mode 100644 index 000000000..3a439d537 --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/service/templates/OPNsense/Nrpe/nrpe.cfg @@ -0,0 +1,19 @@ +{% if helpers.exists('OPNsense.nrpe.general.enabled') and OPNsense.nrpe.general.enabled == '1' %} + +log_facility=daemon +log_file=/var/log/nrpe.log +debug=0 +pid_file=/var/run/nrpe3/nrpe.pid +nrpe_user=nagios +nrpe_group=nagios + +server_port={{ OPNsense.nrpe.general.server_port }} +server_address={{ OPNsense.nrpe.general.server_address }} +allowed_hosts={{ OPNsense.nrpe.general.allowed_hosts }} +command_timeout={{ OPNsense.nrpe.general.command_timeout }} +connection_timeout={{ OPNsense.nrpe.general.connection_timeout }} +dont_blame_nrpe={{ OPNsense.nrpe.general.dont_blame_nrpe }} +allow_bash_command_substitution={{ OPNsense.nrpe.general.allow_bash_command_substitution }} +include=/usr/local/etc/nrpe_commands.cfg + +{% endif %} diff --git a/net-mgmt/nrpe3/src/opnsense/service/templates/OPNsense/Nrpe/nrpe_commands.cfg b/net-mgmt/nrpe3/src/opnsense/service/templates/OPNsense/Nrpe/nrpe_commands.cfg new file mode 100644 index 000000000..4161299ec --- /dev/null +++ b/net-mgmt/nrpe3/src/opnsense/service/templates/OPNsense/Nrpe/nrpe_commands.cfg @@ -0,0 +1,7 @@ +{% if helpers.exists('OPNsense.nrpe.general.enabled') and OPNsense.nrpe.general.enabled == '1' %} +{% for commands in helpers.toList('OPNsense.nrpe.command.commands.command') %} +{% if commands.enabled == '1' %} +command[{{ commands.name }}]={{ commands.nrpecommand }} {{ commands.arguments }} +{% endif %} +{% endfor %} +{% endif %}