From a50005572bfcf434787b8ed74e9bb54fb7963688 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 5 Jan 2018 22:26:39 +0100 Subject: [PATCH] */*: merge shadowsocks and node_exporter --- LICENSE | 4 +- README.md | 4 +- net/shadowsocks/Makefile | 8 ++ net/shadowsocks/pkg-descr | 10 +++ .../src/etc/inc/plugins.inc.d/shadowsocks.inc | 49 ++++++++++++ .../Shadowsocks/Api/GeneralController.php | 37 +++++++++ .../Shadowsocks/Api/ServiceController.php | 39 +++++++++ .../Shadowsocks/GeneralController.php | 38 +++++++++ .../OPNsense/Shadowsocks/forms/general.xml | 32 ++++++++ .../models/OPNsense/Shadowsocks/ACL/ACL.xml | 9 +++ .../models/OPNsense/Shadowsocks/General.php | 35 ++++++++ .../models/OPNsense/Shadowsocks/General.xml | 35 ++++++++ .../models/OPNsense/Shadowsocks/Menu/Menu.xml | 5 ++ .../views/OPNsense/Shadowsocks/general.volt | 61 ++++++++++++++ .../conf/actions.d/actions_shadowsocks.conf | 23 ++++++ .../templates/OPNsense/Shadowsocks/+TARGETS | 2 + .../OPNsense/Shadowsocks/shadowsocks.conf | 10 +++ .../OPNsense/Shadowsocks/shadowsocks_libev | 6 ++ sysutils/node_exporter/Makefile | 7 ++ sysutils/node_exporter/pkg-descr | 4 + .../etc/inc/plugins.inc.d/node_exporter.inc | 51 ++++++++++++ .../NodeExporter/Api/GeneralController.php | 37 +++++++++ .../NodeExporter/Api/ServiceController.php | 39 +++++++++ .../NodeExporter/GeneralController.php | 40 ++++++++++ .../OPNsense/NodeExporter/forms/general.xml | 80 +++++++++++++++++++ .../models/OPNsense/NodeExporter/ACL/ACL.xml | 9 +++ .../models/OPNsense/NodeExporter/General.php | 37 +++++++++ .../models/OPNsense/NodeExporter/General.xml | 66 +++++++++++++++ .../OPNsense/NodeExporter/Menu/Menu.xml | 5 ++ .../views/OPNsense/NodeExporter/general.volt | 62 ++++++++++++++ .../conf/actions.d/actions_node_exporter.conf | 23 ++++++ .../templates/OPNsense/NodeExporter/+TARGETS | 1 + .../OPNsense/NodeExporter/node_exporter | 52 ++++++++++++ 33 files changed, 917 insertions(+), 3 deletions(-) create mode 100644 net/shadowsocks/Makefile create mode 100644 net/shadowsocks/pkg-descr create mode 100644 net/shadowsocks/src/etc/inc/plugins.inc.d/shadowsocks.inc create mode 100644 net/shadowsocks/src/opnsense/mvc/app/controllers/OPNsense/Shadowsocks/Api/GeneralController.php create mode 100644 net/shadowsocks/src/opnsense/mvc/app/controllers/OPNsense/Shadowsocks/Api/ServiceController.php create mode 100644 net/shadowsocks/src/opnsense/mvc/app/controllers/OPNsense/Shadowsocks/GeneralController.php create mode 100644 net/shadowsocks/src/opnsense/mvc/app/controllers/OPNsense/Shadowsocks/forms/general.xml create mode 100644 net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/ACL/ACL.xml create mode 100644 net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/General.php create mode 100644 net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/General.xml create mode 100644 net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/Menu/Menu.xml create mode 100644 net/shadowsocks/src/opnsense/mvc/app/views/OPNsense/Shadowsocks/general.volt create mode 100644 net/shadowsocks/src/opnsense/service/conf/actions.d/actions_shadowsocks.conf create mode 100644 net/shadowsocks/src/opnsense/service/templates/OPNsense/Shadowsocks/+TARGETS create mode 100644 net/shadowsocks/src/opnsense/service/templates/OPNsense/Shadowsocks/shadowsocks.conf create mode 100644 net/shadowsocks/src/opnsense/service/templates/OPNsense/Shadowsocks/shadowsocks_libev create mode 100644 sysutils/node_exporter/Makefile create mode 100644 sysutils/node_exporter/pkg-descr create mode 100644 sysutils/node_exporter/src/etc/inc/plugins.inc.d/node_exporter.inc create mode 100644 sysutils/node_exporter/src/opnsense/mvc/app/controllers/OPNsense/NodeExporter/Api/GeneralController.php create mode 100644 sysutils/node_exporter/src/opnsense/mvc/app/controllers/OPNsense/NodeExporter/Api/ServiceController.php create mode 100644 sysutils/node_exporter/src/opnsense/mvc/app/controllers/OPNsense/NodeExporter/GeneralController.php create mode 100644 sysutils/node_exporter/src/opnsense/mvc/app/controllers/OPNsense/NodeExporter/forms/general.xml create mode 100644 sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/ACL/ACL.xml create mode 100644 sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/General.php create mode 100644 sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/General.xml create mode 100644 sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/Menu/Menu.xml create mode 100644 sysutils/node_exporter/src/opnsense/mvc/app/views/OPNsense/NodeExporter/general.volt create mode 100644 sysutils/node_exporter/src/opnsense/service/conf/actions.d/actions_node_exporter.conf create mode 100644 sysutils/node_exporter/src/opnsense/service/templates/OPNsense/NodeExporter/+TARGETS create mode 100644 sysutils/node_exporter/src/opnsense/service/templates/OPNsense/NodeExporter/node_exporter diff --git a/LICENSE b/LICENSE index 314879558..39f65e9c3 100644 --- a/LICENSE +++ b/LICENSE @@ -2,7 +2,7 @@ Copyright (c) 2015-2016 Ad Schellevis Copyright (c) 2005-2008 Bill Marquette Copyright (c) 2005-2006 Colin Smith Copyright (c) 2011 Dan Myers -Copyright (c) 2017 David Harrigan +Copyright (c) 2017-2018 David Harrigan Copyright (c) 2014-2017 Deciso B.V. Copyright (c) 2008 Donovan Schonknecht Copyright (c) 2016-2017 EURO-LOG AG @@ -16,7 +16,7 @@ Copyright (c) 2010 Jim Pingle Copyright (c) 2004-2005 Jonathan Watt Copyright (c) 2015 Jos Schellevis Copyright (c) 2003-2006 Manuel Kasper -Copyright (c) 2017 Michael Muenz +Copyright (c) 2017-2018 Michael Muenz Copyright (c) 2012 Pierre POMES Copyright (c) 2004-2012 Scott Ullrich Copyright (c) 2010 Seth Mos diff --git a/README.md b/README.md index d4c5c0f97..5ef2db87c 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ net-mgmt/zabbix-agent -- Enterprise-class open source distributed monitoring age net-mgmt/zabbix-proxy -- Zabbix Proxy enables decentralized monitoring net/arp-scan -- Get all peers connected to a local network net/freeradius -- RADIUS Authentication, Authorization and Accounting Server -net/frr -- FRR Routing Suite +net/frr -- The FRRouting Protocol Suite net/ftp-proxy -- Control ftp-proxy processes net/haproxy -- Reliable, high performance TCP/HTTP load balancer net/igmp-proxy -- IGMP-Proxy Service @@ -55,6 +55,7 @@ net/pppoe -- PPPoE server based on MPD5 net/pptp -- PPTP server based on MPD5 net/quagga -- Quagga Routing Suite net/relayd -- Relayd Load Balancer +net/shadowsocks -- Secure socks5 proxy net/siproxd -- Siproxd is a proxy daemon for the SIP protocol net/upnp -- Universal Plug and Play Service net/wol -- Wake on LAN Service @@ -68,6 +69,7 @@ security/tinc -- Tinc VPN security/tor -- The Onion Router sysutils/boot-delay -- Apply a persistent 10 second boot delay sysutils/monit -- Proactive system monitoring +sysutils/node_exporter -- Prometheus exporter for machine metrics sysutils/nut -- Network UPS Tools sysutils/smart -- SMART tools sysutils/vmware -- VMware tools diff --git a/net/shadowsocks/Makefile b/net/shadowsocks/Makefile new file mode 100644 index 000000000..f9df9fb16 --- /dev/null +++ b/net/shadowsocks/Makefile @@ -0,0 +1,8 @@ +PLUGIN_NAME= shadowsocks +PLUGIN_VERSION= 0.1 +PLUGIN_COMMENT= Secure socks5 proxy +PLUGIN_DEPENDS= shadowsocks-libev +PLUGIN_MAINTAINER= m.muenz@gmail.com +PLUGIN_DEVEL= yes + +.include "../../Mk/plugins.mk" diff --git a/net/shadowsocks/pkg-descr b/net/shadowsocks/pkg-descr new file mode 100644 index 000000000..048adba33 --- /dev/null +++ b/net/shadowsocks/pkg-descr @@ -0,0 +1,10 @@ +A secure socks5 proxy, designed to protect your Internet traffic. + +Bleeding edge techniques using Asynchronous I/O and Event-driven +programming. Secured with industry level encryption algorithm. +Flexible to support custom algorithms. Optimized for mobile device +and wireless network, without any keep-alive connections. +Totally free and open source. A worldwide community devoted to +deliver bug-free code and long-term support. + +WWW: https://shadowsocks.org/ diff --git a/net/shadowsocks/src/etc/inc/plugins.inc.d/shadowsocks.inc b/net/shadowsocks/src/etc/inc/plugins.inc.d/shadowsocks.inc new file mode 100644 index 000000000..29e537173 --- /dev/null +++ b/net/shadowsocks/src/etc/inc/plugins.inc.d/shadowsocks.inc @@ -0,0 +1,49 @@ + gettext('shadowsocks daemon'), + 'configd' => array( + 'restart' => array('shadowsocks restart'), + 'start' => array('shadowsocks start'), + 'stop' => array('shadowsocks stop'), + ), + 'name' => 'shadowsocks', + 'pidfile' => '/var/run/shadowsocks-libev.pid' + ); + } + + return $services; +} diff --git a/net/shadowsocks/src/opnsense/mvc/app/controllers/OPNsense/Shadowsocks/Api/GeneralController.php b/net/shadowsocks/src/opnsense/mvc/app/controllers/OPNsense/Shadowsocks/Api/GeneralController.php new file mode 100644 index 000000000..e18da86c7 --- /dev/null +++ b/net/shadowsocks/src/opnsense/mvc/app/controllers/OPNsense/Shadowsocks/Api/GeneralController.php @@ -0,0 +1,37 @@ +view->generalForm = $this->getForm("general"); + $this->view->pick('OPNsense/Shadowsocks/general'); + } +} diff --git a/net/shadowsocks/src/opnsense/mvc/app/controllers/OPNsense/Shadowsocks/forms/general.xml b/net/shadowsocks/src/opnsense/mvc/app/controllers/OPNsense/Shadowsocks/forms/general.xml new file mode 100644 index 000000000..532291e27 --- /dev/null +++ b/net/shadowsocks/src/opnsense/mvc/app/controllers/OPNsense/Shadowsocks/forms/general.xml @@ -0,0 +1,32 @@ +
+ + general.enabled + + checkbox + This will activate the ShadowSocks Proxy service. + + + general.serveraddress + + text + IP address or hostname of the server. + + + general.serverport + + text + Port of the server. + + + general.localport + + text + The local port of the daemon, default is fine. + + + general.password + + text + Password to authenticate against the server. + +
diff --git a/net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/ACL/ACL.xml b/net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/ACL/ACL.xml new file mode 100644 index 000000000..7ecbc84ae --- /dev/null +++ b/net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/ACL/ACL.xml @@ -0,0 +1,9 @@ + + + Services: Shadowsocks + + ui/shadowsocks/* + api/shadowsocks/* + + + diff --git a/net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/General.php b/net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/General.php new file mode 100644 index 000000000..95f295612 --- /dev/null +++ b/net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/General.php @@ -0,0 +1,35 @@ + + //OPNsense/shadowsocks/general + Shadowsocks configuration + 1.0.0 + + + 0 + Y + + + 127.0.0.1 + Y + /\S*/ + Please provide a valid hostname or IP address. + + + 8388 + Y + 1 + 65535 + Please provide a valid port number between 1 and 65535. + + + 1080 + Y + 1 + 65535 + Please provide a valid port number between 1 and 65535. + + + password + N + + + diff --git a/net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/Menu/Menu.xml b/net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/Menu/Menu.xml new file mode 100644 index 000000000..5f4abeb94 --- /dev/null +++ b/net/shadowsocks/src/opnsense/mvc/app/models/OPNsense/Shadowsocks/Menu/Menu.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/net/shadowsocks/src/opnsense/mvc/app/views/OPNsense/Shadowsocks/general.volt b/net/shadowsocks/src/opnsense/mvc/app/views/OPNsense/Shadowsocks/general.volt new file mode 100644 index 000000000..948210942 --- /dev/null +++ b/net/shadowsocks/src/opnsense/mvc/app/views/OPNsense/Shadowsocks/general.volt @@ -0,0 +1,61 @@ +{# + +OPNsense® is Copyright © 2014 – 2018 by Deciso B.V. +This file is Copyright © 2018 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'])}} +
+
+ +
+
+ + diff --git a/net/shadowsocks/src/opnsense/service/conf/actions.d/actions_shadowsocks.conf b/net/shadowsocks/src/opnsense/service/conf/actions.d/actions_shadowsocks.conf new file mode 100644 index 000000000..9037b971c --- /dev/null +++ b/net/shadowsocks/src/opnsense/service/conf/actions.d/actions_shadowsocks.conf @@ -0,0 +1,23 @@ +[start] +command:/usr/local/etc/rc.d/shadowsocks_libev start +parameters: +type:script +message:starting Shadowsocks + +[stop] +command:/usr/local/etc/rc.d/shadowsocks_libev stop +parameters: +type:script +message:stopping Shadowsocks + +[restart] +command:/usr/local/etc/rc.d/shadowsocks_libev restart +parameters: +type:script +message:restarting Shadowsocks + +[status] +command:/usr/local/etc/rc.d/shadowsocks_libev status;exit 0 +parameters: +type:script_output +message:request Shadowsocks status diff --git a/net/shadowsocks/src/opnsense/service/templates/OPNsense/Shadowsocks/+TARGETS b/net/shadowsocks/src/opnsense/service/templates/OPNsense/Shadowsocks/+TARGETS new file mode 100644 index 000000000..b1f7754b5 --- /dev/null +++ b/net/shadowsocks/src/opnsense/service/templates/OPNsense/Shadowsocks/+TARGETS @@ -0,0 +1,2 @@ +shadowsocks_libev:/etc/rc.conf.d/shadowsocks_libev +shadowsocks.conf:/usr/local/etc/shadowsocks-libev/config.json diff --git a/net/shadowsocks/src/opnsense/service/templates/OPNsense/Shadowsocks/shadowsocks.conf b/net/shadowsocks/src/opnsense/service/templates/OPNsense/Shadowsocks/shadowsocks.conf new file mode 100644 index 000000000..bbf3807bd --- /dev/null +++ b/net/shadowsocks/src/opnsense/service/templates/OPNsense/Shadowsocks/shadowsocks.conf @@ -0,0 +1,10 @@ +{% if helpers.exists('OPNsense.shadowsocks.general.enabled') and OPNsense.shadowsocks.general.enabled == '1' %} +{ + "server":"{{ OPNsense.shadowsocks.general.serveraddress }}", + "server_port":{{ OPNsense.shadowsocks.general.serverport }}, + "local_port":{{ OPNsense.shadowsocks.general.localport }}, + "password":"{{ OPNsense.shadowsocks.general.password }}", + "timeout":60, + "method":"chacha20-ietf-poly1305" +} +{% endif %} diff --git a/net/shadowsocks/src/opnsense/service/templates/OPNsense/Shadowsocks/shadowsocks_libev b/net/shadowsocks/src/opnsense/service/templates/OPNsense/Shadowsocks/shadowsocks_libev new file mode 100644 index 000000000..11dd88f35 --- /dev/null +++ b/net/shadowsocks/src/opnsense/service/templates/OPNsense/Shadowsocks/shadowsocks_libev @@ -0,0 +1,6 @@ +{% if helpers.exists('OPNsense.shadowsocks.general.enabled') and OPNsense.shadowsocks.general.enabled == '1' %} +shadowsocks_libev_enable="YES" +shadowsocks_libev_flags="" +{% else %} +shadowsocks_libev_enable="NO" +{% endif %} diff --git a/sysutils/node_exporter/Makefile b/sysutils/node_exporter/Makefile new file mode 100644 index 000000000..1d500225f --- /dev/null +++ b/sysutils/node_exporter/Makefile @@ -0,0 +1,7 @@ +PLUGIN_NAME= node_exporter +PLUGIN_VERSION= 0.1.0 +PLUGIN_COMMENT= Prometheus exporter for machine metrics +PLUGIN_DEPENDS= node_exporter +PLUGIN_MAINTAINER= dharrigan@gmail.com + +.include "../../Mk/plugins.mk" diff --git a/sysutils/node_exporter/pkg-descr b/sysutils/node_exporter/pkg-descr new file mode 100644 index 000000000..92c19ad60 --- /dev/null +++ b/sysutils/node_exporter/pkg-descr @@ -0,0 +1,4 @@ +Prometheus exporter for hardware and OS metrics exposed by *NIX kernels, +written in Go with pluggable metric collectors. + +WWW: https://github.com/prometheus/node_exporter diff --git a/sysutils/node_exporter/src/etc/inc/plugins.inc.d/node_exporter.inc b/sysutils/node_exporter/src/etc/inc/plugins.inc.d/node_exporter.inc new file mode 100644 index 000000000..7187810bf --- /dev/null +++ b/sysutils/node_exporter/src/etc/inc/plugins.inc.d/node_exporter.inc @@ -0,0 +1,51 @@ +enabled->__toString() == "0") { + return $services; + } + + $services[] = array( + 'description' => gettext('Prometheus Exporter'), + 'configd' => array( + 'restart' => array('node_exporter restart'), + 'start' => array('node_exporter start'), + 'stop' => array('node_exporter stop'), + 'status' => array('node_exporter status'), + ), + 'name' => 'node_exporter', + 'pidfile' => '/var/run/node_exporter.pid' + ); + + return $services; +} diff --git a/sysutils/node_exporter/src/opnsense/mvc/app/controllers/OPNsense/NodeExporter/Api/GeneralController.php b/sysutils/node_exporter/src/opnsense/mvc/app/controllers/OPNsense/NodeExporter/Api/GeneralController.php new file mode 100644 index 000000000..72a4e7c48 --- /dev/null +++ b/sysutils/node_exporter/src/opnsense/mvc/app/controllers/OPNsense/NodeExporter/Api/GeneralController.php @@ -0,0 +1,37 @@ +view->pick('OPNsense/NodeExporter/general'); + $this->view->generalForm = $this->getForm("general"); + } +} diff --git a/sysutils/node_exporter/src/opnsense/mvc/app/controllers/OPNsense/NodeExporter/forms/general.xml b/sysutils/node_exporter/src/opnsense/mvc/app/controllers/OPNsense/NodeExporter/forms/general.xml new file mode 100644 index 000000000..97e4196c1 --- /dev/null +++ b/sysutils/node_exporter/src/opnsense/mvc/app/controllers/OPNsense/NodeExporter/forms/general.xml @@ -0,0 +1,80 @@ +
+ + general.enabled + + checkbox + This will activate the node_exporter plugin. + + + general.listenaddress + + text + Set node_exporter's listen address. By default, node_exporter will listen on 0.0.0.0 (all interfaces). + + + general.listenport + + text + Set node_exporter's listen port. By default, node_exporter will listen on port 9100. + + + general.cpu + + checkbox + Enable the CPU collector. + + + general.exec + + checkbox + Enable the EXEC collector. + + + general.filesystem + + checkbox + Enable the FILESYSTEM collector. + + + general.loadavg + + checkbox + Enable the LOADAVG collector. + + + general.meminfo + + checkbox + Enable the MEMINFO collector. + + + general.netdev + + checkbox + Enable the NETDEV collector. + + + general.time + + checkbox + Enable the TIME collector. + + + general.devstat + + checkbox + Enable the DEVSTAT collector. + + + general.interrupts + + checkbox + Enable the INTERRUPTS collector. + + + general.ntp + + checkbox + Enable the NTP collector. + +
diff --git a/sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/ACL/ACL.xml b/sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/ACL/ACL.xml new file mode 100644 index 000000000..5333d6f20 --- /dev/null +++ b/sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/ACL/ACL.xml @@ -0,0 +1,9 @@ + + + Services: Prometheus Exporter + + ui/nodeexporter/* + api/nodeexporter/* + + + diff --git a/sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/General.php b/sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/General.php new file mode 100644 index 000000000..2873511d5 --- /dev/null +++ b/sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/General.php @@ -0,0 +1,37 @@ + + //OPNsense/NodeExporter + + node_exporter - Prometheus exporter for hardware and OS metrics. + + 0.1.0 + + + 0 + Y + + + 0.0.0.0 + Y + /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-4]|2[0-5][0-9]|[01]?[0-9][0-9]?)$/ + Please provide a valid IPv4 address. + + + 9100 + Y + 1 + 65535 + Please provide a valid port number between 1 and 65535. Port 9100 is the default. + + + 1 + N + + + 1 + N + + + 1 + N + + + 1 + N + + + 1 + N + + + 1 + N + + + + 0 + N + + + 0 + N + + + 0 + N + + + diff --git a/sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/Menu/Menu.xml b/sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/Menu/Menu.xml new file mode 100644 index 000000000..69883e12c --- /dev/null +++ b/sysutils/node_exporter/src/opnsense/mvc/app/models/OPNsense/NodeExporter/Menu/Menu.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/sysutils/node_exporter/src/opnsense/mvc/app/views/OPNsense/NodeExporter/general.volt b/sysutils/node_exporter/src/opnsense/mvc/app/views/OPNsense/NodeExporter/general.volt new file mode 100644 index 000000000..517c6b3c5 --- /dev/null +++ b/sysutils/node_exporter/src/opnsense/mvc/app/views/OPNsense/NodeExporter/general.volt @@ -0,0 +1,62 @@ +{# + +Copyright (C) 2018 David Harrigan +OPNsense® is Copyright © 2015 – 2017 by Deciso B.V. + +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/node_exporter/src/opnsense/service/conf/actions.d/actions_node_exporter.conf b/sysutils/node_exporter/src/opnsense/service/conf/actions.d/actions_node_exporter.conf new file mode 100644 index 000000000..76f960cc8 --- /dev/null +++ b/sysutils/node_exporter/src/opnsense/service/conf/actions.d/actions_node_exporter.conf @@ -0,0 +1,23 @@ +[start] +command: /usr/local/etc/rc.d/node_exporter start +parameters: +type: script +message: Start Node Exporter Service + +[stop] +command: /usr/local/etc/rc.d/node_exporter stop +parameters: +type: script +message: Stop Node Exporter Service + +[restart] +command: /usr/local/etc/rc.d/node_exporter restart +parameters: +type: script +message: Restart Node Exporter Service + +[status] +command: /usr/local/etc/rc.d/node_exporter status;exit 0 +parameters: +type: script_output +message: Request Node Exporter Status diff --git a/sysutils/node_exporter/src/opnsense/service/templates/OPNsense/NodeExporter/+TARGETS b/sysutils/node_exporter/src/opnsense/service/templates/OPNsense/NodeExporter/+TARGETS new file mode 100644 index 000000000..aac7dcbfc --- /dev/null +++ b/sysutils/node_exporter/src/opnsense/service/templates/OPNsense/NodeExporter/+TARGETS @@ -0,0 +1 @@ +node_exporter:/etc/rc.conf.d/node_exporter diff --git a/sysutils/node_exporter/src/opnsense/service/templates/OPNsense/NodeExporter/node_exporter b/sysutils/node_exporter/src/opnsense/service/templates/OPNsense/NodeExporter/node_exporter new file mode 100644 index 000000000..0e74613f4 --- /dev/null +++ b/sysutils/node_exporter/src/opnsense/service/templates/OPNsense/NodeExporter/node_exporter @@ -0,0 +1,52 @@ +# +# This file is automatically generated. Do not manually edit this file - changes *will* be lost! +# +{% if helpers.exists('OPNsense.NodeExporter.enabled') and OPNsense.NodeExporter.enabled == '1' %} + +{%- set collector = "--collector." -%} + +{%- if OPNsense.NodeExporter.cpu == '1' -%} + {%- set cpu = collector + "cpu " -%} +{%- endif -%} + +{%- if OPNsense.NodeExporter.exec == '1' -%} + {%- set exec = collector + "exec " -%} +{%- endif -%} + +{%- if OPNsense.NodeExporter.filesystem == '1' -%} + {%- set filesystem = collector + "filesystem " -%} +{%- endif -%} + +{%- if OPNsense.NodeExporter.loadavg == '1' -%} + {%- set loadavg = collector + "loadavg " -%} +{%- endif -%} + +{%- if OPNsense.NodeExporter.meminfo == '1' -%} + {%- set meminfo = collector + "meminfo " -%} +{%- endif -%} + +{%- if OPNsense.NodeExporter.netdev == '1' -%} + {%- set netdev = collector + "netdev " -%} +{%- endif -%} + +{%- if OPNsense.NodeExporter.ntp == '1' -%} + {%- set ntp = collector + "ntp " -%} +{%- endif -%} + +{%- if OPNsense.NodeExporter.time == '1' -%} + {%- set time = collector + "time " -%} +{%- endif -%} + +{%- if OPNsense.NodeExporter.devstat == '1' -%} + {%- set devstat = collector + "devstat " -%} +{%- endif -%} + +node_exporter_args="{{ cpu }}{{ exec }}{{ filesystem }}{{ loadavg }}{{ meminfo }}{{ netdev }}{{ ntp }}{{ time }}{{ devstat }}" +node_exporter_listen_address="{{ OPNsense.NodeExporter.listenaddress }}:{{ OPNsense.NodeExporter.listenport }}" +node_exporter_enable="YES" + +{%- else -%} + +node_exporter_enable="NO" + +{%- endif -%}