Mercurial > ~darius > hgwebdir.cgi > adslstats
annotate adslstats.py @ 3:3748cec0e322
merge
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Wed, 20 Nov 2013 23:56:29 +1030 |
parents | b1048f889ef8 a795b6cd8b1a |
children | 98d351a87043 |
rev | line source |
---|---|
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
1 #!/usr/bin/env python |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
2 ############################################################################ |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
3 # |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
4 # Parse ADSL link stats for Billion 7300G & generate RRD archives & graphs |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
5 # |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
6 ############################################################################ |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
7 # |
1
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
8 # Copyright (C) 2013 Daniel O'Connor. All rights reserved. |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
9 # |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
10 # Redistribution and use in source and binary forms, with or without |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
11 # modification, are permitted provided that the following conditions |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
12 # are met: |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
13 # 1. Redistributions of source code must retain the above copyright |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
14 # notice, this list of conditions and the following disclaimer. |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
15 # 2. Redistributions in binary form must reproduce the above copyright |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
16 # notice, this list of conditions and the following disclaimer in the |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
17 # documentation and/or other materials provided with the distribution. |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
18 # |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
19 # THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
20 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
21 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
22 # ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
23 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
24 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
25 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
26 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
28 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
29 # SUCH DAMAGE. |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
30 # |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
31 ############################################################################ |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
32 |
1
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
33 import ConfigParser |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
34 import optparse |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
35 import os |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
36 import re |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
37 import rrdtool |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
38 import time |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
39 import urllib |
1
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
40 from bs4 import BeautifulSoup |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
41 |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
42 conf = ConfigParser.ConfigParser() |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
43 conf.add_section('global') |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
44 conf.set('global', 'username', 'admin') |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
45 conf.set('global', 'password', 'admin') |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
46 conf.set('global', 'name', 'dsl.dons.net.au') |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
47 |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
48 conflist = ['adslstats.ini'] |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
49 if ('HOME' in os.environ): |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
50 conflist.append(os.path.expanduser('~/.adslstats.ini')) |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
51 conf.read(conflist) |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
52 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
53 usage = '''%prog [options]''' |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
54 opts = optparse.OptionParser(usage) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
55 opts.add_option('-v', '--verbose', action="store_true", default=False, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
56 help="Enable debug output") |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
57 opts.add_option('-g', '--graph', action="store_true", default=False, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
58 help="Generate a graph") |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
59 opts.add_option('-u', '--update', action="store_true", default=False, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
60 help="Update RRD") |
1
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
61 opts.add_option('-a', '--authname', action="store", default=conf.get('global', 'username'), |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
62 help="Username to login to modem") |
1
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
63 opts.add_option('-p', '--password', action="store", default=conf.get('global', 'password'), |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
64 help="Password to login to modem") |
1
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
65 opts.add_option('-n', '--name', action="store", default=conf.get('global', 'name'), |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
66 help="Hostname of modem") |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
67 opts.add_option('-b', '--base', action="store", default="/home/darius/projects/adslstats/adslstats", |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
68 help="Base directory for RRD & PNGs") |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
69 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
70 (options, args) = opts.parse_args() |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
71 |
2 | 72 statsurl = "http://%s/status/status_deviceinfo.htm" % (options.name) |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
73 rrdname = "%s.rrd" % (options.base) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
74 graphbasename = options.base |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
75 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
76 class ADSLStats(object): |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
77 def __str__(self): |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
78 return """Line Rate - Up: %d kbits, Down %d kbits |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
79 Noise Margin - Up: %.1f dB, Down %.1f dB |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
80 Attenuation - Up: %.1f dB, Down %.1f dB""" % (self.upstream, self.downstream, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
81 self.nmup, self.nmdown, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
82 self.attenup, self.attendown) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
83 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
84 def getstats(f): |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
85 s = BeautifulSoup(f) |
2 | 86 a = s.findAll('td') |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
87 |
2 | 88 # Sanity check in case the firmware changes page layout |
89 assert(a[122]('font')[0].contents[0] == 'SNR Margin') | |
90 assert(a[129]('font')[0].contents[0] == 'Line Attenuation') | |
91 assert(a[136]('font')[0].contents[0] == 'Data Rate') | |
92 | |
93 # Check if the modem is offline | |
94 if a[124].contents[0].strip() == 'N/A': | |
95 return None | |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
96 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
97 stats = ADSLStats() |
2 | 98 |
99 stats.nmdown = float(a[124].contents[0]) # dB | |
100 stats.nmup = float(a[125].contents[0]) # dB | |
101 | |
102 stats.attendown = float(a[131].contents[0]) # dB | |
103 stats.attenup = float(a[132].contents[0]) # dB | |
104 | |
105 stats.downstream = float(a[138].contents[0]) # kbit/sec | |
106 stats.upstream = float(a[139].contents[0]) # kbit/sec | |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
107 |
1
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
108 # Check if the modem is offline |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
109 if a[9].td.findNext('td').contents[0].contents[0].find('N/A') != -1: |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
110 return None |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
111 stats.upstream = cleannum(a[7].td.findNext('td').contents[0].contents[0]) # kbits |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
112 stats.downstream = cleannum(a[8].td.findNext('td').contents[0].contents[0]) # kbits |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
113 stats.nmup = cleannum(a[9].td.findNext('td').contents[0].contents[0]) # dB |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
114 stats.nmdown = cleannum(a[10].td.findNext('td').contents[0].contents[0]) # dB |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
115 stats.attenup = cleannum(a[11].td.findNext('td').contents[0].contents[0]) # dB |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
116 stats.attendown = cleannum(a[12].td.findNext('td').contents[0].contents[0]) # dB |
3 | 117 >>>>>>> other |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
118 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
119 return stats |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
120 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
121 # Setup RRD |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
122 # We expect data to be logged every 5 minutes |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
123 # Average 12 5 minute points -> hourly stats (keep 168 - a weeks worth) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
124 # Average 288 5 minute points -> daily stats (keep 365 - a years worth) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
125 # Detemine minimum & maximum for an hour and keep a weeks worth. |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
126 def makerrd(filename): |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
127 rrdtool.create(filename, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
128 '--step', '300', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
129 'DS:upstream:GAUGE:3600:32:25000', # Upstream (kbits) - 24mbit is ADSL2+ max |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
130 'DS:downstream:GAUGE:3600:32:25000', # Downstream (kbits) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
131 'DS:nmup:GAUGE:3600:0:100', # Upstream Noise margin (dB) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
132 'DS:nmdown:GAUGE:3600:0:100', # Downstream Noise margin (dB) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
133 'DS:attenup:GAUGE:3600:0:100', # Upstream Attenuation (dB) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
134 'DS:attendown:GAUGE:3600:0:100', # Downstream Attenuation (dB) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
135 'RRA:AVERAGE:0.1:12:168', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
136 'RRA:AVERAGE:0.1:288:365', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
137 'RRA:MIN:0.1:12:168', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
138 'RRA:MAX:0.1:12:168') |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
139 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
140 # Update the RRD (format stats as expected) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
141 def updaterrd(filename, tstamp, stats): |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
142 rrdtool.update(filename, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
143 '%d:%d:%d:%f:%f:%f:%f' % (tstamp, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
144 stats.upstream, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
145 stats.downstream, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
146 stats.nmup, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
147 stats.nmdown, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
148 stats.attenup, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
149 stats.attendown)) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
150 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
151 # Open the URL and call the parser, the update the RRD |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
152 def doupdate(): |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
153 opener = urllib.FancyURLopener() |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
154 opener.prompt_user_passwd = lambda host, realm: (options.authname, options.password) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
155 f = opener.open(statsurl) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
156 #f = open("adsl.html") |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
157 stats = getstats(f) |
1
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
158 if stats == None: |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
159 if options.verbose: |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
160 print "Modem is offline" |
a795b6cd8b1a
Add command line options.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
161 return |
0
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
162 if options.verbose: |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
163 print str(stats) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
164 updaterrd(rrdname, int(time.time()), stats) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
165 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
166 # Generate a graph |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
167 def gengraph(): |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
168 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
169 linkargs = ( |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
170 '-a', 'PNG', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
171 '-X', '0', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
172 '--vertical-label', 'kbit/sec', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
173 '--slope-mode', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
174 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
175 'DEF:upstream=%s:upstream:AVERAGE' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
176 'DEF:upstreammin=%s:upstream:MIN' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
177 'DEF:upstreammax=%s:upstream:MAX' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
178 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
179 'DEF:downstream=%s:downstream:AVERAGE' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
180 'DEF:downstreammin=%s:downstream:MIN' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
181 'DEF:downstreammax=%s:downstream:MAX' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
182 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
183 'CDEF:upstreamdif=upstreammax,upstreammin,-', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
184 'CDEF:downstreamdif=downstreammax,downstreammin,-', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
185 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
186 'LINE0:upstreammin#000000:', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
187 'AREA:upstreamdif#00dc76::STACK', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
188 'LINE1:upstream#00ff00:Upstream', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
189 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
190 'LINE0:downstreammin#000000:', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
191 'AREA:downstreamdif#ff8686::STACK', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
192 'LINE1:downstream#ff0000:Downstream') |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
193 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
194 signalargs = ( |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
195 '-a', 'PNG', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
196 '--vertical-label', 'dB', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
197 '--slope-mode', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
198 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
199 'DEF:upstream=%s:upstream:AVERAGE' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
200 'DEF:downstream=%s:downstream:AVERAGE' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
201 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
202 'DEF:nmup_=%s:nmup:AVERAGE' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
203 'DEF:nmupmin_=%s:nmup:MIN' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
204 'DEF:nmupmax_=%s:nmup:MAX' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
205 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
206 'DEF:nmdown_=%s:nmdown:AVERAGE' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
207 'DEF:nmdownmin_=%s:nmdown:MIN' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
208 'DEF:nmdownmax_=%s:nmdown:MAX' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
209 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
210 'DEF:attenup=%s:attenup:AVERAGE' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
211 'DEF:attenupmin=%s:attenup:MIN' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
212 'DEF:attenupmax=%s:attenup:MAX' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
213 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
214 'DEF:attendown=%s:attendown:AVERAGE' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
215 'DEF:attendownmin=%s:attendown:MIN' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
216 'DEF:attendownmax=%s:attendown:MAX' % rrdname, |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
217 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
218 'CDEF:nmup=nmup_,10,*', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
219 'CDEF:nmupmin=nmupmin_,10,*', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
220 'CDEF:nmupmax=nmupmax_,10,*', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
221 'CDEF:nmupdif=nmupmax,nmupmin,-', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
222 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
223 'CDEF:nmdown=nmdown_,10,*', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
224 'CDEF:nmdownmin=nmdownmin_,10,*', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
225 'CDEF:nmdownmax=nmdownmax_,10,*', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
226 'CDEF:nmdowndif=nmdownmax,nmdownmin,-', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
227 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
228 'CDEF:attenupdif=attenupmax,attenupmin,-', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
229 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
230 'CDEF:attendowndif=attendownmax,attendownmin,-', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
231 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
232 'LINE0:nmupmin#000000:', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
233 'AREA:nmupdif#5c5cff::STACK', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
234 'LINE1:nmup#0000ff:Noise Margin - Up (1/10 dB)', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
235 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
236 'LINE0:nmdownmin#000000:', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
237 'AREA:nmdowndif#009a00::STACK', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
238 'LINE1:nmdown#00ff00:Noise Margin - Down (1/10 dB)', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
239 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
240 'LINE0:attenupmin#000000:', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
241 'AREA:attenupdif#f98100::STACK', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
242 'LINE1:attenup#ff0000:Attenuation - Up', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
243 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
244 'LINE0:attendownmin#000000:', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
245 'AREA:attendowndif#aaaaaa::STACK', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
246 'LINE1:attendown#000000:Attenuation - Down') |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
247 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
248 rrdtool.graph("%s-hour-link.png" % (graphbasename), |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
249 '--width', '1024', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
250 '--height', '256', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
251 '--start', 'end - 7d', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
252 '--end', 'now', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
253 *linkargs) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
254 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
255 rrdtool.graph("%s-daily-link.png" % (graphbasename), |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
256 '--width', '1024', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
257 '--height', '256', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
258 '--start', 'end - 365d', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
259 '--end', 'now', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
260 *linkargs) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
261 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
262 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
263 rrdtool.graph("%s-hour-signal.png" % (graphbasename), |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
264 '--width', '1024', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
265 '--height', '256', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
266 '--start', 'end - 7d', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
267 '--end', 'now', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
268 *signalargs) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
269 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
270 rrdtool.graph("%s-daily-signal.png" % (graphbasename), |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
271 '--width', '1024', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
272 '--height', '256', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
273 '--start', 'end - 365d', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
274 '--end', 'now', |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
275 *signalargs) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
276 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
277 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
278 if __name__ == "__main__": |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
279 if options.update: |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
280 try: |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
281 os.stat(rrdname) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
282 except OSError, e: |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
283 if e.errno == 2: |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
284 print "rrd not found, creating.." |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
285 makerrd(rrdname) |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
286 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
287 doupdate() |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
288 |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
289 if options.graph: |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
290 gengraph() |
98fe11ea4c82
Initial commit of Billion ADSL stats monitor using RRD.
darius@Inchoate
parents:
diff
changeset
|
291 |