[mrtg] MRTG Script error
Aleš
ales.rom at kabelnet.net
Tue Apr 22 10:50:25 CEST 2008
SYED JAHANZAiB ~!~ AA Internet Cable.Network Services pravi:
> I am facing a littile problem in creating MRTG Graph for Disk I/O perfromance.
> I created script to collect read/write data by thie following script.
>
> ################################
> #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
> ################################
> If I run disk.sh, it shows me following result which is ok
>
> 429
> 26
>
> My disk.cfg is as follows...
> ################################
> Target[disk]: `/usr/local/mrtg-2/bin/disk.sh`
> Title[disk]: Disk HDA I/O Utilization Report
> #Unscaled[disk]: dwym
> MaxBytes[disk]: 10240000
> PageTop[disk]: Disk I/O Utilization Report
> kmg[disk]: KB,MB,GB
> LegendI[disk]: Disk I/O KBread/sec
> LegendO[disk]: Disk I/O KBwrite/sec
> Legend1[disk]: Disk I/O KBread/sec
> Legend2[disk]: Disk I/O KBwrite/sec
> YLegend[disk]: Megabytes
> ShortLegend[disk]: &
> Options[disk]: growright,gauge,nopercent
> #################################
>
> But when i set it in MRTG , it shows me follwing error and donot updatedisk Graph.
>
> ##################
>
> 2008-04-21 17:04:02 -- Started mrtg with config '/usr/local/mrtg-2/bin/mrtg.cfg'
>
> 2008-04-21 17:04:38 -- 2008-04-21 17:04:02: WARNING: Problem with External get '/usr/local/mrtg-2/bin/disk.sh':
> Expected a Number for 'in' but got ''
>
> 2008-04-21 17:04:38 -- 2008-04-21 17:04:02: WARNING: Problem with External get '/usr/local/mrtg-2/bin/disk.sh':
> Expected a Number for 'out' but got ''
>
> 2008-04-21 17:04:38 -- 2008-04-21 17:04:38: ERROR: Target[disk][_IN_] ' $target->[47]{$mode} ' did not eval into defined data
>
> 2008-04-21 17:04:38 -- 2008-04-21 17:04:38: ERROR: Target[disk][_OUT_] ' $target->[47]{$mode} ' did not eval into defined data
>
> #############################
>
> What could be the error ???
>
> Regards,
> _________________________________________________________________
> Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy!
> http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
> _______________________________________________
> mrtg mailing list
> mrtg at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/mrtg
>
>
Maybe you should try:
iostat -x |grep sda | awk '{print $7}' | sed 's/[^[:digit:]]//g'
The result will be the same, but it is number for sure. :-)
More information about the mrtg
mailing list