-
snmpd:snmp服务端软件
-
snmp:snmp客户端软件
-
snmp-mibs-downloader:用来下载更新本地mib库的软件
1
|
ubuntu@leaf:~$
sudo
apt-get
install
snmpd snmp snmp-mibs-downloader
|
1
2
|
ubuntu@leaf:
/usr/share/mibs
$
ls
iana ietf
|
1
|
ubuntu@leaf:~$
sudo
download-mibs
|
1
2
|
ubuntu@leaf:~$
sudo
service snmpd status
* snmpd is running
|
1
2
|
ubuntu@leaf:~$ snmpwalk
-
v
2c
-
c public localhost
1.3
.
6.1
.
2.1
.
1.1
iso.
3.6
.
1.2
.
1.1
.
1.0
=
STRING:
"Linux leaf 4.2.0-34-generic #39-Ubuntu SMP Thu Mar 10 22:13:01 UTC 2016 x86_64"
|
1
2
3
4
|
ubuntu@leaf:~$
cd
/etc/snmp
ubuntu@leaf:
/etc/snmp
$
sudo
cp
snmpd.conf snmpd.conf.ori
ubuntu@leaf:
/etc/snmp
$
ls
snmpd*
snmpd.conf snmpd.conf.ori
|
1
2
|
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
|
1
|
view systemonly included .1
|
1
2
3
|
ubuntu@leaf:
/etc/snmp
$
sudo
service snmpd restart
xpleaf@leaf:
/etc/snmp
$ snmpwalk -
v
2c -c public localhost .1.3.6.1.4.1.2021.4.3.0
iso.3.6.1.4.1.2021.4.3.0 = INTEGER: 1950716
|
1
|
mibs :
|
1
2
3
|
ubuntu@leaf:
/etc/snmp
$
sudo
service snmpd restart
ubuntu@leaf:
/etc/snmp
$ snmpwalk -
v
2c -c public localhost .1.3.6.1.4.1.2021.4.3.0
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 1950716 kB
|
1
2
3
4
|
ubuntu@leaf:
/etc/snmp
$ snmpwalk -
v
2c -c public localhost memTotalSwap.0
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 1950716 kB
ubuntu@leaf:
/etc/snmp
$ snmpwalk -
v
2c -c public localhost memTotalReal.0
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 8093524 kB
|
1
2
|
rocommunity public default -V systemonly
rocommunity6 public default -V systemonly
|
1
2
|
rocommunity xpleaf123 default -V systemonly
rocommunity6 xpleaf123 default -V systemonly
|
1
2
3
4
|
ubuntu@leaf:
/etc/snmp
$ snmpwalk -
v
2c -c public localhost memTotalReal.0
Timeout: No Response from localhost
ubuntu@leaf:
/etc/snmp
$ snmpwalk -
v
2c -c xpleaf123 localhost memTotalReal.0
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 8093524 kB
|
1
2
|
ubuntu@leaf:
/etc/snmp
$
sudo
netstat
-antup |
grep
161
udp 0 0 127.0.0.1:161 0.0.0.0:* 11615
/snmpd
|
1
|
agentAddress udp:127.0.0.1:161
|
1
|
#agentAddress udp:161,udp6:[::1]:161
|
1
2
3
|
ubuntu@leaf:
/etc/snmp
$
sudo
netstat
-antup |
grep
161
udp 0 0 0.0.0.0:161 0.0.0.0:* 11656
/snmpd
udp6 0 0 ::1:161 :::* 11656
/snmpd
|
1
2
3
4
|
ubuntu@leaf:~$
sudo
service snmpd start
ubuntu@leaf:~$
sudo
netstat
-antup |
grep
161
udp 0 0 0.0.0.0:161 0.0.0.0:* 11656
/snmpd
udp6 0 0 ::1:161 :::* 11656
/snmpd
|
1
2
3
4
5
6
|
xpleaf@leaf:~$ snmpwalk -
v
2c -c xpleaf123 115.159.*.* memTotalSwap.0
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 1950716 kB
xpleaf@leaf:~$ snmpwalk -
v
2c -c xpleaf123 115.159.*.* memTotalReal.0
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 8093524 kB
xpleaf@leaf:~$ snmpwalk -
v
2c -c xpleaf123 115.159.*.* .1.3.6.1.4.1.2021.9.1.6.1
UCD-SNMP-MIB::dskTotal.1 = INTEGER: 8123832
|