net-mgmt/net-snmp: new plugin (#688)

This commit is contained in:
Michael
2018-05-28 07:03:24 +02:00
committed by Franco Fichtner
parent d9322921d4
commit 38f885bae1
22 changed files with 654 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
PLUGIN_NAME= net-snmp
PLUGIN_VERSION= 0.1
PLUGIN_COMMENT= Net-SNMP is a daemon for the SNMP protocol
PLUGIN_DEPENDS= net-snmp
PLUGIN_MAINTAINER= m.muenz@gmail.com
PLUGIN_DEVEL= yes
.include "../../Mk/plugins.mk"
+8
View File
@@ -0,0 +1,8 @@
Simple Network Management Protocol (SNMP) is a widely used
protocol for monitoring the health and welfare of network
equipment (eg. routers), computer equipment and even devices
like UPSs.
Net-SNMP is a suite of applications used to implement
SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6.
WWW: http://www.net-snmp.org
@@ -0,0 +1,55 @@
<?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 netsnmp_enabled()
{
$model = new \OPNsense\Netsnmp\General();
return (string)$model->enabled == '1';
}
function netsnmp_services()
{
$services = array();
if (!netsnmp_enabled()) {
return $services;
}
$services[] = array(
'description' => gettext('Net-SNMP Daemon'),
'configd' => array(
'restart' => array('netsnmp restart'),
'start' => array('netsnmp start'),
'stop' => array('netsnmp stop'),
),
'name' => 'snmpd',
'pidfile' => '/var/run/net_snmpd.pid'
);
return $services;
}
@@ -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\Netsnmp\Api;
use OPNsense\Base\ApiMutableModelControllerBase;
class GeneralController extends ApiMutableModelControllerBase
{
static protected $internalModelClass = '\OPNsense\Netsnmp\General';
static protected $internalModelName = 'general';
}
@@ -0,0 +1,47 @@
<?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\Netsnmp\Api;
use OPNsense\Base\ApiMutableServiceControllerBase;
use OPNsense\Core\Backend;
use OPNsense\Netsnmp\General;
/**
* Class ServiceController
* @package OPNsense\Netsnmp
*/
class ServiceController extends ApiMutableServiceControllerBase
{
static protected $internalServiceClass = '\OPNsense\Netsnmp\General';
static protected $internalServiceTemplate = 'OPNsense/Netsnmp';
static protected $internalServiceEnabled = 'enabled';
static protected $internalServiceName = 'netsnmp';
}
@@ -0,0 +1,64 @@
<?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\Netsnmp\Api;
use \OPNsense\Base\ApiMutableModelControllerBase;
class UserController extends ApiMutableModelControllerBase
{
static protected $internalModelName = 'user';
static protected $internalModelClass = '\OPNsense\Netsnmp\User';
public function searchUserAction()
{
return $this->searchBase('users.user', array("enabled", "username", "password", "enckey"));
}
public function getUserAction($uuid = null)
{
$this->sessionClose();
return $this->getBase('user', 'users.user', $uuid);
}
public function addUserAction()
{
return $this->addBase('user', 'users.user');
}
public function delUserAction($uuid)
{
return $this->delBase('users.user', $uuid);
}
public function setUserAction($uuid)
{
return $this->setBase('user', 'users.user', $uuid);
}
public function toggleUserAction($uuid)
{
return $this->toggleBase('users.user', $uuid);
}
}
@@ -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\Netsnmp;
class GeneralController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->generalForm = $this->getForm("general");
$this->view->formDialogEditNetsnmpUser = $this->getForm("dialogEditNetsnmpUser");
$this->view->pick('OPNsense/Netsnmp/general');
}
}
@@ -0,0 +1,26 @@
<form>
<field>
<id>user.enabled</id>
<label>Enabled</label>
<type>checkbox</type>
<help>This will enable or disable the user account.</help>
</field>
<field>
<id>user.username</id>
<label>Username</label>
<type>text</type>
<help>Set the unique username for the user.</help>
</field>
<field>
<id>user.password</id>
<label>Password</label>
<type>text</type>
<help>Set the password for the user. Minimum is 8 characters.</help>
</field>
<field>
<id>user.enckey</id>
<label>Encryption Key</label>
<type>text</type>
<help>Set the encryption key to secure the connection between client and this host. Minimum is 8 characters.</help>
</field>
</form>
@@ -0,0 +1,26 @@
<form>
<field>
<id>general.enabled</id>
<label>Enable SNMP Service</label>
<type>checkbox</type>
<help>This will activate the snmpd service.</help>
</field>
<field>
<id>general.community</id>
<label>SNMP Community</label>
<type>text</type>
<help>Set the community string to use.</help>
</field>
<field>
<id>general.syslocation</id>
<label>SNMP Location</label>
<type>text</type>
<help>Set location where this unit is.</help>
</field>
<field>
<id>general.syscontact</id>
<label>SNMP Contact</label>
<type>text</type>
<help>Set the contact address to use.</help>
</field>
</form>
@@ -0,0 +1,9 @@
<acl>
<page-services-netsnmp>
<name>Services: Net-SNMP</name>
<patterns>
<pattern>ui/netsnmp/*</pattern>
<pattern>api/netsnmp/*</pattern>
</patterns>
</page-services-netsnmp>
</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\Netsnmp;
use OPNsense\Base\BaseModel;
class General extends BaseModel
{
}
@@ -0,0 +1,23 @@
<model>
<mount>//OPNsense/netsnmp/general</mount>
<description>Netsnmp configuration</description>
<version>1.0.0</version>
<items>
<enabled type="BooleanField">
<default>0</default>
<Required>Y</Required>
</enabled>
<community type="TextField">
<default></default>
<Required>N</Required>
</community>
<syslocation type="TextField">
<default></default>
<Required>N</Required>
</syslocation>
<syscontact type="TextField">
<default></default>
<Required>N</Required>
</syscontact>
</items>
</model>
@@ -0,0 +1,5 @@
<menu>
<Services>
<Net-SNMP cssClass="fa fa-database" url="/ui/netsnmp/general/index" />
</Services>
</menu>
@@ -0,0 +1,31 @@
<?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\Netsnmp;
use OPNsense\Base\BaseModel;
class User extends BaseModel
{
}
@@ -0,0 +1,33 @@
<model>
<mount>//OPNsense/netsnmp/user</mount>
<description>Netsnmp user configuration</description>
<version>1.0.0</version>
<items>
<users>
<user type="ArrayField">
<enabled type="BooleanField">
<default>1</default>
<Required>Y</Required>
</enabled>
<username type="TextField">
<default></default>
<Required>Y</Required>
<mask>/^([0-9a-zA-Z._\-]){1,64}$/u</mask>
<ValidationMessage>Should be a string between 1 and 64 characters. Allowed characters are 0-9a-zA-Z._-</ValidationMessage>
</username>
<password type="TextField">
<default></default>
<Required>Y</Required>
<mask>/^([0-9a-zA-Z._\-\!\$\%\/\(\)\+\#\=]){8,64}$/u</mask>
<ValidationMessage>Should be a string between 8 and 64 characters. Allowed characters are 0-9a-zA-Z._-!$%/()+#=</ValidationMessage>
</password>
<enckey type="TextField">
<default></default>
<Required>Y</Required>
<mask>/^([0-9a-zA-Z._\-\!\$\%\/\(\)\+\#\=]){8,64}$/u</mask>
<ValidationMessage>Should be a string between 8 and 64 characters. Allowed characters are 0-9a-zA-Z._-!$%/()+#=</ValidationMessage>
</enckey>
</user>
</users>
</items>
</model>
@@ -0,0 +1,126 @@
{#
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.
#}
<!-- Navigation bar -->
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<li class="active"><a data-toggle="tab" href="#general">{{ lang._('General') }}</a></li>
<li><a data-toggle="tab" href="#users">{{ lang._('SNMPv3 Users') }}</a></li>
</ul>
<div class="tab-content content-box tab-content">
<div id="general" class="tab-pane fade in active">
<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>
</div>
<div id="users" class="tab-pane fade in">
<table id="grid-users" class="table table-responsive" data-editDialog="dialogEditNetsnmpUser">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="username" data-type="string" data-visible="true">{{ lang._('Username') }}</th>
<th data-column-id="password" data-type="string" data-visible="true">{{ lang._('Password') }}</th>
<th data-column-id="enckey" data-type="string" data-visible="true">{{ lang._('Encryption Key') }}</th>
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td colspan="5"></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
</td>
</tr>
</tfoot>
</table>
<div class="col-md-12">
<hr />
<button class="btn btn-primary" id="saveAct_user" type="button"><b>{{ lang._('Save') }}</b><i id="saveAct_user_progress"></i></button>
<br /><br />
</div>
</div>
</div>
{{ partial("layout_partials/base_dialog",['fields':formDialogEditNetsnmpUser,'id':'dialogEditNetsnmpUser','label':lang._('Edit User')])}}
<script>
$( document ).ready(function() {
var data_get_map = {'frm_general_settings':"/api/netsnmp/general/get"};
mapDataToFormUI(data_get_map).done(function(data){
formatTokenizersUI();
$('.selectpicker').selectpicker('refresh');
});
ajaxCall(url="/api/netsnmp/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
$("#grid-users").UIBootgrid(
{ 'search':'/api/netsnmp/user/searchUser',
'get':'/api/netsnmp/user/getUser/',
'set':'/api/netsnmp/user/setUser/',
'add':'/api/netsnmp/user/addUser/',
'del':'/api/netsnmp/user/delUser/',
'toggle':'/api/netsnmp/user/toggleUser/'
}
);
$("#saveAct").click(function(){
saveFormToEndpoint(url="/api/netsnmp/general/set", formid='frm_general_settings',callback_ok=function(){
$("#saveAct_progress").addClass("fa fa-spinner fa-pulse");
ajaxCall(url="/api/netsnmp/service/reconfigure", sendData={}, callback=function(data,status) {
ajaxCall(url="/api/netsnmp/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
$("#saveAct_progress").removeClass("fa fa-spinner fa-pulse");
});
});
});
$("#saveAct_user").click(function(){
saveFormToEndpoint(url="/api/netsnmp/user/set", formid='frm_general_settings',callback_ok=function(){
$("#saveAct_user_progress").addClass("fa fa-spinner fa-pulse");
ajaxCall(url="/api/netsnmp/service/reconfigure", sendData={}, callback=function(data,status) {
ajaxCall(url="/api/netsnmp/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
$("#saveAct_user_progress").removeClass("fa fa-spinner fa-pulse");
});
});
});
});
</script>
@@ -0,0 +1,9 @@
#!/bin/sh
mkdir -p /var/net-snmp
chown -R root:wheel /var/net-snmp
chmod 755 /var/net-snmp
mkdir -p /var/net-snmp/mib_indexes
chown -R root:wheel /var/mib_indexes
chmod 700 /var/net-snmp/mib_indexes
@@ -0,0 +1,24 @@
[start]
command:/usr/local/opnsense/scripts/OPNsense/Netsnmp/setup.sh;/usr/local/etc/rc.d/snmpd start
parameters:
type:script
message:starting Net-SNMP
[stop]
command:/usr/local/etc/rc.d/snmpd stop; exit 0
parameters:
type:script
message:stopping Net-SNMP
[restart]
command:/usr/local/opnsense/scripts/OPNsense/Netsnmp/setup.sh;/usr/local/etc/rc.d/snmpd restart
parameters:
type:script
message:restarting Net-SNMP
[status]
command:/usr/local/etc/rc.d/snmpd status;exit 0
parameters:
type:script_output
message:request Net-SNMP status
@@ -0,0 +1,3 @@
snmpd:/etc/rc.conf.d/snmpd
snmpd_usercredentials.conf:/var/net-snmp/snmpd.conf
snmpd.conf:/usr/local/share/snmp/snmpd.conf
@@ -0,0 +1,6 @@
{% if helpers.exists('OPNsense.netsnmp.general.enabled') and OPNsense.netsnmp.general.enabled == '1' %}
snmpd_var_script="/usr/local/opnsense/scripts/OPNsense/Netsnmp/setup.sh"
snmpd_enable="YES"
{% else %}
snmpd_enable="NO"
{% endif %}

Some files were not shown because too many files have changed in this diff Show More