This is a discussion on Re: [mrtg] MRTG Script error within the MRTG forums, part of the Networking and Network Related category; > ################################ > #disk.sh > #!/bin/bash > Kbr=`iostat -x |grep sda | awk '{print $7}' |sed "s/[.]//"` &...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
> ################################
> #disk.sh > #!/bin/bash > Kbr=`iostat -x |grep sda | awk '{print $7}' |sed "s/[.]//"` > Kbw=`iostat -x |grep sda | awk '{print $6}' |sed "s/[.]//"` > echo $Kbr > echo $Kbw > ################################ 1) The #! Line should always be first in the script for maximum portability 2) You should always either explicitly set PATH or else give the full path of the commands iostat, grep, awk, sed etc else you have potential PATH problems and security issues. 3) The grep|awk|sed pipeline is needlessly complex (as has been previously mentioned) 4) You need to output FOUR lines for a MRTG plugin, although the last 2 can be blank. Technically, line 3 should contain the device uptime, and line four contain the device name. 5) You should probably change that sed to something like s/\.\d*// I think, if you're trying to cut off the trailing decimals. However, if you're running MRTG with RRDTool, there's no need to do this as you can use decimals. Steve _______________________________________________ mrtg mailing list mrtg@lists.oetiker.ch https://lists.oetiker.ch/cgi-bin/listinfo/mrtg |
![]() |
| Thread Tools | |
| Display Modes | |
|
|