SNMP/MIB/LOCATE/GREP/OID/SNMP V1 / V2c Error Messages

2017-05-18 13:03:10


1.Linux过滤查看系统MIB库


[root@localhost ~]# locate mib | grep snmp
/home/zhouyu/syslinux-6.04/core/lwip/src/core/snmp/mib2.c
/home/zhouyu/syslinux-6.04/core/lwip/src/core/snmp/mib_structs.c
/usr/include/net-snmp/mib_api.h


2.Linux 文件中查找
[root@localhost ~]# locate snmpconf
/usr/bin/snmpconf
/usr/share/man/man1/snmpconf.1.gz
/usr/share/snmp/snmpconf-data
/usr/share/snmp/snmpconf-data/snmp-data


[root@localhost snmpconf-data]# locate --help
Usage: locate [OPTION]... [PATTERN]...
Search for entries in a mlocate database.


  -b, --basename         match only the base name of path names
  -c, --count            only print number of found entries
  -d, --database DBPATH  use DBPATH instead of default database (which is
                         /var/lib/mlocate/mlocate.db)
  -e, --existing         only print entries for currently existing files
  -L, --follow           follow trailing symbolic links when checking file
                         existence (default)
  -h, --help             print this help
  -i, --ignore-case      ignore case distinctions when matching patterns
  -l, --limit, -n LIMIT  limit output (or counting) to LIMIT entries
  -m, --mmap             ignored, for backward compatibility
  -P, --nofollow, -H     don't follow trailing symbolic links when checking file
                         existence
  -0, --null             separate entries with NUL on output
  -S, --statistics       don't search for entries, print statistics about each
                         used database
  -q, --quiet            report no error messages about reading databases
  -r, --regexp REGEXP    search for basic regexp REGEXP instead of patterns
      --regex            patterns are extended regexps
  -s, --stdio            ignored, for backward compatibility
  -V, --version          print version information
  -w, --wholename        match whole path name (default)


locate命令用于查找文件,它比find命令的搜索速度快,它需要一个数据库,可以先运行updatedb命令生成库,目录是在  /var/lib/mlocate/mlocate.db 不同版本好像还不一样,网上有人说
是slocate.db ,当前测试系统为Red Hat Enterprise Linux Server release 6.5 (Santiago)
  
  
  
3.文件中查找关键字
解释:在/usr/share/snmp/mibs/目录下的txt文件中查找'tcp' 和connections关键字的文件
[root@localhost snmpconf-data]# grep  -i tcp /usr/share/snmp/mibs/*.txt |grep connections 
/usr/share/snmp/mibs/RFC1213-MIB.txt:            "The limit on the total number of TCP connections
  
4.查看Linux版本
[root@localhost mlocate]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.5 (Santiago)


5.解决Linux 下snmp获取信息不完整问题
[root@localhost mlocate]# vi /etc/snmp/snmpd.conf 
找到 view    systemview    included   .1.3.6.1.2.1.1 ,大约55行左右,在此行上面增加view    systemview    included   .1
保存,重启snmp服务
/etc/init.d/snmpd restart(redhat适用)
测试:
snmpwalk -v 2c -c public localhost .1.3.6.1.2.1.25.3.7.1.2
可以正常读取信息


6.查看OID是否可用
[root@localhost mlocate]# snmptranslate -To|grep -i 1.3.6.1.2.1.25.3.7.1.2
.1.3.6.1.2.1.25.3.7.1.2
能正常返回表示可用
7.SNMP V1 / V2c Error Messages

http://www.webnms.com/cagent/help/troubleshoot/c_troubleshoot_snmp.html


2017-05-18 13:03:10


1.Linux过滤查看系统MIB库


[root@localhost ~]# locate mib | grep snmp
/home/zhouyu/syslinux-6.04/core/lwip/src/core/snmp/mib2.c
/home/zhouyu/syslinux-6.04/core/lwip/src/core/snmp/mib_structs.c
/usr/include/net-snmp/mib_api.h


2.Linux 文件中查找
[root@localhost ~]# locate snmpconf
/usr/bin/snmpconf
/usr/share/man/man1/snmpconf.1.gz
/usr/share/snmp/snmpconf-data
/usr/share/snmp/snmpconf-data/snmp-data


[root@localhost snmpconf-data]# locate --help
Usage: locate [OPTION]... [PATTERN]...
Search for entries in a mlocate database.


  -b, --basename         match only the base name of path names
  -c, --count            only print number of found entries
  -d, --database DBPATH  use DBPATH instead of default database (which is
                         /var/lib/mlocate/mlocate.db)
  -e, --existing         only print entries for currently existing files
  -L, --follow           follow trailing symbolic links when checking file
                         existence (default)
  -h, --help             print this help
  -i, --ignore-case      ignore case distinctions when matching patterns
  -l, --limit, -n LIMIT  limit output (or counting) to LIMIT entries
  -m, --mmap             ignored, for backward compatibility
  -P, --nofollow, -H     don't follow trailing symbolic links when checking file
                         existence
  -0, --null             separate entries with NUL on output
  -S, --statistics       don't search for entries, print statistics about each
                         used database
  -q, --quiet            report no error messages about reading databases
  -r, --regexp REGEXP    search for basic regexp REGEXP instead of patterns
      --regex            patterns are extended regexps
  -s, --stdio            ignored, for backward compatibility
  -V, --version          print version information
  -w, --wholename        match whole path name (default)


locate命令用于查找文件,它比find命令的搜索速度快,它需要一个数据库,可以先运行updatedb命令生成库,目录是在  /var/lib/mlocate/mlocate.db 不同版本好像还不一样,网上有人说
是slocate.db ,当前测试系统为Red Hat Enterprise Linux Server release 6.5 (Santiago)
  
  
  
3.文件中查找关键字
解释:在/usr/share/snmp/mibs/目录下的txt文件中查找'tcp' 和connections关键字的文件
[root@localhost snmpconf-data]# grep  -i tcp /usr/share/snmp/mibs/*.txt |grep connections 
/usr/share/snmp/mibs/RFC1213-MIB.txt:            "The limit on the total number of TCP connections
  
4.查看Linux版本
[root@localhost mlocate]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.5 (Santiago)


5.解决Linux 下snmp获取信息不完整问题
[root@localhost mlocate]# vi /etc/snmp/snmpd.conf 
找到 view    systemview    included   .1.3.6.1.2.1.1,大约55行左右,在此行上面增加view    systemview    included   .1
保存,重启snmp服务
/etc/init.d/snmpd restart(redhat适用)
测试:
snmpwalk -v 2c -c public localhost .1.3.6.1.2.1.25.3.7.1.2
可以正常读取信息


6.查看OID是否可用
[root@localhost mlocate]# snmptranslate -To|grep -i 1.3.6.1.2.1.25.3.7.1.2
.1.3.6.1.2.1.25.3.7.1.2
能正常返回表示可用
7.SNMP V1 / V2c Error Messages
http://www.webnms.com/cagent/help/troubleshoot/c_troubleshoot_snmp.html

8.snmp获取磁盘分区

//分区列表
snmpwalk -v 2c -c public localhost .1.3.6.1.2.1.25.3.7.1.2
//分区siz
snmpwalk -v 2c -c public localhost .1.3.6.1.2.1.25.3.7.1.4



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Buty9147

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值