Disk read and write monitoring

Disk auto-discovery

#!/bin/bash
diskarray=(`cat /proc/diskstats |grep -E "\bsd[abcdefg]\b|\bxvd[abcdefg]\b"|grep -i "\b$1\b"|awk '{print $3}'|sort|uniq   2>/dev/null`)
length=${#diskarray[@]}
printf "{\n"
printf  '\t'"\"data\":["
for ((i=0;i<$length;i++))
do
        printf '\n\t\t{'
        printf "\"{#DISK_NAME}\":\"${diskarray[$i]}\"}"
        if [ $i -lt $[$length-1] ];then
                printf ','
        fi
done
printf  "\n\t]\n"
printf "}\n"

To monitor the disk name returned items to create / write disk statistics
vfs.dev.read/write [, , ]
Disk read statistics.
Integer - type sectors, Operations, bytes
the Float - type sps, ops, bps

device - disk device (default is all)

type - Possible values: sectors, operations, bytes, sps , ops, bps must specify this parameter, since the default values for the various different operating systems.
sps, ops, bps represents: sectors, operations, bytes per second , respectively.

mode - possible values:. avg1 (1 minute average default), avg5, avg15
if you want to get the value of change per second, per second can be added to change the process, multiple custom.
This parameter is only supported types are: sps, ops, bps.

The default value of "type" parameter of different operating systems:
AIX - the Operations
FreeBSD - bps
Linux - SPS
OpenBSD - the Operations
the Solaris - bytes

Example:
⇒ vfs.dev.read [, Operations]
SPS supported on the platform, and OPS bps has been limited to eight devices (7 and a separate all) from Zabbix.
Start 2.0.1, this restriction up to 1024 devices (1023 and an independent all).
If the default is used exclusively for the first parameter, then the key will return the summary statistics, including all block devices,
such as SDA, and SBD partition (sda1 , sda2, sdb3 ...) and a plurality of devices based on these block devices / partition (MD raid) and based on
these devices / logical partitions (LVM). In this case, the return value only as a relative value (dynamic time) rather than absolute
values.
LVM support starting from Zabbix 1.8.6.
Until Zabbix 1.8.6 related to use of the device name (for example, sda). Since then, optional / dev / prefix (for example
, such as / dev / sda) must be used.
Old name: io [*]

Guess you like

Origin www.cnblogs.com/0916m/p/11853903.html