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.<br>We will just have to get past the ksh/bash difference of opinion. :-)<br><br>
Cheers<br>     V<br><br><div class="gmail_quote">On Wed, Sep 15, 2010 at 6:19 AM, Isaac W Traxler <span dir="ltr"><<a href="mailto:traxler@lsu.edu">traxler@lsu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
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:<br>

<br>
#!/bin/bash<br>
OS=$(uname -o)<br>
PID=$$<br>
<br>
if [[ ${OS} == "solaris" ]]<br>
 then<br>
    IOSTAT='/usr/bin/iostat -xrn'<br>
 else<br>
    IOSTAT='/usr/bin/iostat -x'<br>
 fi<br>
<br>
TEMPFILE=${BBTMP}/diskstat.tmp.${PID}<br>
SHOW_NFS=no   # Set this to yes on server side clientlocal.cfg to change it<br>
              # DISKSTAT:SHOW_NFS=yes<br>
DURATION=270   # The duration of the iostat sample<br>
              # This can be updated in the same way as above<br>
<br>
# Now we redefine some variables, if they are set in clientlocal<br>
LOGFETCH=${BBTMP}/logfetch.$(uname -n).cfg<br>
if [ -f ${LOGFETCH} ]<br>
    then<br>
       grep "^DISKSTAT:" ${LOGFETCH} | cut -d":" -f2 \<br>
                                     | while read NEW_DEF<br>
                                     do<br>
                                        ${NEW_DEF}<br>
                                     done<br>
fi<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
${TEMPFILE}  # Make sure it's empty<br>
</blockquote>
TEMPFILERAW="${TEMPFILE}.raw"<br>
${IOSTAT} $DURATION 2  > ${TEMPFILERAW}  # And collect some data to work with.<br>
# We have to collect 2 sets, because the first set is the average since boot.<br>
<br>
# Define where the second set of data starts<br>
LINE=$(cat ${TEMPFILERAW} | grep -n "^Device:" | tail -1 | cut -d":" -f1)<br>
# take the second set, and massage it into usable data<br>
TEMPFILEDATA="${TEMPFILE}.data"<br>
if [[ ${OS} == "solaris" ]]<br>
 then<br>
    cat ${TEMPFILERAW} | awk "NR>${LINE}" \<br>
                       | sed "s/,/ /g" \<br>
                       | awk '{ print $NF" "$0 }' \<br>
                       | awk '{ $NF="";print }' > ${TEMPFILEDATA}<br>
 else<br>
    cat ${TEMPFILERAW} | awk "NR>${LINE}" \<br>
                       | awk '{ print $0" "$1 }' \<br>
                       | awk '{ $NF="";print }' > ${TEMPFILEDATA}<br>
  fi<br>
rm ${TEMPFILERAW}<br>
# Now we format the data and send it off to the server<br>
if [[ ${OS} == "solaris" ]]<br>
 then<br>
    COLUMNS="reads writes kreads kwrites wait actv svct pw pb"<br>
 else<br>
    COLUMNS="rrqm wrqm r w rsec wsec avgrq-sz avgqu-sz await svctm util"<br>
 fi<br>
count=1<br>
for subtest in ${COLUMNS}<br>
do<br>
   ((count=count+1))<br>
   echo "" >> ${TEMPFILE}<br>
   cat ${TEMPFILEDATA} | cut -d" " -f1,${count} \<br>
                       | while read DEVICE VAL<br>
                        do<br>
                           echo "${DEVICE}" | grep ":/" > /dev/null<br>
                           if [ $? -eq 0 -a "${SHOW_NFS}" = "no" ]<br>
                           then<br>
                              break<br>
                           else<br>
                              DEVICE=$(echo ${DEVICE} | tr : - )<br>
                           fi<br>
                           echo "${DEVICE}:${VAL}" >> ${TEMPFILE}<br>
                        done<br>
                        echo "" >> ${TEMPFILE}<br>
                        ${BB} ${BBDISP} "data ${MACHINE}.diskstat-${subtest} $(echo; cat ${TEMPFILE} ;echo "" ;echo "ignore this" )"<br>
                        # Without the last echo "ignore this", it seems to not graph the last entry.<br>
                        # Odd really, but that seems to fix it.<br>
                        rm ${TEMPFILE}<br>
done<br>
rm ${TEMPFILEDATA}<br>
<br>
<br>
--<br>
Isaac Traxler                             AIX,Linux Admin<br>
Louisiana State University                <a href="mailto:traxler@lsu.edu" target="_blank">traxler@lsu.edu</a><br>
High Performance Computing                225-578-1923<br>
LONI AIX Clusters<br>
AIX, Linux Support<br>
<br>
On Tue, 14 Sep 2010, Daniel Bourque wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Date: Tue, 14 Sep 2010 16:22:13 -0500<br>
From: Daniel Bourque <<a href="mailto:dbourque@weatherdata.com" target="_blank">dbourque@weatherdata.com</a>><br>
Reply-To: <a href="mailto:xymon@xymon.com" target="_blank">xymon@xymon.com</a><br>
To: <a href="mailto:xymon@xymon.com" target="_blank">xymon@xymon.com</a><br>
Subject: [xymon] iostat monitor<div><div></div><div class="h5"><br>
<br>
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 ! )<br>
<br>
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.<br>

<br>
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.<br>
<br>
<br>
case `uname` in<br>
  Linux)<br>
    /usr/bin/iostat -x $DURATION 2 | wonderful stuff > $TEMPFILE.raw<br>
     ;;<br>
  SunOS)<br>
    /usr/bin/iostat -xrn $DURATION 2 > $TEMPFILE.raw<br>
    ;;<br>
esac<br>
<br>
<br>
<br>
-- <br>
Dan<br>
<br>
<br>
To unsubscribe from the xymon list, send an e-mail to<br>
<a href="mailto:xymon-unsubscribe@xymon.com" target="_blank">xymon-unsubscribe@xymon.com</a><br>
<br>
<br>
<br>
</div></div></blockquote><div><div></div><div class="h5">
<br>
To unsubscribe from the xymon list, send an e-mail to<br>
<a href="mailto:xymon-unsubscribe@xymon.com" target="_blank">xymon-unsubscribe@xymon.com</a><br>
<br>
<br>
</div></div></blockquote></div><br>