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