mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
SNMPd basic interface
This commit is contained in:
parent
a080a5477c
commit
49e0dbf9a0
4 changed files with 178 additions and 0 deletions
15
luci-app-snmpd/Makefile
Normal file
15
luci-app-snmpd/Makefile
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
LUCI_TITLE:=LuCI SNMPD Interface
|
||||||
|
LUCI_DEPENDS:=+snmpd
|
||||||
|
|
||||||
|
PKG_LICENSE:=GPLv3
|
||||||
|
|
||||||
|
include ../luci/luci.mk
|
||||||
|
|
||||||
|
# call BuildPackage - OpenWrt buildroot signature
|
8
luci-app-snmpd/luasrc/controller/snmpd.lua
Normal file
8
luci-app-snmpd/luasrc/controller/snmpd.lua
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
local ucic = luci.model.uci.cursor()
|
||||||
|
local dt = require "luci.cbi.datatypes"
|
||||||
|
module("luci.controller.snmpd", package.seeall)
|
||||||
|
|
||||||
|
function index()
|
||||||
|
entry({"admin", "network", "snmpd"}, alias("admin", "network", "snmpd", "index"), _("SNMPD"))
|
||||||
|
entry({"admin", "network", "snmpd", "index"}, cbi("snmpd"))
|
||||||
|
end
|
147
luci-app-snmpd/luasrc/model/cbi/snmpd.lua
Normal file
147
luci-app-snmpd/luasrc/model/cbi/snmpd.lua
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
-- Copyright 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||||
|
-- Licensed to the public under the Apache License 2.0.
|
||||||
|
|
||||||
|
m = Map("snmpd", translate("SNMPd"), translate("SNMPd settings interface (Beta)"))
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "snmpd", translate("General"))
|
||||||
|
s.addremove = false
|
||||||
|
|
||||||
|
enabled = s:option(Flag, "enabled", translate("Enabled"))
|
||||||
|
enabled.rmempty = false
|
||||||
|
|
||||||
|
network = s:option(Value, "network", translate("Networks"))
|
||||||
|
network.template = "cbi/network_netlist"
|
||||||
|
network.widget = "checkbox"
|
||||||
|
network.rmempty = true
|
||||||
|
network.cast = "string"
|
||||||
|
network.nocreate = true
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "com2sec", translate("com2sec"))
|
||||||
|
s.addremove = false
|
||||||
|
|
||||||
|
secname = s:option(ListValue, "secname", translate("Server"))
|
||||||
|
secname.optional = false
|
||||||
|
secname:value("ro",translate("Read-only"))
|
||||||
|
secname:value("rw",translate("Read-write"))
|
||||||
|
|
||||||
|
source = s:option(Value, "source", translate("Source"))
|
||||||
|
source.datatype = "host"
|
||||||
|
source.optional = false
|
||||||
|
source.rmempty = false
|
||||||
|
|
||||||
|
community = s:option(ListValue, "community", translate("Community"))
|
||||||
|
community.optional = false
|
||||||
|
community:value("public",translate("public"))
|
||||||
|
community:value("private",translate("private"))
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "com2sec6", translate("com2sec6"))
|
||||||
|
s.addremove = false
|
||||||
|
|
||||||
|
secname = s:option(ListValue, "secname", translate("secname"))
|
||||||
|
secname.optional = false
|
||||||
|
secname:value("ro",translate("Read-only"))
|
||||||
|
secname:value("rw",translate("Read-write"))
|
||||||
|
|
||||||
|
source = s:option(Value, "source", translate("Source"))
|
||||||
|
source.datatype = "host"
|
||||||
|
source.optional = false
|
||||||
|
source.rmempty = false
|
||||||
|
|
||||||
|
community = s:option(ListValue, "community", translate("Community"))
|
||||||
|
community.optional = false
|
||||||
|
community:value("public",translate("public"))
|
||||||
|
community:value("private",translate("private"))
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "group", translate("Group"))
|
||||||
|
s.addremove = true
|
||||||
|
s.anonymous = false
|
||||||
|
|
||||||
|
secname = s:option(ListValue, "secname", translate("secname"))
|
||||||
|
secname.optional = false
|
||||||
|
secname:value("ro",translate("Read-only"))
|
||||||
|
secname:value("rw",translate("Read-write"))
|
||||||
|
|
||||||
|
group = s:option(ListValue, "group", translate("Group"))
|
||||||
|
group.optional = false
|
||||||
|
group:value("public",translate("public"))
|
||||||
|
group:value("private",translate("private"))
|
||||||
|
|
||||||
|
version = s:option(ListValue, "version", translate("version"))
|
||||||
|
version.optional = false
|
||||||
|
version:value("v1",translate("v1"))
|
||||||
|
version:value("v2c",translate("v2c"))
|
||||||
|
version:value("usm",translate("usm"))
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "access", translate("Access"))
|
||||||
|
s.addremove = true
|
||||||
|
s.anonymous = false
|
||||||
|
|
||||||
|
group = s:option(ListValue, "group", translate("Group"))
|
||||||
|
group.optional = false
|
||||||
|
group:value("public",translate("public"))
|
||||||
|
group:value("private",translate("private"))
|
||||||
|
|
||||||
|
version = s:option(ListValue, "version", translate("version"))
|
||||||
|
version.optional = false
|
||||||
|
version:value("any",translate("any"))
|
||||||
|
version:value("v1",translate("v1"))
|
||||||
|
version:value("v2c",translate("v2c"))
|
||||||
|
version:value("usm",translate("usm"))
|
||||||
|
|
||||||
|
context = s:option(ListValue, "context", translate("Context"))
|
||||||
|
context.optional = false
|
||||||
|
context:value("none",translate("none"))
|
||||||
|
|
||||||
|
level = s:option(ListValue, "level", translate("Level"))
|
||||||
|
level.optional = false
|
||||||
|
level:value("noauth",translate("noauth"))
|
||||||
|
level:value("auth",translate("auth"))
|
||||||
|
|
||||||
|
read = s:option(ListValue, "read", translate("Read"))
|
||||||
|
read.optional = false
|
||||||
|
read:value("all",translate("all"))
|
||||||
|
read:value("none",translate("none"))
|
||||||
|
|
||||||
|
write = s:option(ListValue, "write", translate("Write"))
|
||||||
|
write.optional = false
|
||||||
|
write:value("all",translate("all"))
|
||||||
|
write:value("none",translate("none"))
|
||||||
|
|
||||||
|
notify = s:option(ListValue, "notify", translate("Notify"))
|
||||||
|
notify.optional = false
|
||||||
|
notify:value("all",translate("all"))
|
||||||
|
notify:value("none",translate("none"))
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "engineid", translate("engineid"))
|
||||||
|
s.addremove = false
|
||||||
|
s.anonymous = true
|
||||||
|
|
||||||
|
engineid = s:option(Value, "engineid", translate("engineid"))
|
||||||
|
engineidtype = s:options(ListValue, "engineidtype", translate("engineidtype"))
|
||||||
|
engineidtype:value("1",translate("IPv4"))
|
||||||
|
engineidtype:value("2",translate("IPv6"))
|
||||||
|
engineidtype:value("3",translate("MAC"))
|
||||||
|
|
||||||
|
engineidnic = s:option(Value, "engineidnic", translate("engineidnic"))
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "system", translate("System"))
|
||||||
|
s.addremove = true
|
||||||
|
s.anonymous = true
|
||||||
|
|
||||||
|
sysLocation = s:option(Value, "sysLocation", translate("Location"))
|
||||||
|
sysContact = s:option(Value, "sysContact", translate("Contact"))
|
||||||
|
sysName = s:option(Value, "sysName", translate("Name"))
|
||||||
|
sysServices = s:option(Value, "sysServices", translate("Services"))
|
||||||
|
sysDescr = s:option(Value, "sysDescr", translate("Description"))
|
||||||
|
sysObjectID = s:option(Value, "sysObjectID", translate("ObjectID"))
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "exec", translate("Exec"))
|
||||||
|
s.addremove = true
|
||||||
|
s.anonymous = true
|
||||||
|
|
||||||
|
miboid = s:option(Value, "miboid", translate("ObjectID"))
|
||||||
|
name = s:option(Value, "name", translate("Name"))
|
||||||
|
prog = s:option(Value, "prog", translate("Program"))
|
||||||
|
args = s:option(Value, "args", translate("Arguments"))
|
||||||
|
|
||||||
|
return m
|
8
luci-app-snmpd/root/etc/uci-defaults/4400-snmpd
Executable file
8
luci-app-snmpd/root/etc/uci-defaults/4400-snmpd
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
if [ "$(uci -q get snmpd.general.network)" = "" ]; then
|
||||||
|
uci -q batch <<-EOF >/dev/null
|
||||||
|
add_list snmpd.general.network=lan
|
||||||
|
set snmpd.system.sysName="OpenMPTCProuter"
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue