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



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章