-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfritz-munin
executable file
·72 lines (53 loc) · 2.08 KB
/
fritz-munin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/python
import sys
import helpers_fritz
fd = helpers_fritz.fritz_fetch()
def mean(vals):
return float(sum(vals))/len(vals)
if 'config' in sys.argv:
print( 'graph_title Fritzbox upload and download')
print( 'graph_vlabel Kbyte/s')
print( 'graph_category network')
print( 'graph_scale no')
print( 'graph_height 220')
print( 'graph_args -l %d -u %d -r'%( # reported upstream and downstream speed
-fd['upstream']/(8*1000),
fd['downstream']/(8*1000),
))
print( 'down.label Download (minute mean)')
print 'down.draw AREA'
print 'down.type GAUGE'
print 'up_bg.label Upload, background (minute mean)'
print 'up_bg.draw AREA'
print 'up_bg.type GAUGE'
print 'up_df.label Upload, default (minute mean)'
print 'up_df.draw STACK'
print 'up_df.type GAUGE'
print 'up_im.label Upload, important (minute mean)'
print 'up_im.draw STACK'
print 'up_im.type GAUGE'
print 'up_rt.label Upload, realtime (minute mean)'
print 'up_rt.draw STACK'
print 'up_rt.type GAUGE'
print 'downmax.label Download (minute max)'
print 'downmax.draw LINE1'
print 'downmax.type GAUGE'
print 'upmax.label Upload (minute max)'
print 'upmax.draw AREA'
print 'upmax.type GAUGE'
else:
print 'down.value %d'%( mean(fd['ds_bps_curr'])/1000, )
print 'up_bg.value %d'%( -mean(fd['us_background_bps_curr'])/1000, )
print 'up_df.value %d'%( -mean(fd['us_default_bps_curr'])/1000, )
print 'up_im.value %d'%( -mean(fd['us_important_bps_curr'])/1000, )
print 'up_rt.value %d'%( -mean(fd['us_realtime_bps_curr'])/1000, )
print 'downmax.value %d'%( max(fd['ds_bps_curr'])/1000, )
# get the peak of sum-at-each-time (not sum of individual peaks)
upmax_l = list( max(z) for z in zip(
fd['us_background_bps_curr'],
fd['us_default_bps_curr'],
fd['us_important_bps_curr'],
fd['us_realtime_bps_curr'],
))
#print upmax_l
print 'upmax.value %d'%( -(max(upmax_l))/1000, )