Re: [mrtg] MRTG Script error

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/[.]//"` &...


Go Back   Usenet Forums > Networking and Network Related > MRTG

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-22-2008
Steve Shipway
 
Posts: n/a
Default Re: [mrtg] MRTG Script error

> ################################
> #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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:16 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0