Aaron Crosman on 25 Aug 2005 18:57:15 -0000

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Uptime graphs with MRTG

I'm trying to create uptime graphs on some wireless access points that
we operate.
I have mrtg setup to create traffic graphs, and that works fine.

>From what I've been able to gather, to graph uptime I need to provide
mrtg with an integer that it can then just plot.  So wrote a quick
python script that called smtpget and strips the returned uptime
information down to just the integer (timeticks) I think mrtg needs.
However, I can't seem to get mrtg to recognize the input.

Mrtg gives the following errors:
WARNING: Problem with External get '/home/awstats/smc_itd_uptime.py':
   Expected a Number for 'out' but nothing'

ERROR: Target[][_OUT_] ' $target->[0]{$mode} ' did
not eval into defined data

I found a couple of references to similar errors online, but either I
had already tried the proposed solution, or I tried it and it failed.
So now I'm looking for another few sets of eyes to put out whatever
(most likely) painfully obvious detail I've missed.

Any help you all can offer would be greatly appreciated.

Mrtg config file

workdir: /www/stats/mrtg/

Target[]: `/home/awstats/smc_itd_uptime.py`
Title[]: smc-itd Uptime
PageTop[]: <H1>smc-itd UpTime</H1>
MaxBytes[]: 1000
YLegend[]: UpTime
Legend1[]: UpTime
Options[]: growright, noi
Unscaled[]: ymwd


import os

# run snmpget to retrieve the needed update data from the smc devices
uptime = os.popen ("snmpget -v 1 -c CommunityString
system.sysUpTime.0 2> /dev/null")
text = uptime.readline()
if (uptime.close() == None):
    toks = text.strip().split()
    print toks[3][1:-1]
    print 0
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug