move exceptions and traits into own folder
[GitHub/Stricted/speedport-hybrid-php-api.git] / rrd / rrd.php
1 <?php
2 $path = "/home/rrd/rrd/";
3 $password = 'your_router_password';
4 $url = 'http://speedport.ip/';
5
6 if (!file_exists($path.'dsl.rrd')) {
7 $options = array(
8 "--step", "60",
9 "DS:uactual:GAUGE:120:0:100000",
10 "DS:dactual:GAUGE:120:0:200000",
11 "DS:uattainable:GAUGE:120:0:100000",
12 "DS:dattainable:GAUGE:120:0:200000",
13 "DS:uSNR:GAUGE:120:0:1000",
14 "DS:dSNR:GAUGE:120:0:1000",
15 "DS:uSignal:GAUGE:120:0:1000",
16 "DS:dSignal:GAUGE:120:0:200000",
17 "DS:uLine:GAUGE:120:0:2000",
18 "DS:dLine:GAUGE:120:0:2000",
19 "DS:uCRC:DERIVE:120:0:10000000",
20 "DS:dCRC:DERIVE:120:0:10000000",
21 "DS:uHEC:DERIVE:120:0:10000000",
22 "DS:dHEC:DERIVE:120:0:10000000",
23 "DS:uFEC:DERIVE:120:0:10000000",
24 "DS:dFEC:DERIVE:120:0:10000000",
25 "RRA:AVERAGE:0.5:1:2880",
26 "RRA:MAX:0.5:1:2880",
27 "RRA:AVERAGE:0.5:10:144",
28 "RRA:MAX:0.5:10:144"
29 );
30
31 rrd_create($path.'dsl.rrd', $options);
32 }
33
34 if (!file_exists($path.'lteinfo.rrd')) {
35 $options = array(
36 "--step", "60",
37 "DS:rsrp:GAUGE:120:-200:0",
38 "DS:rsrq:GAUGE:120:-200:0",
39 "RRA:AVERAGE:0.5:1:2880",
40 "RRA:MAX:0.5:1:2880",
41 "RRA:AVERAGE:0.5:10:144",
42 "RRA:MAX:0.5:10:144",
43 );
44
45 rrd_create($path.'lteinfo.rrd', $options);
46 }
47
48 require_once('../SpeedportHybrid.class.php');
49 $sp = new SpeedportHybrid($url);
50 $sp->login($password);
51 $data = $sp->getData('dsl');
52 $options = array(time().':'.$data['Line']['uactual'].':'.$data['Line']['dactual'].':'.$data['Line']['uattainable'].':'.$data['Line']['dattainable'].':'.$data['Line']['uSNR'].':'.$data['Line']['dSNR'].':'.$data['Line']['uSignal'].':'.$data['Line']['dSignal'].':'.$data['Line']['uLine'].':'.$data['Line']['dLine'].':'.$data['Line']['uCRC'].':'.$data['Line']['dCRC'].':'.$data['Line']['uHEC'].':'.$data['Line']['dHEC'].':'.$data['Line']['uFEC'].':'.$data['Line']['dFEC']);
53 rrd_update($path.'dsl.rrd', $options);
54
55 $data = $sp->getData('lteinfo');
56 $options = array(time().':'.$data['rsrp'].':'.$data['rsrq']);
57 rrd_update($path.'lteinfo.rrd', $options);
58
59 $sp->logout();