Discussion:
MRTG - Expected a Number for 'out' but nothing
(too old to reply)
wk
2007-11-22 19:20:22 UTC
Permalink
I'm running mrtg and get the following warning errors below:

$ /usr/local/mrtg-2/bin/mrtg /home/mrtg/cfg/mrtg.cfg
2007-11-22 10:53:57: WARNING: Problem with External get '/tmp/foo':
Expected a Number for 'out' but nothing'

2007-11-22 10:53:57: ERROR: Target[portal.aphroland.org.uptime][_OUT_]
' $target->[0]{$mod
e} ' did not eval into defined data
Admin - System Engerring Server (811:1144-A.1)!


It seems that any type of script I call (sh, bash, perl) from the
mrtg.cfg file yeilds the above error.
Target[portal.saphroland.org.uptime]: `/usr/local/bin/test.sh`

If I just put a number in the Target field it works fine:
Target[portal.saphroland.org.uptime]: "555"

The script(s):

/usr/local/bin/test.sh
#! /bin/bash
/usr/bin/uptime | awk '{ print $3 }'

or

/usr/local/bin/test.sh
#! /bin/bash
/bin/date +%m

My mrtg.cfg files looks like:
------------------------------------------------------------------------------------------------------
EnableIPv6: no
WorkDir: /httpd/html/mrtg
Options[_]: bits,growright

Target[portal.saphroland.org.uptime]: `/usr/local/bin/test.sh`
Xsize[portal.saphroland.org.uptime]: 600
Ysize[portal.saphroland.org.uptime]: 200
Ytics[portal.saphroland.org.uptime]: 10
Options[portal.saphroland.org.uptime]: nopercent,gauge
Supress[portal.saphroland.org.uptime]: dw
Title[portal.saphroland.org.uptime]: (portal.saphroland.org) Uptime -
in days
PageTop[portal.saphroland.org.uptime]: <h1>(portal.saphroland.org)
Uptime - in days</h1>
Background[portal.saphroland.org.uptime]: #738AA6
MaxBytes[portal.saphroland.org.uptime]: 1000
YLegend[portal.saphroland.org.uptime]: days
ShortLegend[portal.saphroland.org.uptime]: days&nbsp;
LegendI[portal.saphroland.org.uptime]: &nbsp;Uptime:&nbsp;
LegendO[portal.saphroland.org.uptime]:
Legend1[portal.saphroland.org.uptime]: Uptime
Legend2[portal.saphroland.org.uptime]:


Any help is greatly appreciated! :)

-wk
Niels Baggesen
2007-11-23 06:06:08 UTC
Permalink
Post by wk
/usr/local/bin/test.sh
#! /bin/bash
/usr/bin/uptime | awk '{ print $3 }'
To quote the mrtg manual:

External Monitoring Scripts

If you want to monitor something which does not provide data via snmp
you can use some external program to do the data gathering.

The external command must return 4 lines of output:

Line 1: current state of the first variable, normally 'incoming bytes count'
Line 2: current state of the second variable, normally 'outgoing bytes count'
Line 3: string (in any human readable format), telling the uptime of the target.
Line 4: string, telling the name of the target.

/Niels
--
Niels Baggesen -- @home -- Ã…rhus -- Denmark -- ***@baggesen.net
The purpose of computing is insight, not numbers -- R W Hamming
Loading...