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[192.168.109.100.uptime][_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.
Aaron

======================
Mrtg config file
======================
LoadMIBs:
/usr/share/snmp/mibs/UCD-SNMP-MIB.txt,/usr/share/snmp/mibs/TCP-MIB.txt

workdir: /www/stats/mrtg/

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


=========================
smc_itd_uptime.py
=========================
#!/usr/bin/python

import os

# run snmpget to retrieve the needed update data from the smc devices
uptime = os.popen ("snmpget -v 1 -c CommunityString 192.168.109.100
system.sysUpTime.0 2> /dev/null")
text = uptime.readline()
if (uptime.close() == None):
    toks = text.strip().split()
    
    print toks[3][1:-1]
else:
    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