Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1742750
  • 博文数量: 297
  • 博客积分: 285
  • 博客等级: 二等列兵
  • 技术积分: 3006
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-06 22:04
个人简介

Linuxer, ex IBMer. GNU https://hmchzb19.github.io/

文章分类

全部博文(297)

文章存档

2020年(11)

2019年(15)

2018年(43)

2017年(79)

2016年(79)

2015年(58)

2014年(1)

2013年(8)

2012年(3)

分类: 系统运维

2016-09-06 22:02:06

1. 需要安装下面的这些包

点击(此处)折叠或打开

  1. apt-get install snmp snmp-mibs-downloader snmpd
2. 

点击(此处)折叠或打开

  1. vim /etc/snmp/snmp.conf
  2. 注释掉mibs这一行
  3. #mibs :
  4. vim /etc/default/snmpd
  5. 注释掉export MIBS=
  6. #export MIBS=
  7. vim /etc/snmp/snmpd.conf
  8. 反注释下面这行#rocommunity public  localhost
  9. rocommunity public  localhost
  10. #注释说的很清楚:#  Full access from the local host
3. 

点击(此处)折叠或打开

  1. download-mibs
4. 启动snmpd , netstat -unlp 能看到161 端口已经有了监听

点击(此处)折叠或打开

  1. /etc/init.d/snmpd start
  2. netstat -unlp |grep 161
5. 来尝试跑些命令,奇怪两个冒号和一个冒号得到的结果都一样。

点击(此处)折叠或打开

  1. snmpwalk -IR -v2c -c public 127.0.0.1 IF-MIB::ifDescr
  2. snmpwalk -IR -v2c -c public 127.0.0.1 IF-MIB:ifIndex
  3. snmpwalk -IR -v2c -c public 127.0.0.1 IF-MIB:ifNumber
  4. snmpwalk -IR -v2c -c public 127.0.0.1 IF-MIB:ifTable
  5. snmpget -v2c -c public localhost sysContact.0
再来几个snmptranslate.

点击(此处)折叠或打开

  1. #snmptranslate -IR ifInOctets
  2. IF-MIB::ifInOctets
  3. #snmptranslate -IR -Of ifInOctets output fully qualified format
  4. .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets
  5. #snmptranslate -IR -Os ifInOctets output short, unqualified format
  6. ifInOctets
  7. #snmptranslate -IR -OS ifInOctets output short format with containing MIB
  8. IF-MIB::ifInOctets
  9. #snmptranslate -IR -On ifInOctets output numeric, fully-qualified format
  10. .1.3.6.1.2.1.2.2.1.10
6. 参考资料:

http://blog.haohtml.com/archives/4913
阅读(2206) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~