using mrtg to monitor iowait on a solaris (10) machine (quick)

just as the name reads – this command, when run with ssh (or any other method of choice) will output just iowait – can be changed to anything else

#!/bin/bash
OUT=`su - user -c "ssh user@10.13.128.15 \"iostat -Xpnc | tail -n 1 \"" | awk '{print $3}'`
echo $OUT
echo $OUT

the reason i used su is that i needed to do this as a different user due to ssh keyless login

dual echo $OUT is for proper formatting to mrtg

here is a snippet of my mrtg.conf:

Options[_]: absolute, unknaszero, nopercent, noinfo, integer, nobanner, noo, withzeroes, growright
RunAsDaemon: No
Interval: 5
EnableIPv6: no
XSize[_]: 500
YSize[_]: 200
Colours[_]: DKBLUE#61A0DF,DKBLUE#0000DD,RED#FF0000,DKRED#AB0000
AbsMax[_]: 12500000
MaxBytes[_]: 1
Unscaled[_]: ymwd

Target[iowait]: `iowait.sh`
Title[iowait]:iowait
ShortLegend[iowait]: .
YLegend[iowait]: iowait
Legend1[iowait]: iowait on $SERVER

i know that this is sloppy code – but in a quick bind it did the trick

«
»

    Leave a Reply

    Your email address will not be published. Required fields are marked *