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

OUT=`su - user -c "ssh user@ \"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`
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

The following two tabs change content below.

charlie root

VP of keeping it real / HNIC at pissedoffadmins.com
I bring the cold coffee.

Latest posts by charlie root (see all)

No Comment.

Add Your Comment