[xymon] iostat monitor
Vernon Everett
everett.vernon at gmail.com
Wed Sep 15 00:42:44 CEST 2010
If everybody who has done similar hacks can send me their magic, then maybe
we can fold it into the code, and create a more universal script.
We will just have to get past the ksh/bash difference of opinion. :-)
Cheers
V
On Wed, Sep 15, 2010 at 6:19 AM, Isaac W Traxler <traxler at lsu.edu> wrote:
> Hi,
>
> Jason and I have hacked at the iostat and got something that seems to work
> on Linux. We have not cleaned it up near enough or fixed all that we need.
> Along with changing the script, the graph definitions need to also be
> changed. Here is the what we have done with iostat so far:
>
> #!/bin/bash
> OS=$(uname -o)
> PID=$$
>
> if [[ ${OS} == "solaris" ]]
> then
> IOSTAT='/usr/bin/iostat -xrn'
> else
> IOSTAT='/usr/bin/iostat -x'
> fi
>
> TEMPFILE=${BBTMP}/diskstat.tmp.${PID}
> SHOW_NFS=no # Set this to yes on server side clientlocal.cfg to change it
> # DISKSTAT:SHOW_NFS=yes
> DURATION=270 # The duration of the iostat sample
> # This can be updated in the same way as above
>
> # Now we redefine some variables, if they are set in clientlocal
> LOGFETCH=${BBTMP}/logfetch.$(uname -n).cfg
> if [ -f ${LOGFETCH} ]
> then
> grep "^DISKSTAT:" ${LOGFETCH} | cut -d":" -f2 \
> | while read NEW_DEF
> do
> ${NEW_DEF}
> done
> fi
>
> ${TEMPFILE} # Make sure it's empty
>>
> TEMPFILERAW="${TEMPFILE}.raw"
> ${IOSTAT} $DURATION 2 > ${TEMPFILERAW} # And collect some data to work
> with.
> # We have to collect 2 sets, because the first set is the average since
> boot.
>
> # Define where the second set of data starts
> LINE=$(cat ${TEMPFILERAW} | grep -n "^Device:" | tail -1 | cut -d":" -f1)
> # take the second set, and massage it into usable data
> TEMPFILEDATA="${TEMPFILE}.data"
> if [[ ${OS} == "solaris" ]]
> then
> cat ${TEMPFILERAW} | awk "NR>${LINE}" \
> | sed "s/,/ /g" \
> | awk '{ print $NF" "$0 }' \
> | awk '{ $NF="";print }' > ${TEMPFILEDATA}
> else
> cat ${TEMPFILERAW} | awk "NR>${LINE}" \
> | awk '{ print $0" "$1 }' \
> | awk '{ $NF="";print }' > ${TEMPFILEDATA}
> fi
> rm ${TEMPFILERAW}
> # Now we format the data and send it off to the server
> if [[ ${OS} == "solaris" ]]
> then
> COLUMNS="reads writes kreads kwrites wait actv svct pw pb"
> else
> COLUMNS="rrqm wrqm r w rsec wsec avgrq-sz avgqu-sz await svctm util"
> fi
> count=1
> for subtest in ${COLUMNS}
> do
> ((count=count+1))
> echo "" >> ${TEMPFILE}
> cat ${TEMPFILEDATA} | cut -d" " -f1,${count} \
> | while read DEVICE VAL
> do
> echo "${DEVICE}" | grep ":/" > /dev/null
> if [ $? -eq 0 -a "${SHOW_NFS}" = "no" ]
> then
> break
> else
> DEVICE=$(echo ${DEVICE} | tr : - )
> fi
> echo "${DEVICE}:${VAL}" >> ${TEMPFILE}
> done
> echo "" >> ${TEMPFILE}
> ${BB} ${BBDISP} "data ${MACHINE}.diskstat-${subtest}
> $(echo; cat ${TEMPFILE} ;echo "" ;echo "ignore this" )"
> # Without the last echo "ignore this", it seems to
> not graph the last entry.
> # Odd really, but that seems to fix it.
> rm ${TEMPFILE}
> done
> rm ${TEMPFILEDATA}
>
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University traxler at lsu.edu
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Tue, 14 Sep 2010, Daniel Bourque wrote:
>
> Date: Tue, 14 Sep 2010 16:22:13 -0500
>> From: Daniel Bourque <dbourque at weatherdata.com>
>> Reply-To: xymon at xymon.com
>> To: xymon at xymon.com
>> Subject: [xymon] iostat monitor
>>
>>
>> Sorry I can't reply to the thread for some reason i quit receiving the
>> emails, I checked the archive and noticed the replies to my former thread. (
>> thanks ! )
>>
>> Vernon, since I don't run solaris here, only linux and some tru64, the -r
>> ( csv output ) and -n ( friendly names ) options makes it hard to use your
>> shell script since they either don't exists or don't work the same. Can you
>> perhaps provide a same output of "iostat -xrn" and along with formated text
>> you pass to hobbit in your check.
>>
>> I can then provide a snippet of code for linux, which would provide the
>> equivalent output. So you could just add a case in the shell script.
>>
>>
>> case `uname` in
>> Linux)
>> /usr/bin/iostat -x $DURATION 2 | wonderful stuff > $TEMPFILE.raw
>> ;;
>> SunOS)
>> /usr/bin/iostat -xrn $DURATION 2 > $TEMPFILE.raw
>> ;;
>> esac
>>
>>
>>
>> --
>> Dan
>>
>>
>> To unsubscribe from the xymon list, send an e-mail to
>> xymon-unsubscribe at xymon.com
>>
>>
>>
>>
> To unsubscribe from the xymon list, send an e-mail to
> xymon-unsubscribe at xymon.com
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20100915/f27be7e7/attachment.html>
More information about the Xymon
mailing list