Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5375622
  • 博文数量: 1144
  • 博客积分: 11974
  • 博客等级: 上将
  • 技术积分: 12312
  • 用 户 组: 普通用户
  • 注册时间: 2005-04-13 20:06
文章存档

2017年(2)

2016年(14)

2015年(10)

2014年(28)

2013年(23)

2012年(29)

2011年(53)

2010年(86)

2009年(83)

2008年(43)

2007年(153)

2006年(575)

2005年(45)

分类: LINUX

2010-12-23 12:42:05

Net-SNMP

Net-SNMP is the F/OSS SNMP agent for POSIX-compatible systems.

Webpage:

Monitoring CPU Usage

Monitoring Memory Usage

Monitoring Network Interface Traffic

Monitoring File System Capacity

Monitoring Processes

Monitoring Uptime

Monitoring TCP/UDP (L4) Sockets

Monitoring Disk I/O Activity

Fixed Disk Storage Device usage access statistics are provided by the UCD-DISKIO-MIB as implemented by the Net-SNMP agent. There is a convenient table in the MIB that maps the I/O operations, bytes read/written, and average load from each device probed by the kernel: UCD-DISKIO-MIB::diskioTable

Example output:

system% snmptable -v2c -c [string] localhost diskIOTable    
SNMP table: UCD-DISKIO-MIB::diskIOTable

 diskIOIndex diskIODevice diskIONRead diskIONWritten diskIOReads diskIOWrites diskIOLA1 diskIOLA5 diskIOLA15 diskIONReadX diskIONWrittenX
           1          da0    93798944     2122439680     1481216     11776749         1         1          1  34453537312    268410412032
           2          da1    52808736     2122439680     1481217     11776749         1         1          1  34412547104    268410412032

* Time-metered load averages for the last 1, 5, or 15 minutes are represented in UCD-DISKIO-MIB by diskIOLA[1|5|15](if your agent supports them):

The [1|5|15] minute average load of disk (%)"

* diskION[Read|Written] is defined in the MIB as:

The number of bytes read/writen from/to this device since boot.

Note: diskIONReadX|diskIONWrittenX provide Counter64 versions

* diskIO[Writes|Reads] identifies operations, not bytes:

The number of write/read accesses to this device since boot.

Note: diskIOwrites numbers provide a read-operations count, which, depending on how the Net-SNMP agent code for the UCD-DISKIO-MIB is implemented in your operating system, is likely the number of read()/write() calls from the VFS layer to the device driver within the kernel. Each read operation will result in a byte count from the device sector size identified in (256/512/1024/2048/4096-byte allocation units per HOST-RESOURCES-MIB::hrStorageTable)

Example:

$ snmptable -v2c -c [community] localhost  hrStorageTable
SNMP table: HOST-RESOURCES-MIB::hrStorageTable

 hrStorageIndex                                hrStorageType         hrStorageDescr hrStorageAllocationUnits hrStorageSize hrStorageUsed hrStorageAllocationFailures
              1         HOST-RESOURCES-TYPES::hrStorageOther         Memory Buffers                256 Bytes             0        178772                           0
              2           HOST-RESOURCES-TYPES::hrStorageRam            Real Memory               4096 Bytes        198876         38467                           0
              3 HOST-RESOURCES-TYPES::hrStorageVirtualMemory             Swap Space               4096 Bytes        524256         19580                           0
              4         HOST-RESOURCES-TYPES::hrStorageOther Memory Buffer Clusters               1024 Bytes         25600       -184744                           0
              5     HOST-RESOURCES-TYPES::hrStorageFixedDisk                      /               2048 Bytes        506487         30268                           0
              6     HOST-RESOURCES-TYPES::hrStorageFixedDisk                   /dev                512 Bytes             2             2                           0
              7     HOST-RESOURCES-TYPES::hrStorageFixedDisk                   /opt               2048 Bytes      56734705 

Graphing the Data in MRTG:

* Average Load

Unlike most I/O OIDs, this is an Integer/Counter-type data that you would graph like CPU Usage:

diskIOLA1 OBJECT-TYPE
    SYNTAX      Integer32 (0..100)
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "The 1 minute average load of disk (%)"
    ::= { diskIOEntry 9 }

* I/O Operations

This data is stored in the MIB as a Counter32 variable. You can graph non-linear growth overall to observe patterns (which will reset when the integer overlaps at 232) or you can graph "usage" by letting MRTG calculate bytes/second using the "non-gauge" method.

Examples of both are seen below.

To ensure that MRTG can reference individuals cells of the table, ensure that MRTG parses the MIB file for UCD-DISKIO-MIB on your system:

LoadMIBs: /usr/local/share/snmp/mibs/UCD-DISKIO-MIB.txt

[...snip...]

PageTop[hostname.diskio.bytes]: 

Bytes Read/Written gm0

ShortLegend[hostname.diskio.bytes]: Bytes: YLegend[hostname.diskio.bytes]: Bytes: LegendI[hostname.diskio.bytes]: Bytes Read: LegendO[hostname.diskio.bytes]: Bytes Written: Legend1[hostname.diskio.bytes]: Bytes Read: Legend2[hostname.diskio.bytes]: Bytes Written: Target[hostname.diskio.bytestotal]: diskIONRead.1&diskIONWritten.1:community@hostname Maxbytes[hostname.diskio.bytestotal]: 4294967295 Options[hostname.diskio.bytestotal]: nopercent,gauge,growright Title[hostname.diskio.bytestotal]: Bytes Read/Written gm0 total PageTop[hostname.diskio.bytestotal]:

Bytes Read/Written gm0 total

ShortLegend[hostname.diskio.bytestotal]: Bytes: YLegend[hostname.diskio.bytestotal]: Bytes: LegendI[hostname.diskio.bytestotal]: Bytes Read: LegendO[hostname.diskio.bytestotal]: Bytes Written: Legend1[hostname.diskio.bytestotal]: Bytes Read: Legend2[hostname.diskio.bytestotal]: Bytes Written: kMG[hostname.diskio.bytestotal]: k,M,G,T,P,X

Screenshot:

~seklecki/images/cf_mrtg_snmp_UCDdiskIO_bytes.png

And to graph I/O operations (both "usage" and "total"):

Target[system.diskio.rw]: diskIOWrites.1&diskIOReads.1:community@system
Maxbytes[system.diskio.rw]: 1000000000
Options[system.diskio.rw]: nopercent,growright
Title[system.diskio.rw]: Read/Write I/O ops gm0 (not bytes)
PageTop[system.diskio.rw]: 

Reads/Write I/O ops gm0 (not bytes)

ShortLegend[system.diskio.rw]: IOs: YLegend[system.diskio.rw]: IOs: LegendI[system.diskio.rw]: Writes LegendO[system.diskio.rw]: Reads Legend1[system.diskio.rw]: Writes Legend2[system.diskio.rw]: Reads Target[system.diskio.rwtotal]: diskIOWrites.1&diskIOReads.1:community@system Maxbytes[system.diskio.rwtotal]: 10000000000 Options[system.diskio.rwtotal]: nopercent,gauge,growright Title[system.diskio.rwtotal]: Reads/Write I/O ops gm0 total (not bytes) PageTop[system.diskio.rwtotal]:

Reads/Write I/O ops gm0 total (not bytes)

ShortLegend[system.diskio.rwtotal]: IOs: YLegend[system.diskio.rwtotal]: IOs: LegendI[system.diskio.rwtotal]: Writes LegendO[system.diskio.rwtotal]: Reads Legend1[system.diskio.rwtotal]: Writes Legend2[system.diskio.rwtotal]: Reads kMG[system.diskio.rwtotal]: k,M,G,T,P,X

And associated screenshot:

~seklecki/images/cf_mrtg_snmp_UCDdiskIO_IOs.png

This section was contributed by Brian A. Seklecki and Sean Mcafee

阅读(2757) | 评论(0) | 转发(0) |
0

上一篇:snmp oid

下一篇:oid snmp

给主人留下些什么吧!~~