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; On Tue, Apr 22, 2008 at 07:52:53AM +0000, SYED JAHANZAiB ~!~ AA Internet Cable. Network Services wrote: > But ...


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
Alex van den Bogaerdt
 
Posts: n/a
Default Re: [mrtg] MRTG Script error

On Tue, Apr 22, 2008 at 07:52:53AM +0000, SYED JAHANZAiB ~!~ AA Internet Cable. Network Services wrote:

> But when i set it in MRTG , it shows me follwing error and donot updatedisk Graph.


> 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 ''


> What could be the error ???



If it works from the command line but not from MRTG, it is likely
that your PATH setting is wrong when you run MRTG.

For instance: awk is located in /usr/bin/awk but when MRTG is running
the PATH does not contain /usr/bin/.

Solution #1:
* Always use full paths: write '/usr/bin/awk', not just 'awk'.
* Same for the other utilities you use.

Solution #2:
* Make sure PATH does contain all necessary directories:
*
* Your script should contain the following line:
* PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/you/bin
*
* Make sure you change the command so that it applies to your system.

In my opinion, solution #1 is the better one.

Remark about your script: in almost all cases, you need not combine
'grep' and 'awk' and 'sed'.

Some examples:

wrong: grep 'x' | awk '{print $1}'
good: awk '/x/ {print $1}'

wrong: grep 'x' | sed 's/x/y/g'
good: sed -n '/x/s/x/y/gp'

wrong: grep 'x' | awk '{print $1}' | sed 's/x/y/g'
good: awk '/x/{gsub("x","y",$1);print $1}'

HTH
Alex

_______________________________________________
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:21 PM.


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