-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.php
177 lines (157 loc) · 8.91 KB
/
index.php
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?php
include("class/Node.php");
$delay=30;
header("Refresh: $delay;");
$type = "System";
$mac = "14cc2091ecd0";
if(isset($_GET['type']))
$type = $_GET['type'];
if($type == "Node"){
if(isset($_GET['mac']))
$mac = $_GET['mac'];
}
$config = json_decode(file_get_contents("config.json"),true);
?>
<html>
<head>
<title><?php echo $config["communityName"]; ?> Statistics</title>
<!-- Bootstrap core CSS -->
<link href="lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="style.css" rel="stylesheet">
<script type="text/javascript" src="lib/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="lib/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" >
$('#myTabs a').click(function (e) {
e.preventDefault()
$(this).tab('show')
})
</script>
</head>
<body>
<div class="container">
<div class="header clearfix">
<!--<nav>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#">About</a></li>
<li role="presentation"><a href="#">Contact</a></li>
</ul>
</nav>-->
<h3 class="text-muted"><img src="<?php echo $config["logoUrl"]; ?>" height="50"/> <?php echo $config["communityName"]; ?> Statistics
<?php
if($type == "Node"){
$node = new Node();
$node->initFromFile($mac);
echo " - Node: ".$node->getNodeinfo()->getHostname();
};
?>
</h3>
</div>
<br>
<div class="row">
<div class="col-lg-12">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#hour" aria-controls="home" role="tab" data-toggle="tab">Hour</a></li>
<li role="presentation"><a href="#day" aria-controls="day" role="tab" data-toggle="tab">Day</a></li>
<li role="presentation"><a href="#week" aria-controls="week" role="tab" data-toggle="tab">Week</a></li>
<li role="presentation"><a href="#month" aria-controls="month" role="tab" data-toggle="tab">Month</a></li>
<li role="presentation"><a href="#year" aria-controls="year" role="tab" data-toggle="tab">Year</a></li>
</ul>
<?php
if($type == "System"){
?>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="hour">
<img src="getSystemGraph.php?type=clients&interval=1H&width=800" />
<img src="getSystemGraph.php?type=nodes&interval=1H&width=800" />
<img src="getSystemGraph.php?type=firmware&interval=1H&width=800" />
<img src="getSystemGraph.php?type=hardware&interval=1H&width=800" />
<img src="getSystemGraph.php?type=meshConnections&interval=1H&width=800" />
</div>
<div role="tabpanel" class="tab-pane" id="day">
<img src="getSystemGraph.php?type=clients&interval=1D&width=800" />
<img src="getSystemGraph.php?type=nodes&interval=1D&width=800" />
<img src="getSystemGraph.php?type=firmware&interval=1D&width=800" />
<img src="getSystemGraph.php?type=hardware&interval=1D&width=800" />
<img src="getSystemGraph.php?type=meshConnections&interval=1D&width=800" />
</div>
<div role="tabpanel" class="tab-pane" id="week">
<img src="getSystemGraph.php?type=clients&interval=1W&width=800" />
<img src="getSystemGraph.php?type=nodes&interval=1W&width=800" />
<img src="getSystemGraph.php?type=firmware&interval=1W&width=800" />
<img src="getSystemGraph.php?type=hardware&interval=1W&width=800" />
<img src="getSystemGraph.php?type=meshConnections&interval=1W&width=800" />
</div>
<div role="tabpanel" class="tab-pane" id="month">
<img src="getSystemGraph.php?type=clients&interval=1m&width=800" />
<img src="getSystemGraph.php?type=nodes&interval=1m&width=800" />
<img src="getSystemGraph.php?type=firmware&interval=1m&width=800" />
<img src="getSystemGraph.php?type=hardware&interval=1m&width=800" />
<img src="getSystemGraph.php?type=meshConnections&interval=1m&width=800" />
</div>
<div role="tabpanel" class="tab-pane" id="year">
<img src="getSystemGraph.php?type=clients&interval=1Y&width=800" />
<img src="getSystemGraph.php?type=nodes&interval=1Y&width=800" />
<img src="getSystemGraph.php?type=firmware&interval=1Y&width=800" />
<img src="getSystemGraph.php?type=hardware&interval=1Y&width=800" />
<img src="getSystemGraph.php?type=meshConnections&interval=1Y&width=800" />
</div>
</div>
<?php
}
if($type == "Node"){
?>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="hour">
<img src="getNodeGraph.php?interval=1H&mac=<?php echo $mac;?>&type=clients" />
<img src="getNodeGraph.php?interval=1H&mac=<?php echo $mac;?>&type=traffic" />
<img src="getNodeGraph.php?interval=1H&mac=<?php echo $mac;?>&type=trafficPackages" />
<img src="getNodeGraph.php?interval=1H&mac=<?php echo $mac;?>&type=memoryUsage" />
<img src="getNodeGraph.php?interval=1H&mac=<?php echo $mac;?>&type=rootfsUsage" />
<img src="getNodeGraph.php?interval=1H&mac=<?php echo $mac;?>&type=loadavg" />
</div>
<div role="tabpanel" class="tab-pane" id="day">
<img src="getNodeGraph.php?interval=1D&mac=<?php echo $mac;?>&type=clients" />
<img src="getNodeGraph.php?interval=1D&mac=<?php echo $mac;?>&type=traffic" />
<img src="getNodeGraph.php?interval=1D&mac=<?php echo $mac;?>&type=trafficPackages" />
<img src="getNodeGraph.php?interval=1D&mac=<?php echo $mac;?>&type=memoryUsage" />
<img src="getNodeGraph.php?interval=1D&mac=<?php echo $mac;?>&type=rootfsUsage" />
<img src="getNodeGraph.php?interval=1D&mac=<?php echo $mac;?>&type=loadavg" />
</div>
<div role="tabpanel" class="tab-pane" id="week">
<img src="getNodeGraph.php?interval=1W&mac=<?php echo $mac;?>&type=clients" />
<img src="getNodeGraph.php?interval=1W&mac=<?php echo $mac;?>&type=traffic" />
<img src="getNodeGraph.php?interval=1W&mac=<?php echo $mac;?>&type=trafficPackages" />
<img src="getNodeGraph.php?interval=1W&mac=<?php echo $mac;?>&type=memoryUsage" />
<img src="getNodeGraph.php?interval=1W&mac=<?php echo $mac;?>&type=rootfsUsage" />
<img src="getNodeGraph.php?interval=1W&mac=<?php echo $mac;?>&type=loadavg" />
</div>
<div role="tabpanel" class="tab-pane" id="month">
<img src="getNodeGraph.php?interval=1m&mac=<?php echo $mac;?>&type=clients" />
<img src="getNodeGraph.php?interval=1m&mac=<?php echo $mac;?>&type=traffic" />
<img src="getNodeGraph.php?interval=1m&mac=<?php echo $mac;?>&type=trafficPackages" />
<img src="getNodeGraph.php?interval=1m&mac=<?php echo $mac;?>&type=memoryUsage" />
<img src="getNodeGraph.php?interval=1m&mac=<?php echo $mac;?>&type=rootfsUsage" />
<img src="getNodeGraph.php?interval=1m&mac=<?php echo $mac;?>&type=loadavg" />
</div>
<div role="tabpanel" class="tab-pane" id="year">
<img src="getNodeGraph.php?interval=1Y&mac=<?php echo $mac;?>&type=clients" />
<img src="getNodeGraph.php?interval=1Y&mac=<?php echo $mac;?>&type=traffic" />
<img src="getNodeGraph.php?interval=1Y&mac=<?php echo $mac;?>&type=trafficPackages" />
<img src="getNodeGraph.php?interval=1Y&mac=<?php echo $mac;?>&type=memoryUsage" />
<img src="getNodeGraph.php?interval=1Y&mac=<?php echo $mac;?>&type=rootfsUsage" />
<img src="getNodeGraph.php?interval=1Y&mac=<?php echo $mac;?>&type=loadavg" />
</div>
</div>
<?php
}
?>
</div>
</div>
</div> <!-- /container -->
</body>
</html>