Cosmin Nicolaescu on 25 Aug 2005 22:10:47 -0000


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

Re: [PLUG] Uptime graphs with MRTG


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, August 25, 2005 2:56 pm, Aaron Crosman wrote:
> 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
>
>

Any reason you're not using gnuplot? There's a 3rd-party py module that
interacts with it, and it generates nice graphs. We wrote a small script
at work that will read some temperatures from our server room and plot
them.

- -Cos

- --
GPG key fingerprint = DE9F 4664 E666 2BD1 903E  4F4D EA31 5FB1 C7F9 08C1

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDDkIU6jFfscf5CMERAv7BAJ9cFDN8j2b+OH7wRTZg2PUYLEiCtQCgw39j
HEzhko0kEMiggTP6ORrhqx0=
=vxrD
-----END PGP SIGNATURE-----

___________________________________________________________________________
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