diff --git a/README.md b/README.md index 268cd96d8..4d6f0ad9b 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ misc/theme-tukan -- The tukan theme - blue/white misc/theme-vicuna -- The vicuna theme - dark anthrazit net-mgmt/collectd -- Collect system and application performance metrics periodically net-mgmt/lldpd -- LLDP allows you to know exactly on which port is a server +net-mgmt/munin -- Munin monitoring node net-mgmt/net-snmp -- Net-SNMP is a daemon for the SNMP protocol net-mgmt/netdata -- Real-time performance monitoring net-mgmt/nrpe -- Execute nagios plugins diff --git a/sysutils/munin-node/Makefile b/sysutils/munin-node/Makefile new file mode 100644 index 000000000..852ca50a2 --- /dev/null +++ b/sysutils/munin-node/Makefile @@ -0,0 +1,8 @@ +PLUGIN_NAME= munin-node +PLUGIN_VERSION= 0.1 +PLUGIN_COMMENT= munin monitorin agent +PLUGIN_DEPENDS= munin-node +PLUGIN_DEVEL= YES +PLUGIN_MAINTAINER= m.muenz@gmail.com + +.include "../../Mk/plugins.mk" diff --git a/sysutils/munin-node/pkg-descr b/sysutils/munin-node/pkg-descr new file mode 100644 index 000000000..1ac945582 --- /dev/null +++ b/sysutils/munin-node/pkg-descr @@ -0,0 +1,13 @@ +Munin network-wide graphing framework (node) + +Munin is a tool for graphing all sorts of information about one or more +servers and displaying it in a web interface. It uses the excellent +RRDTool (written by Tobi Oetiker) and is written in Perl. Munin has a +master/node architecture. The master connects to all the nodes at regular +intervals, and asks them for data. It then stores the data in RRD-files, +and (if needed) updates the graphs. One of the main goals have been ease +of creating own "plugins" (graphs). + +This is the node part. It is used on all machines Munin shall watch. + +WWW: http://munin-monitoring.org/ diff --git a/sysutils/munin-node/src/etc/inc/plugins.inc.d/muninnode.inc b/sysutils/munin-node/src/etc/inc/plugins.inc.d/muninnode.inc new file mode 100644 index 000000000..c052239b9 --- /dev/null +++ b/sysutils/munin-node/src/etc/inc/plugins.inc.d/muninnode.inc @@ -0,0 +1,49 @@ + + * 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 muninnode_services() +{ + global $config; + + $services = array(); + + if (isset($config['OPNsense']['muninnode']['general']['enabled']) && $config['OPNsense']['muninnode']['general']['enabled'] == 1) { + $services[] = array( + 'description' => gettext('muninnode daemon'), + 'configd' => array( + 'restart' => array('muninnode restart'), + 'start' => array('muninnode start'), + 'stop' => array('muninnode stop'), + ), + 'name' => 'munin_node', + 'pidfile' => '/var/run/munin/munin-node.pid' + ); + } + + return $services; +} diff --git a/sysutils/munin-node/src/opnsense/mvc/app/controllers/OPNsense/Muninnode/Api/GeneralController.php b/sysutils/munin-node/src/opnsense/mvc/app/controllers/OPNsense/Muninnode/Api/GeneralController.php new file mode 100644 index 000000000..80955a45a --- /dev/null +++ b/sysutils/munin-node/src/opnsense/mvc/app/controllers/OPNsense/Muninnode/Api/GeneralController.php @@ -0,0 +1,37 @@ + + * 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\Muninnode\Api; + +use OPNsense\Base\ApiMutableModelControllerBase; + +class GeneralController extends ApiMutableModelControllerBase +{ + protected static $internalModelClass = '\OPNsense\Muninnode\General'; + protected static $internalModelName = 'general'; +} diff --git a/sysutils/munin-node/src/opnsense/mvc/app/controllers/OPNsense/Muninnode/Api/ServiceController.php b/sysutils/munin-node/src/opnsense/mvc/app/controllers/OPNsense/Muninnode/Api/ServiceController.php new file mode 100644 index 000000000..695871a0f --- /dev/null +++ b/sysutils/munin-node/src/opnsense/mvc/app/controllers/OPNsense/Muninnode/Api/ServiceController.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\Muninnode\Api; + +use OPNsense\Base\ApiMutableServiceControllerBase; + +class ServiceController extends ApiMutableServiceControllerBase +{ + protected static $internalServiceClass = '\OPNsense\Muninnode\General'; + protected static $internalServiceTemplate = 'OPNsense/Muninnode'; + protected static $internalServiceEnabled = 'enabled'; + protected static $internalServiceName = 'muninnode'; +} diff --git a/sysutils/munin-node/src/opnsense/mvc/app/controllers/OPNsense/Muninnode/GeneralController.php b/sysutils/munin-node/src/opnsense/mvc/app/controllers/OPNsense/Muninnode/GeneralController.php new file mode 100644 index 000000000..3e25bde5e --- /dev/null +++ b/sysutils/munin-node/src/opnsense/mvc/app/controllers/OPNsense/Muninnode/GeneralController.php @@ -0,0 +1,38 @@ + + * 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\Muninnode; + +class GeneralController extends \OPNsense\Base\IndexController +{ + public function indexAction() + { + $this->view->generalForm = $this->getForm('general'); + $this->view->pick('OPNsense/Muninnode/general'); + } +} diff --git a/sysutils/munin-node/src/opnsense/mvc/app/controllers/OPNsense/Muninnode/forms/general.xml b/sysutils/munin-node/src/opnsense/mvc/app/controllers/OPNsense/Muninnode/forms/general.xml new file mode 100644 index 000000000..411938d79 --- /dev/null +++ b/sysutils/munin-node/src/opnsense/mvc/app/controllers/OPNsense/Muninnode/forms/general.xml @@ -0,0 +1,28 @@ +
+ + general.enabled + + checkbox + Enable Munin-Node daemon. + + + general.hostname + + text + Set the hostname which will indicate this system at the central munin platform. + + + general.port + + text + Set the port munin listen to. + + + general.allowednetworks + + + select_multiple + true + Set the CIDR networks allowed to contact this node. For a single host please use /32 + +
diff --git a/sysutils/munin-node/src/opnsense/mvc/app/models/OPNsense/Muninnode/ACL/ACL.xml b/sysutils/munin-node/src/opnsense/mvc/app/models/OPNsense/Muninnode/ACL/ACL.xml new file mode 100644 index 000000000..a4adcb05f --- /dev/null +++ b/sysutils/munin-node/src/opnsense/mvc/app/models/OPNsense/Muninnode/ACL/ACL.xml @@ -0,0 +1,9 @@ + + + Services: Munin-Node + + ui/muninnode/* + api/muninnode/* + + + diff --git a/sysutils/munin-node/src/opnsense/mvc/app/models/OPNsense/Muninnode/General.php b/sysutils/munin-node/src/opnsense/mvc/app/models/OPNsense/Muninnode/General.php new file mode 100644 index 000000000..385cccc11 --- /dev/null +++ b/sysutils/munin-node/src/opnsense/mvc/app/models/OPNsense/Muninnode/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\Muninnode; + +use OPNsense\Base\BaseModel; + +class General extends BaseModel +{ +} diff --git a/sysutils/munin-node/src/opnsense/mvc/app/models/OPNsense/Muninnode/General.xml b/sysutils/munin-node/src/opnsense/mvc/app/models/OPNsense/Muninnode/General.xml new file mode 100644 index 000000000..64d22bdd6 --- /dev/null +++ b/sysutils/munin-node/src/opnsense/mvc/app/models/OPNsense/Muninnode/General.xml @@ -0,0 +1,23 @@ + + //OPNsense/muninnode/general + Munin-Node configuration + 0.0.2 + + + 0 + Y + + + OPNsense + Y + + + 4949 + Y + + + + N + + + diff --git a/sysutils/munin-node/src/opnsense/mvc/app/models/OPNsense/Muninnode/Menu/Menu.xml b/sysutils/munin-node/src/opnsense/mvc/app/models/OPNsense/Muninnode/Menu/Menu.xml new file mode 100644 index 000000000..7f85a277f --- /dev/null +++ b/sysutils/munin-node/src/opnsense/mvc/app/models/OPNsense/Muninnode/Menu/Menu.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/sysutils/munin-node/src/opnsense/mvc/app/views/OPNsense/Muninnode/general.volt b/sysutils/munin-node/src/opnsense/mvc/app/views/OPNsense/Muninnode/general.volt new file mode 100644 index 000000000..375b427bd --- /dev/null +++ b/sysutils/munin-node/src/opnsense/mvc/app/views/OPNsense/Muninnode/general.volt @@ -0,0 +1,57 @@ +{# + # Copyright (c) 2019 Deciso B.V. + # Copyright (c) 2020 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'])}} +
+
+ +
+
+ + diff --git a/sysutils/munin-node/src/opnsense/scripts/OPNsense/Muninnode/setup.sh b/sysutils/munin-node/src/opnsense/scripts/OPNsense/Muninnode/setup.sh new file mode 100644 index 000000000..33dd0b832 --- /dev/null +++ b/sysutils/munin-node/src/opnsense/scripts/OPNsense/Muninnode/setup.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +mkdir -p /var/munin/plugin-state/ +mkdir -p /var/log/munin/ +mkdir -p /var/run/munin/ +chown -R munin:munin /var/munin/plugin-state/ /var/munin/ /var/log/munin/ /var/run/munin/ +chmod 755 /var/munin/plugin-state/ /var/munin/ /var/log/munin/ /var/run/munin/ + diff --git a/sysutils/munin-node/src/opnsense/service/conf/actions.d/actions_muninnode.conf b/sysutils/munin-node/src/opnsense/service/conf/actions.d/actions_muninnode.conf new file mode 100644 index 000000000..3152e2b0d --- /dev/null +++ b/sysutils/munin-node/src/opnsense/service/conf/actions.d/actions_muninnode.conf @@ -0,0 +1,23 @@ +[start] +command:/usr/local/opnsense/scripts/OPNsense/Muninnode/setup.sh;/usr/local/etc/rc.d/munin-node start +parameters: +type:script +message:starting munin-node + +[stop] +command:/usr/local/etc/rc.d/munin-node stop +parameters: +type:script +message:stopping munin-node + +[restart] +command:/usr/local/opnsense/scripts/OPNsense/Muninnode/setup.sh;/usr/local/etc/rc.d/munin-node restart +parameters: +type:script +message:restarting munin-node + +[status] +command:/usr/local/etc/rc.d/munin-node status;exit 0 +parameters: +type:script_output +message:request munin-node status diff --git a/sysutils/munin-node/src/opnsense/service/templates/OPNsense/Muninnode/+TARGETS b/sysutils/munin-node/src/opnsense/service/templates/OPNsense/Muninnode/+TARGETS new file mode 100644 index 000000000..3a3d191e1 --- /dev/null +++ b/sysutils/munin-node/src/opnsense/service/templates/OPNsense/Muninnode/+TARGETS @@ -0,0 +1,2 @@ +munin_node:/etc/rc.conf.d/munin_node +munin-node.conf:/usr/local/etc/munin/munin-node.conf diff --git a/sysutils/munin-node/src/opnsense/service/templates/OPNsense/Muninnode/munin-node.conf b/sysutils/munin-node/src/opnsense/service/templates/OPNsense/Muninnode/munin-node.conf new file mode 100644 index 000000000..d958b460e --- /dev/null +++ b/sysutils/munin-node/src/opnsense/service/templates/OPNsense/Muninnode/munin-node.conf @@ -0,0 +1,34 @@ +{% if helpers.exists('OPNsense.muninnode.general.enabled') and OPNsense.muninnode.general.enabled == '1' %} + +log_level 4 +log_file /var/log/munin/munin-node.log +pid_file /var/run/munin/munin-node.pid + +background 1 +setsid 1 + +user root +group wheel + +# Regexps for files to ignore +ignore_file [\#~]$ +ignore_file DEADJOE$ +ignore_file \.bak$ +ignore_file %$ +ignore_file \.dpkg-(tmp|new|old|dist)$ +ignore_file \.rpm(save|new)$ +ignore_file \.pod$ +ignore_file \.sample$ + +host_name {{ OPNsense.muninnode.general.hostname }} + +{% if helpers.exists('OPNsense.muninnode.general.allowednetworks') %} +{% for network in OPNsense.muninnode.general.allowednetworks.split(',') %} +cidr_allow {{ network }} +{% endfor %} +{% endif %} + +host * +port {{ OPNsense.muninnode.general.port }} + +{% endif %} diff --git a/sysutils/munin-node/src/opnsense/service/templates/OPNsense/Muninnode/munin_node b/sysutils/munin-node/src/opnsense/service/templates/OPNsense/Muninnode/munin_node new file mode 100644 index 000000000..ffcc9469a --- /dev/null +++ b/sysutils/munin-node/src/opnsense/service/templates/OPNsense/Muninnode/munin_node @@ -0,0 +1,7 @@ +{% if helpers.exists('OPNsense.muninnode.general.enabled') and OPNsense.muninnode.general.enabled == '1' %} +munin_node_var_script="/usr/local/opnsense/scripts/OPNsense/Muninnode/setup.sh" +munin_node_enable="YES" +{% else %} +munin_node_enable="NO" +{% endif %} +munin_node_var_mfs="/var/cache/munin_node /var/db/munin_node /var/log/munin_node"