Nagios Exchange
  • Home
  • Directory
  • About

Advanced Search

Build precise queries to find exactly what you need

Search Logic

Select compatible versions

Press ESC to close

Sign In Sign Up
Plugins4387Themes and Skins11Add-ons732Documentation283Graphics and Logos36View All Categories
LinuxSecuritySNMPFile SystemCloud
New Listings Recently Updated Listings Most Favored Listings Most Popular Listings Most Rated Listings Most Reviewed Listings
Random Project
Tape Drives and Libraries Check Oracle StorageTek ACSLS
0.0 (0)
5.1K
RSS Feed
Newest Listings Updated Listings
Top Contributors
LAMY (7)Julien DESMAREST (6)deskwork_itunes142 (4)Davide Lemma (4)Joerg Hoerter (3)
See More
Newest Contributors
Guillaume8723 (1)Salvo (1)SOHA-IT (1)Tsvetomir Tsvetanov (1)Igor Ru (1)
See More
Home > Angel L. Mateo
AL

Angel L. Mateo

@amateo

User Stats

Favorites0

Views

Projects0

No Projects Found
check_iostat - I/O statistics

Update

I have created a patched version between original version and philippn's one. This patch: * Runs iostat just once. * Avoids the conversion between '.' and ',' by running iostat with LANG=C * Gets actual values not the ones from last reboot. * Runs from bash This is the patch: Index: check_iostat =================================================================== --- check_iostat (revisión: 11002) +++ check_iostat (copia de trabajo) @@ -1,9 +1,20 @@ -#!/bin/sh +#!/bin/bash # # Version 0.0.2 - Jan/2009 # Changes: added device verification +# +# by Thiago Varela - [email protected] # -# by Thiago Varela - [email protected] +# -------------------------------------- +# +# Version 0.0.3 - Dec/2011 +# Changes: +# - changed values from bytes to mbytes +# - fixed bug to get traffic data without comma but point +# - current values are displayed now, not average values (first run of iostat) +# +# by Philipp Niedziela - [email protected] +# iostat=`which iostat 2>/dev/null` bc=`which bc 2>/dev/null` @@ -50,14 +61,19 @@ echo "ERROR: critical levels must be highter than warning levels" && help +# iostat parameters: +# -m: megabytes +# -k: kilobytes +# first run of iostat shows statistics since last reboot, second one shows current vaules of hdd # Doing the actual check: -tps=`$iostat $disk | grep $disk | awk '{print $2}'` -kbread=`$iostat $disk | grep $disk | awk '{print $3}'` -kbwritten=`$iostat $disk | grep $disk | awk '{print $4}'` +# We get just 2nd line, which is the actual value +output=$(LANG=C $iostat $disk -d 1 2 | grep $disk | sed -n '2p') +tps=$(echo "$output" | awk '{print $2}') +kbread=$(echo "$output" | awk '{print $3}') +kbwritten=$(echo "$output" | awk '{print $4}') - # Comparing the result and setting the correct level: -if ( [ "`echo "$tps >= $crit_tps" | bc`" == "1" ] || [ "`echo "$kbread >= $crit_read" | bc`" == "1" ] || +if ( [ "`echo "$tps >= $crit_tps" | bc`" == "1" ] || [ "`echo "$kbread >= $crit_read" | bc -q`" == "1" ] || [ "`echo "$kbwritten >= $crit_written" | bc`" == "1" ] ); then msg="CRITICAL" status=2

Reviewed 12 years ago

No Favorites Found

Copyright © 2009-2025 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks