forked from westfeld/fritz-speed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph-traffic.py
executable file
·45 lines (38 loc) · 1.11 KB
/
graph-traffic.py
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
#!/usr/bin/env python3
"""
graph-traffic.py
"""
import os
import rrdtool
from common import read_configuration
def main():
prefs = read_configuration(
os.path.join(os.path.dirname(__file__), "fritz-speed.ini")
)
for g in prefs["graphs"]:
# graph the data for information about parameters see https://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html
rrdtool.graph(
g["filename"],
"-t",
g["title"],
"-w",
g["graph_width"],
"-h",
g["graph_height"],
"-s",
"end-" + g["interval"] + "s",
"DEF:bytes-up=" + g["rra_filename"] + ":bytes-up:AVERAGE",
"DEF:bytes-down=" + g["rra_filename"] + ":bytes-down:AVERAGE",
prefs["graph_type_down"]
+ ":bytes-down#"
+ prefs["graph_color_down"]
+ ":Downloadrate",
prefs["graph_type_up"]
+ ":bytes-up#"
+ prefs["graph_color_up"]
+ ":Uploadrate",
"-v",
"Transfer rate [B/s]",
)
if __name__ == "__main__":
main()