如何使用snmp获取UCD-SNMP-MIB :: dskTotalLow值

时间:2014-01-23 06:50:05

标签: snmp

我的snmp版本是5.7.2,我在ubuntu上安装后尝试获取这样的磁盘空间:

cloud@cloud:~/snmp/net-snmp-5.7.2$ snmpwalk -v 2c -c public 10.0.0.125 .1.3.6.1.4.1.2021.9.1.11
UCD-SNMP-MIB::dskTotalLow = No Such Object available on this agent at this OID

当我更改了mib,然后按如下方式得到正确的答案:

cloud@cloud:~/snmp/net-snmp-5.7.2$ snmpwalk -v 2c -c public 10.0.0.125 .1.3.6.1.4.1.2021.9.1.6
UCD-SNMP-MIB::dskTotal.1 = INTEGER: 14332332
UCD-SNMP-MIB::dskTotal.2 = INTEGER: 0
UCD-SNMP-MIB::dskTotal.3 = INTEGER: 0
UCD-SNMP-MIB::dskTotal.4 = INTEGER: 0
UCD-SNMP-MIB::dskTotal.5 = INTEGER: 0
UCD-SNMP-MIB::dskTotal.6 = INTEGER: 0
UCD-SNMP-MIB::dskTotal.7 = INTEGER: 500708
UCD-SNMP-MIB::dskTotal.8 = INTEGER: 0
UCD-SNMP-MIB::dskTotal.9 = INTEGER: 203908
UCD-SNMP-MIB::dskTotal.10 = INTEGER: 5120
UCD-SNMP-MIB::dskTotal.11 = INTEGER: 509768
UCD-SNMP-MIB::dskTotal.12 = INTEGER: 233191

现在,请给我一些建议来获取dskTotalLow值,以解决大磁盘空间的错误值,非常感谢。

1 个答案:

答案 0 :(得分:0)

检查有关磁盘使用情况监控的snmpd.conf设置。这是“man snmpd.conf”的摘录。

  Disk Usage Monitoring
   This requires that the agent was built with support for the ucd-snmp/disk module (which is included as part of the default build con-
   figuration).

   disk PATH [ MINSPACE | MINPERCENT% ]
          monitors the disk mounted at PATH for available disk space.

          The  minimum  threshold  can either be specified in kB (MINSPACE) or as a percentage of the total disk (MINPERCENT% with a ’%’
          character), defaulting to 100kB if neither are specified.  If the free disk space falls below this threshold, then the  corre-
          sponding dskErrorFlag instance will be set to 1, and a suitable description message reported via the dskErrorMsg instance.

          Note:  This situation will not automatically trigger a trap to report the problem - see the DisMan Event MIB section later.

   includeAllDisks MINPERCENT%
          configures  monitoring  of all disks found on the system, using the specified (percentage) threshold.  The threshold for indi-
          vidual disks can be adjusted using suitable disk directives (which can come either before or after the includeAllDisks  direc-
          tive).

          Note:  Whether disk directives appears before or after includeAllDisks may affect the indexing of the dskTable.

          Only one includeAllDisks directive should be specified - any subsequent copies will be ignored.

          The  list  of  mounted disks will be determined when the agent starts using the setmntent(3) and getmntent(3), or fopen(3) and
          getmntent(3),  or setfsent(3)  and  getfsent(3) system calls. If none of the above system calls are available  then  the  root
          partition   "/"  (which   is  assumed to exist on any UNIX based system) will be monitored.  Disks mounted after the agent has
          started will not be monitored.

   If neither any disk directives or includeAllDisks are defined, then walking the dskTable will fail (noSuchObject).