2013-11-04 Get SNMP(v3) working on Ubuntu 12.04
I am running an Ubuntu 12.04 as working environment on my local machine. Ubuntu 12.04 is latest LTS (Long Term Support) version so that it's a good choice for a server. I need to install SNMP on my machine recently and I install it by following command
1
sudo apt-get install snmpd snmp
Copied!
However it seems doesn't work. After checking the system log, I found the following errors in /var/log/syslog
1
snmpd[8461]: /etc/snmp/snmpd.conf: line 90: Error: Already have an entry for this process.
2
snmpd[8461]: /etc/snmp/snmpd.conf: line 92: Error: Already have an entry for this process.
3
snmpd[8461]: /etc/snmp/snmpd.conf: line 94: Error: Already have an entry for this process.
4
snmpd[8461]: /etc/snmp/snmpd.conf: line 106: Error: includeAllDisks already specified.
5
snmpd[8461]: /etc/snmp/snmpd.conf: line 106: Error: #011ignoring: includeAllDisks 10%
6
snmpd[8461]: error on subcontainer '' insert (-1)
7
snmpd[8461]: error on subcontainer '' insert (-1)
8
snmpd[8461]: /etc/snmp/snmpd.conf: line 146: Error: duplicate trigger name
9
snmpd[8461]: error on subcontainer '' insert (-1)
10
snmpd[8461]: error on subcontainer '' insert (-1)
11
snmpd[8461]: /etc/snmp/snmpd.conf: line 146: Error: duplicate trigger name
12
snmpd[8461]: error on subcontainer '' insert (-1)
13
snmpd[8461]: error on subcontainer '' insert (-1)
14
snmpd[8461]: /etc/snmp/snmpd.conf: line 146: Error: duplicate trigger name
15
snmpd[8461]: error on subcontainer '' insert (-1)
16
snmpd[8461]: error on subcontainer '' insert (-1)
17
snmpd[8461]: /etc/snmp/snmpd.conf: line 146: Error: duplicate trigger name
18
snmpd[8461]: error on subcontainer '' insert (-1)
19
snmpd[8461]: error on subcontainer '' insert (-1)
20
snmpd[8461]: /etc/snmp/snmpd.conf: line 146: Error: duplicate trigger name
21
snmpd[8461]: error on subcontainer '' insert (-1)
22
snmpd[8461]: error on subcontainer '' insert (-1)
23
snmpd[8461]: /etc/snmp/snmpd.conf: line 146: Error: duplicate trigger name
24
snmpd[8461]: error on subcontainer '' insert (-1)
25
snmpd[8461]: /etc/snmp/snmpd.conf: line 146: Error: duplicate trigger name
26
snmpd[8461]: /etc/snmp/snmpd.conf: line 148: Error: duplicate trigger name
27
snmpd[8461]: /etc/snmp/snmpd.conf: line 148: Error: duplicate trigger name
28
snmpd[8461]: duplicate table data attempted to be entered. row exists
29
snmpd[8461]: Failed to register extend entry 'test1' - possibly duplicate name.
30
snmpd[8461]: duplicate table data attempted to be entered. row exists
31
snmpd[8461]: Failed to register extend entry 'test2' - possibly duplicate name.
32
snmpd[8461]: Turning on AgentX master support.
33
snmpd[8461]: Error opening specified endpoint "udp:127.0.0.1:161"
34
snmpd[8461]: Server Exiting with code 1
Copied!
The content of /etc/snmp/snmpd.conf is like
1
89 # At least one 'mountd' process
2
90 proc mountd
3
91 # No more than 4 'ntalkd' processes - 0 is OK
4
92 proc ntalkd 4
5
93 # At least one 'sendmail' process, but no more than 10
6
94 proc sendmail 10 1
7
95
8
96 # Walk the UCD-SNMP-MIB::prTable to see the resulting output
9
97 # Note that this table will be empty if there are no "proc" entries in the snmpd.conf file
10
98
11
99
12
100 #
13
101 # Disk Monitoring
14
102 #
15
103 # 10MBs required on root disk, 5% free on /var, 10% free on all other disks
16
104 disk / 10000
17
105 disk /var 5%
18
106 includeAllDisks 10%
19
20
145 # generate traps on UCD error conditions
21
146 defaultMonitors yes
22
147 # generate traps on linkUp/Down
23
148 linkUpDownNotifications yes
24
149
25
150
Copied!
So let's fix the problem. I comment the snmpd.conf configurations appeared in syslog, then use command cat /etc/snmp/snmpd.conf | grep -v '#' | grep -v '^\s*#x27; to get a clean version.
1
view systemonly included .1.3.6.1.2.1.1
2
view systemonly included .1.3.6.1.2.1.25.1
3
rocommunity public default -V systemonly
4
rouser authOnlyUser
5
sysLocation Sitting on the Dock of the Bay
6
sysContact Me <[email protected]>
7
sysServices 72
8
disk / 10000
9
disk /var 5%
10
load 12 10 5
11
trapsink localhost public
12
iquerySecName internalUser
13
rouser internalUser
14
master agentx
15
createUser testuser MD5 "testpasswd"
16
rouser testuser auth
Copied!
After updated /etc/snmpd/snmpd.conf and /etc/init.d/snmpd restart, now it's working.
1
$ snmpwalk -v 3 -l authNoPriv -a MD5 -u testuser -A testpasswd 127.0.0.1:161 sysDescr
2
SNMPv2-MIB::sysDescr.0 = STRING: Linux simon-desktop 3.9.3-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64
Copied!
BTW, The i3 is the best tiling window manager I have ever used.
最近更新 1yr ago
复制链接