mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
*/*: merge shadowsocks and node_exporter
This commit is contained in:
parent
f1b499afe6
commit
a50005572b
33 changed files with 917 additions and 3 deletions
4
LICENSE
4
LICENSE
|
|
@ -2,7 +2,7 @@ Copyright (c) 2015-2016 Ad Schellevis
|
|||
Copyright (c) 2005-2008 Bill Marquette <bill.marquette@gmail.com>
|
||||
Copyright (c) 2005-2006 Colin Smith <ethethlay@gmail.com>
|
||||
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 <jimp@pfsense.org>
|
|||
Copyright (c) 2004-2005 Jonathan Watt <jwatt@jwatt.org>
|
||||
Copyright (c) 2015 Jos Schellevis
|
||||
Copyright (c) 2003-2006 Manuel Kasper <mk@neon1.net>
|
||||
Copyright (c) 2017 Michael Muenz
|
||||
Copyright (c) 2017-2018 Michael Muenz
|
||||
Copyright (c) 2012 Pierre POMES <pierre.pomes@gmail.com>
|
||||
Copyright (c) 2004-2012 Scott Ullrich <sullrich@gmail.com>
|
||||
Copyright (c) 2010 Seth Mos <seth.mos@dds.nl>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
8
net/shadowsocks/Makefile
Normal file
8
net/shadowsocks/Makefile
Normal file
|
|
@ -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"
|
||||
10
net/shadowsocks/pkg-descr
Normal file
10
net/shadowsocks/pkg-descr
Normal file
|
|
@ -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/
|
||||
49
net/shadowsocks/src/etc/inc/plugins.inc.d/shadowsocks.inc
Normal file
49
net/shadowsocks/src/etc/inc/plugins.inc.d/shadowsocks.inc
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
function shadowsocks_services()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$services = array();
|
||||
|
||||
if (isset($config['OPNsense']['shadowsocks']['general']['enabled']) && $config['OPNsense']['shadowsocks']['general']['enabled'] == 1) {
|
||||
$services[] = array(
|
||||
'description' => 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;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
namespace OPNsense\Shadowsocks\Api;
|
||||
|
||||
use OPNsense\Base\ApiMutableModelControllerBase;
|
||||
|
||||
class GeneralController extends ApiMutableModelControllerBase
|
||||
{
|
||||
static protected $internalModelClass = '\OPNsense\Shadowsocks\General';
|
||||
static protected $internalModelName = 'general';
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
namespace OPNsense\Shadowsocks\Api;
|
||||
|
||||
use OPNsense\Base\ApiMutableServiceControllerBase;
|
||||
|
||||
class ServiceController extends ApiMutableServiceControllerBase
|
||||
{
|
||||
static protected $internalServiceClass = '\OPNsense\Shadowsocks\General';
|
||||
static protected $internalServiceTemplate = 'OPNsense/Shadowsocks';
|
||||
static protected $internalServiceEnabled = 'enabled';
|
||||
static protected $internalServiceName = 'shadowsocks';
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
namespace OPNsense\Shadowsocks;
|
||||
|
||||
class GeneralController extends \OPNsense\Base\IndexController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->generalForm = $this->getForm("general");
|
||||
$this->view->pick('OPNsense/Shadowsocks/general');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<form>
|
||||
<field>
|
||||
<id>general.enabled</id>
|
||||
<label>Enable ShadowSocks Proxy</label>
|
||||
<type>checkbox</type>
|
||||
<help>This will activate the ShadowSocks Proxy service.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.serveraddress</id>
|
||||
<label>Server Address</label>
|
||||
<type>text</type>
|
||||
<help>IP address or hostname of the server.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.serverport</id>
|
||||
<label>Server Port</label>
|
||||
<type>text</type>
|
||||
<help>Port of the server.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.localport</id>
|
||||
<label>Local Port</label>
|
||||
<type>text</type>
|
||||
<help>The local port of the daemon, default is fine.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.password</id>
|
||||
<label>Password</label>
|
||||
<type>text</type>
|
||||
<help>Password to authenticate against the server.</help>
|
||||
</field>
|
||||
</form>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<acl>
|
||||
<page-services-shadowsocks>
|
||||
<name>Services: Shadowsocks</name>
|
||||
<patterns>
|
||||
<pattern>ui/shadowsocks/*</pattern>
|
||||
<pattern>api/shadowsocks/*</pattern>
|
||||
</patterns>
|
||||
</page-services-shadowsocks>
|
||||
</acl>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
namespace OPNsense\Shadowsocks;
|
||||
|
||||
use OPNsense\Base\BaseModel;
|
||||
|
||||
class General extends BaseModel
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<model>
|
||||
<mount>//OPNsense/shadowsocks/general</mount>
|
||||
<description>Shadowsocks configuration</description>
|
||||
<version>1.0.0</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<serveraddress type="TextField">
|
||||
<default>127.0.0.1</default>
|
||||
<Required>Y</Required>
|
||||
<mask>/\S*/</mask>
|
||||
<ValidationMessage>Please provide a valid hostname or IP address.</ValidationMessage>
|
||||
</serveraddress>
|
||||
<serverport type="IntegerField">
|
||||
<default>8388</default>
|
||||
<Required>Y</Required>
|
||||
<MinimumValue>1</MinimumValue>
|
||||
<MaximumValue>65535</MaximumValue>
|
||||
<ValidationMessage>Please provide a valid port number between 1 and 65535.</ValidationMessage>
|
||||
</serverport>
|
||||
<localport type="IntegerField">
|
||||
<default>1080</default>
|
||||
<Required>Y</Required>
|
||||
<MinimumValue>1</MinimumValue>
|
||||
<MaximumValue>65535</MaximumValue>
|
||||
<ValidationMessage>Please provide a valid port number between 1 and 65535.</ValidationMessage>
|
||||
</localport>
|
||||
<password type="TextField">
|
||||
<default>password</default>
|
||||
<Required>N</Required>
|
||||
</password>
|
||||
</items>
|
||||
</model>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<menu>
|
||||
<Services>
|
||||
<ShadowSocks cssClass="fa fa-eye-slash" url="/ui/shadowsocks/general/index" />
|
||||
</Services>
|
||||
</menu>
|
||||
|
|
@ -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.
|
||||
|
||||
#}
|
||||
<div class="content-box" style="padding-bottom: 1.5em;">
|
||||
{{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}}
|
||||
<div class="col-md-12">
|
||||
<hr />
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b> <i id="saveAct_progress"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$( document ).ready(function() {
|
||||
var data_get_map = {'frm_general_settings':"/api/shadowsocks/general/get"};
|
||||
mapDataToFormUI(data_get_map).done(function(data){
|
||||
formatTokenizersUI();
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
});
|
||||
ajaxCall(url="/api/shadowsocks/service/status", sendData={}, callback=function(data,status) {
|
||||
updateServiceStatusUI(data['status']);
|
||||
});
|
||||
|
||||
// link save button to API set action
|
||||
$("#saveAct").click(function(){
|
||||
saveFormToEndpoint(url="/api/shadowsocks/general/set", formid='frm_general_settings',callback_ok=function(){
|
||||
$("#saveAct_progress").addClass("fa fa-spinner fa-pulse");
|
||||
ajaxCall(url="/api/shadowsocks/service/reconfigure", sendData={}, callback=function(data,status) {
|
||||
ajaxCall(url="/api/shadowsocks/service/status", sendData={}, callback=function(data,status) {
|
||||
updateServiceStatusUI(data['status']);
|
||||
});
|
||||
$("#saveAct_progress").removeClass("fa fa-spinner fa-pulse");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
shadowsocks_libev:/etc/rc.conf.d/shadowsocks_libev
|
||||
shadowsocks.conf:/usr/local/etc/shadowsocks-libev/config.json
|
||||
|
|
@ -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 %}
|
||||
|
|
@ -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 %}
|
||||
7
sysutils/node_exporter/Makefile
Normal file
7
sysutils/node_exporter/Makefile
Normal file
|
|
@ -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"
|
||||
4
sysutils/node_exporter/pkg-descr
Normal file
4
sysutils/node_exporter/pkg-descr
Normal file
|
|
@ -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
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 David Harrigan
|
||||
* 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 node_exporter_services()
|
||||
{
|
||||
$services = array();
|
||||
$mdlGeneral = new \OPNsense\NodeExporter\General();
|
||||
|
||||
if ($mdlGeneral->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;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 David Harrigan
|
||||
* 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\NodeExporter\Api;
|
||||
|
||||
use \OPNsense\Base\ApiMutableModelControllerBase;
|
||||
|
||||
class GeneralController extends ApiMutableModelControllerBase
|
||||
{
|
||||
static protected $internalModelName = 'general';
|
||||
static protected $internalModelClass = 'OPNsense\NodeExporter\General';
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 David Harrigan
|
||||
* 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\NodeExporter\Api;
|
||||
|
||||
use \OPNsense\Base\ApiMutableServiceControllerBase;
|
||||
|
||||
class ServiceController extends ApiMutableServiceControllerBase
|
||||
{
|
||||
static protected $internalServiceClass = '\OPNsense\NodeExporter\General';
|
||||
static protected $internalServiceEnabled = 'enabled';
|
||||
static protected $internalServiceTemplate = 'OPNsense/NodeExporter';
|
||||
static protected $internalServiceName = 'node_exporter';
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 David Harrigan
|
||||
* 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\NodeExporter;
|
||||
|
||||
use \OPNsense\Base\IndexController;
|
||||
|
||||
class GeneralController extends IndexController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->pick('OPNsense/NodeExporter/general');
|
||||
$this->view->generalForm = $this->getForm("general");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
<form>
|
||||
<field>
|
||||
<id>general.enabled</id>
|
||||
<label>Enabled</label>
|
||||
<type>checkbox</type>
|
||||
<help>This will activate the node_exporter plugin.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.listenaddress</id>
|
||||
<label>Listen Address</label>
|
||||
<type>text</type>
|
||||
<help>Set node_exporter's listen address. By default, node_exporter will listen on 0.0.0.0 (all interfaces).</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.listenport</id>
|
||||
<label>Listen Port</label>
|
||||
<type>text</type>
|
||||
<help>Set node_exporter's listen port. By default, node_exporter will listen on port 9100.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.cpu</id>
|
||||
<label>CPU Statistics</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable the CPU collector.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.exec</id>
|
||||
<label>Execution Statistics</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable the EXEC collector.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.filesystem</id>
|
||||
<label>Filesystem Statistics</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable the FILESYSTEM collector.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.loadavg</id>
|
||||
<label>Load Average Statistics</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable the LOADAVG collector.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.meminfo</id>
|
||||
<label>Memory Statistics</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable the MEMINFO collector.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.netdev</id>
|
||||
<label>Network Interface Statistics</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable the NETDEV collector.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.time</id>
|
||||
<label>Current Time Statistics</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable the TIME collector.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.devstat</id>
|
||||
<label>Device Statistics</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable the DEVSTAT collector.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.interrupts</id>
|
||||
<label>Interrupts Statistics</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable the INTERRUPTS collector.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.ntp</id>
|
||||
<label>NTP Statistics</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable the NTP collector.</help>
|
||||
</field>
|
||||
</form>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<acl>
|
||||
<page-services-nodeexporter>
|
||||
<name>Services: Prometheus Exporter</name>
|
||||
<patterns>
|
||||
<pattern>ui/nodeexporter/*</pattern>
|
||||
<pattern>api/nodeexporter/*</pattern>
|
||||
</patterns>
|
||||
</page-services-nodeexporter>
|
||||
</acl>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (C) 2018 David Harrigan
|
||||
* Copyright (C) 2017 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.
|
||||
*
|
||||
*/
|
||||
namespace OPNsense\NodeExporter;
|
||||
|
||||
use OPNsense\Base\BaseModel;
|
||||
|
||||
class General extends BaseModel
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<model>
|
||||
<mount>//OPNsense/NodeExporter</mount>
|
||||
<description>
|
||||
node_exporter - Prometheus exporter for hardware and OS metrics.
|
||||
</description>
|
||||
<version>0.1.0</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<listenaddress type="TextField">
|
||||
<default>0.0.0.0</default>
|
||||
<Required>Y</Required>
|
||||
<mask>/^(?:(?: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]?)$/</mask>
|
||||
<ValidationMessage>Please provide a valid IPv4 address.</ValidationMessage>
|
||||
</listenaddress>
|
||||
<listenport type="IntegerField">
|
||||
<default>9100</default>
|
||||
<Required>Y</Required>
|
||||
<MinimumValue>1</MinimumValue>
|
||||
<MaximumValue>65535</MaximumValue>
|
||||
<ValidationMessage>Please provide a valid port number between 1 and 65535. Port 9100 is the default.</ValidationMessage>
|
||||
</listenport>
|
||||
<cpu type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>N</Required>
|
||||
</cpu>
|
||||
<exec type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>N</Required>
|
||||
</exec>
|
||||
<filesystem type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>N</Required>
|
||||
</filesystem>
|
||||
<loadavg type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>N</Required>
|
||||
</loadavg>
|
||||
<meminfo type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>N</Required>
|
||||
</meminfo>
|
||||
<netdev type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>N</Required>
|
||||
</netdev>
|
||||
<time type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>N</Required>
|
||||
</time>
|
||||
<devstat type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>N</Required>
|
||||
</devstat>
|
||||
<interrupts type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>N</Required>
|
||||
</interrupts>
|
||||
<ntp type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>N</Required>
|
||||
</ntp>
|
||||
</items>
|
||||
</model>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<menu>
|
||||
<Services>
|
||||
<PrometheusExporter VisibleName="Prometheus Exporter" cssClass="fa fa-area-chart" url="/ui/nodeexporter/general/index"/>
|
||||
</Services>
|
||||
</menu>
|
||||
|
|
@ -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.
|
||||
|
||||
#}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var data_get_map = {'frm_general_settings':"/api/nodeexporter/general/get"};
|
||||
mapDataToFormUI(data_get_map).done(function(data) {
|
||||
formatTokenizersUI();
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
});
|
||||
|
||||
ajaxCall(url="/api/nodeexporter/service/status", sendData={}, callback=function(data,status) {
|
||||
updateServiceStatusUI(data['status']);
|
||||
});
|
||||
|
||||
$("#saveAct").click(function() {
|
||||
saveFormToEndpoint(url="/api/nodeexporter/general/set", formid='frm_general_settings',callback_ok=function() {
|
||||
$("#saveAct_progress").addClass("fa fa-spinner fa-pulse");
|
||||
ajaxCall(url="/api/nodeexporter/service/reconfigure", sendData={}, callback=function(data,status) {
|
||||
ajaxCall(url="/api/nodeexporter/service/status", sendData={}, callback=function(data,status) {
|
||||
updateServiceStatusUI(data['status']);
|
||||
});
|
||||
$("#saveAct_progress").removeClass("fa fa-spinner fa-pulse");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="content-box" style="padding-bottom: 1.5em;">
|
||||
{{ partial("layout_partials/base_form", ['fields':generalForm,'id':'frm_general_settings']) }}
|
||||
<div class="col-md-12">
|
||||
<hr />
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b> <i id="saveAct_progress"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1 @@
|
|||
node_exporter:/etc/rc.conf.d/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 -%}
|
||||
Loading…
Reference in a new issue