Browse Source

net-snmp: add engineID config options

According to the snmpd.conf man page, the engineID of an snmp agent
should be consistent through time. However, it seems that the engineID
changes every reboot. Add options to configure how the engineID is
generated. The default setting generates it based on the MAC address of
the eth0 interface.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
lilik-openwrt-22.03
Stijn Tintel 8 years ago
parent
commit
5081551ae8
3 changed files with 18 additions and 1 deletions
  1. +1
    -1
      net/net-snmp/Makefile
  2. +4
    -0
      net/net-snmp/files/snmpd.conf
  3. +13
    -0
      net/net-snmp/files/snmpd.init

+ 1
- 1
net/net-snmp/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=net-snmp
PKG_VERSION:=5.7.3
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/net-snmp


+ 4
- 0
net/net-snmp/files/snmpd.conf View File

@ -83,3 +83,7 @@ config exec
option args /proc/sys/fs/file-nr
# option miboid 1.2.3.4
config engineid
# option engineid 'LEDE'
option engineidtype '3'
option engineidnic 'eth0'

+ 13
- 0
net/net-snmp/files/snmpd.init View File

@ -198,6 +198,18 @@ snmpd_disk_add() {
echo "$disk $partition $size" >> $CONFIGFILE
}
snmpd_engineid_add() {
local cfg="$1"
config_get engineid "$cfg" engineid
[ -n "$engineid" ] && echo "engineID $engineid" >> $CONFIGFILE
config_get engineidtype "$cfg" engineidtype
[ "$engineidtype" -ge 1 -a "$engineidtype" -le 3 ] && \
echo "engineIDType $engineidtype" >> $CONFIGFILE
config_get engineidnic "$cfg" engineidnic
[ -n "$engineidnic" ] && echo "engineIDNic $engineidnic" >> $CONFIGFILE
}
start_service() {
[ -f "$CONFIGFILE" ] && rm -f "$CONFIGFILE"
@ -221,6 +233,7 @@ start_service() {
config_foreach snmpd_pass_add pass
config_foreach snmpd_exec_add exec
config_foreach snmpd_disk_add disk
config_foreach snmpd_engineid_add engineid
procd_set_param command $PROG -Lf /dev/null -f
procd_set_param file $CONFIGFILE


Loading…
Cancel
Save