fix logout
[GitHub/Stricted/speedport-hybrid-php-api.git] / rrd / rrd.php
CommitLineData
aed690e4
S
1<?php
2$path = "/home/rrd/rrd/";
3$password = 'your_router_password';
4$url = 'http://speedport.ip/';
5
8e87a43d 6if (!file_exists($path.'dsl.rrd')) {
8ac88be2
S
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);
aed690e4 32}
8ac88be2 33
8e87a43d 34if (!file_exists($path.'lteinfo.rrd')) {
8ac88be2
S
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);
aed690e4
S
46}
47
48require_once('../SpeedportHybrid.class.php');
e58a96d1
S
49$sp = new SpeedportHybrid($url);
50$sp->login($password);
aed690e4 51$data = $sp->getData('dsl');
8ac88be2
S
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']);
53rrd_update($path.'dsl.rrd', $options);
aed690e4
S
54
55$data = $sp->getData('lteinfo');
8ac88be2
S
56$options = array(time().':'.$data['rsrp'].':'.$data['rsrq']);
57rrd_update($path.'lteinfo.rrd', $options);
aed690e4
S
58
59$sp->logout();