Merge pull request #2280 from Celedhrim/net_snmp_better_config

[Net-snmp] Improve addon configuration options
This commit is contained in:
Christian Hewitt 2017-12-01 23:04:37 +04:00 committed by GitHub
commit 7ab73457b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 8 deletions

View File

@ -1,3 +1,8 @@
105
- Improve configuration screen
- Make snmpv3 work again (missing include)
- Expose cputemp and/or gputemp with extends optionnaly
104
- Change daemon startup option

View File

@ -19,7 +19,7 @@
PKG_NAME="net-snmp"
PKG_VERSION="5.7.3"
PKG_SHA256="12ef89613c7707dc96d13335f153c1921efc9d61d3708ef09f3fc4a7014fb4f0"
PKG_REV="104"
PKG_REV="105"
PKG_ARCH="any"
PKG_LICENSE="BSD"
PKG_SITE="http://www.net-snmp.org"

View File

@ -45,6 +45,8 @@ def writeconfig():
location = __addon__.getSetting("LOCATION")
contact = __addon__.getSetting("CONTACT")
snmpversion = __addon__.getSetting("SNMPVERSION")
cputemp = __addon__.getSetting("CPUTEMP")
gputemp = __addon__.getSetting("GPUTEMP")
if xbmcvfs.exists(persistent):
xbmcvfs.delete(persistent)
@ -57,13 +59,20 @@ def writeconfig():
file.write('syslocation {}\n'.format(location))
file.write('syscontact {}\n'.format(contact))
file.write('dontLogTCPWrappersConnects yes\n')
file.close()
if cputemp == "true":
file.write('extend cputemp "/usr/bin/cputemp"\n')
if gputemp == "true":
file.write('extend gputemp "/usr/bin/gputemp"\n')
if snmpversion == "v3":
file.write('includeFile ../../snmpd.conf\n')
snmppassword = __addon__.getSetting("SNMPPASSWORD")
snmpuser = __addon__.getSetting("SNMPUSER")
system("net-snmp-config --create-snmpv3-user -a {0} {1}".format(snmppassword,snmpuser))
system("net-snmp-config --create-snmpv3-user -a MD5 -A {0} {1}".format(snmppassword,snmpuser))
file.close()
system("systemctl start service.net-snmp.service")

View File

@ -8,4 +8,8 @@
<string id="32004">SNMP Version</string>
<string id="32005">SNMP User</string>
<string id="32006">SNMP Password</string>
<string id="32007">v3 account</string>
<string id="32008">Extends</string>
<string id="32009">Expose cputemp</string>
<string id="32010">Expose gputemp</string>
</strings>

View File

@ -6,7 +6,11 @@
<setting label="32002" id="LOCATION" type="text" default="HOME"/>
<setting label="32003" id="CONTACT" type="text" default="root@localhost"/>
<setting label="32004" id="SNMPVERSION" type="labelenum" values="v1|v2c|v3" default="v2c"/>
<setting label="32007" type="lsep"/>
<setting label="32005" id="SNMPUSER" type="text" default="user"/>
<setting label="32006" id="SNMPPASSWORD" type="text" default="password"/>
<setting label="32008" type="lsep"/>
<setting label="32009" type="bool" id="CPUTEMP" default="true"/>
<setting label="32010" type="bool" id="GPUTEMP" default="false"/>
</category>
</settings>