在snmpd.conf中采用disk关键字来监控系统运行的进程,格式如下: disk PATH [MIN=100000]

PATH: mount path to the disk in question.

MIN: Disks with space below this value will have the Mib's errorFlag set.

     Default value = 100000(100megs).

代理将监视指定文件系统,并判断其可用总磁盘空间是否小于minumum,默认的minumum为100Mb minumum值可是设置为百分比,例如30%.

配置示例: 在配置文件中添加:www.it165.net disk / 10000000 #监控/,预设最小可用空间为10G; disk /boot 30% #监控/boot,预设最小可用空间为30%; disk /dev/shm #监控/dev/shm,不预设最小可用空间; (注:只是监控mount点,不是目录,可以用df查看mount点) MIB包含df命令所包含的所有信息 具体的OID为: root(.)->iso(1)->org(3)->dod(6)->internet(1)->private(4)->enterprises(1)->ucdavis(2021)->9 也就是:.1.3.6.1.4.1.2021.9

snmpwalk -v2c -cpublic 192.168.1.21 1.3.6.1.4.1.2021.9

UCD-SNMP-MIB::dskIndex.1 = INTEGER: 1 #监控的mount点索引ID UCD-SNMP-MIB::dskIndex.2 = INTEGER: 2 UCD-SNMP-MIB::dskIndex.3 = INTEGER: 3 UCD-SNMP-MIB::dskPath.1 = STRING: / #监控的mount点 UCD-SNMP-MIB::dskPath.2 = STRING: /boot UCD-SNMP-MIB::dskPath.3 = STRING: /dev/shm
UCD-SNMP-MIB::dskDevice.1 = STRING: /dev/mapper/vg_centos60a-lv_root #监控mount点的文件系统 UCD-SNMP-MIB::dskDevice.2 = STRING: /dev/sda1 UCD-SNMP-MIB::dskDevice.3 = STRING: tmpfs UCD-SNMP-MIB::dskMinimum.1 = INTEGER: 10000000 #预设的最少可空间值,如没有设置默认为100M,如设置的为百分比,则为-1; UCD-SNMP-MIB::dskMinimum.2 = INTEGER: -1 UCD-SNMP-MIB::dskMinimum.3 = INTEGER: 100000 UCD-SNMP-MIB::dskMinPercent.1 = INTEGER: -1 #预设的最少可空间值,如设置的为实际值,则为-1; UCD-SNMP-MIB::dskMinPercent.2 = INTEGER: 30 UCD-SNMP-MIB::dskMinPercent.3 = INTEGER: -1 UCD-SNMP-MIB::dskTotal.1 = INTEGER: 10845100 #总空间 UCD-SNMP-MIB::dskTotal.2 = INTEGER: 495844 UCD-SNMP-MIB::dskTotal.3 = INTEGER: 255784 UCD-SNMP-MIB::dskAvail.1 = INTEGER: 9581368 #可用空间 UCD-SNMP-MIB::dskAvail.2 = INTEGER: 442608 UCD-SNMP-MIB::dskAvail.3 = INTEGER: 255784 UCD-SNMP-MIB::dskUsed.1 = INTEGER: 712820 #已用空间
UCD-SNMP-MIB::dskUsed.2 = INTEGER: 27636 UCD-SNMP-MIB::dskUsed.3 = INTEGER: 0 UCD-SNMP-MIB::dskPercent.1 = INTEGER: 7 #已用空间百分比 UCD-SNMP-MIB::dskPercent.2 = INTEGER: 6 UCD-SNMP-MIB::dskPercent.3 = INTEGER: 0 UCD-SNMP-MIB::dskPercentNode.1 = INTEGER: 3 #node已用百分比 UCD-SNMP-MIB::dskPercentNode.2 = INTEGER: 0 UCD-SNMP-MIB::dskPercentNode.3 = INTEGER: 0 UCD-SNMP-MIB::dskTotalLow.1 = Gauge32: 10845100 #可设置可用空间预设值(与dskTotal相当,但不一定完全相等) UCD-SNMP-MIB::dskTotalLow.2 = Gauge32: 495844 UCD-SNMP-MIB::dskTotalLow.3 = Gauge32: 255784 UCD-SNMP-MIB::dskTotalHigh.1 = Gauge32: 0
UCD-SNMP-MIB::dskTotalHigh.2 = Gauge32: 0 UCD-SNMP-MIB::dskTotalHigh.3 = Gauge32: 0 UCD-SNMP-MIB::dskAvailLow.1 = Gauge32: 9581368 #还可分配空间(与dskAvail相当,但不一定完全相等) UCD-SNMP-MIB::dskAvailLow.2 = Gauge32: 442608 UCD-SNMP-MIB::dskAvailLow.3 = Gauge32: 255784 UCD-SNMP-MIB::dskAvailHigh.1 = Gauge32: 0 UCD-SNMP-MIB::dskAvailHigh.2 = Gauge32: 0 UCD-SNMP-MIB::dskAvailHigh.3 = Gauge32: 0 UCD-SNMP-MIB::dskUsedLow.1 = Gauge32: 712820 #已用分配空间(与dskUsed相当,但不一定完全相等) UCD-SNMP-MIB::dskUsedLow.2 = Gauge32: 27636 UCD-SNMP-MIB::dskUsedLow.3 = Gauge32: 0 UCD-SNMP-MIB::dskUsedHigh.1 = Gauge32: 0 UCD-SNMP-MIB::dskUsedHigh.2 = Gauge32: 0 UCD-SNMP-MIB::dskUsedHigh.3 = Gauge32: 0 UCD-SNMP-MIB::dskErrorFlag.1 = INTEGER: error(1) //是否超出了预设范围 UCD-SNMP-MIB::dskErrorFlag.2 = INTEGER: noError(0) UCD-SNMP-MIB::dskErrorFlag.3 = INTEGER: noError(0) UCD-SNMP-MIB::dskErrorMsg.1 = STRING: /: less than 10000000 free (= 9581368) //出错信息 UCD-SNMP-MIB::dskErrorMsg.2 = STRING: UCD-SNMP-MIB::dskErrorMsg.3 = STRING: