Linux

Check IO stats of one or all disks

Description:

This plug-in checks IO stats of one (or all) disk. It can be used to send alerts when maximum hard drive IO/s or sectors read|write/s is reached.

Current Version

1.0

Last Release Date

2011-09-07

Compatible With

  • Nagios 3.x

License

GPL


Project Files
Project Notes
This plug-in checks IO stats of one (or all) disk. It can be used to send alerts when maximum hard drive IO/s or sectors read|write/s is reached Usage: ./check_diskstat.sh -d DEVICE -w tps,read,write -c tps,read,write | -h -d DEVICE DEVICE must be without /dev (ex: -d sda) -w/c TPS,READ,WRITE TPS means transfer per seconds (aka IO/s) READ and WRITE are in sectors per seconds Example: ./check_diskstat.sh -d sda -w 200,100000,100000 -c 300,200000,200000 This plugin use /sys filesystem for retrieving data. Average values are then calculated by keeping an history file. In order to check all disks on your system, you can use check_all_diskstat.sh. (Please, review it to correctly set path to check_diskstat.sh)
Reviews (3) Add a Review
Modify Date
by monty, September 30, 2018

There is a better way to get the modify timestamp of a file - check the -c option of stat: OLDDISKSTAT_EPOCH=$(stat $HISTFILE -c %Y) Furthermore the perfdata documentation states, that you should add the warning and crit levels: echo "${OUTPUT}summary: $TPS io/s, read $SECTORS_READ sectors (${KBYTES_READ_PER_SEC}kB/s), write $SECTORS_WRITE sectors (${KBYTES_WRITTEN_PER_SEC}kB/s) in $TIME seconds | tps=${TPS};${WARN_TPS};${CRIT_TPS};; read=${BYTES_READ_PER_SEC};${WARN_READ};${CRIT_READ};; write=${BYTES_WRITTEN_PER_SEC};${WARN_WRITE};${CRIT_WRITE};;"



Very nice plugin
by kalavan, January 31, 2017

Plugin is reading /sys/block/DEVICE/stat file, so does not depend on output of other programs (like iostat). Also keeps continuous measurement of system by keeping previous read in temporary file. One thing to point out though: Plugin checks read/write tresholds against bytes read/written per second, not against sectors per second as help states.



Nice check! Must have!
by artickl, June 30, 2013

It's very useful check which must be turned on for every server! PS: but small changes for check_all_diskstat.sh can be applied as soon it not returning a correct exit status for nagios notification. I make some changes which can help somebody else: ################### #!/bin/bash EXITCODE=0 CHK=/usr/lib/nagios/plugins/check_diskstat.sh WARN=${1:-"300,10000,10000"} CRIT=${2:-"400,20000,20000"} for DEVICE in `ls /sys/block`; do if [ -L /sys/block/$DEVICE/device ]; then DEVNAME=$(echo /dev/$DEVICE | sed 's#!#/#g') echo -n "$DEVNAME: " OUTPUT="`$CHK -d $DEVICE -w $WARN -c $CRIT`" STATUS=$? if [ "$EXITCODE" -le "$STATUS" ]; then EXITCODE=$STATUS; fi echo $OUTPUT | sed "s#=#_$DEVNAME=#g" fi done exit $EXITCODE ###################



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.7 (6)
Favorites
4
Views
121,922