This repository was archived by the owner on Dec 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonitor.php
349 lines (334 loc) · 13.9 KB
/
monitor.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- Sets initial viewport load and disables zooming -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Monitor - HTTP-ICN Monitor</title>
<link rel="shortcut icon" href="small.ico"/>
<link rel="bookmark" href="small.ico"/>
<!-- site css -->
<style type="text/css">
#allmap{width:100%;height:1600px;}
.panel-primary>.panel-body
{
max-height:500px;
overflow:auto;
}
.btn-refresh
{
</style>
<link rel="stylesheet" href="css/1.css">
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,800,700,400italic,600italic,700italic,800italic,300italic" rel="stylesheet" type="text/css">
<!-- javascript .js-->
<script type="text/javascript" src="js/1.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=ATBGX8WfpHMD3C8EL8xTOfvR"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/CurveLine/1.5/src/CurveLine.min.js"></script>
<script type="text/javascript" src="js/my.js"></script>
<script type="text/javascript" src="js/map.js"></script>
<script type="text/javascript" src="js/post.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
<script type="text/javascript" src="js/md5.js"></script>
<script type="text/javascript">
//$(function () { $("[data-toggle='popover']").popover(); });
$(function () { $("[data-toggle='tooltip']").tooltip(); });
//displayNode($('.nodelist .active span').attr('id'));
//displayContent($('.prefixlist .active span').attr('id'));
</script>
<?php
//连接数据库并选中数据库
$con = mysql_connect("localhost","root","11");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ICN_monitor", $con);
?>
</head>
<body style="background-color: #f1f2f6;">
<!--Header-->
<div class="docs-header">
<!--nav-->
<nav class="navbar navbar-default navbar-custom" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="monitor.php"><img src="img/logo.png" height="40"></a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li><a class="nav-link current" href="monitor.php">Monitor</a></li>
<li><a class="nav-link" href="documentation.php">Documentation</a></li>
</ul>
</div>
</div>
</nav>
</div>
<!--Document-->
<div class="container documents">
<div class="row">
<!--侧边栏,用来选节点-->
<div class="col-md-3 col-lg-3">
<!-- 节点列表 -->
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">ICN Router List<button type="button" class="btn btn-primary btn-block " style="display:inline-block;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;width:auto;min-width:10px;white-space:nowrap;vertical-align:baseline;border-radius:10px;float:right" onclick="loadJs('js/my.js');displaylist();displayNode($('.nodelist .active').attr('id'));activate();">Refresh</button></h3>
</div>
<div class="panel-body">
<div class="list-group nodelist">
</div>
</div>
</div>
<!-- 节点信息 -->
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Router Infomation</h3>
</div>
<div class="panel-body">
Mouse hovering on <b><detailed></b> tag to get more infos.
</div>
<ul class="list-group">
<li class="list-group-item"><b>IP: </b><span id="ip"></span></li>
<li class="list-group-item"><b>Memory: </b><span id="mem"></span><span class="badge" title="" data-html=true data-container="body" data-toggle="popover" data-placement="right" data-content="">Detailed</span></li>
<li class="list-group-item"><b>CPU: </b><span class="badge" data-html=true title="" data-container="body" data-toggle="popover" data-placement="right" data-content="">Detailed</span><br><span id="c"></span></li>
<li class="list-group-item"><b>Harddisk: </b><span id="hd"></span><span class="badge" title="" data-html=true data-container="body" data-toggle="popover" data-placement="right" data-content="">Detailed</span></li>
<li class="list-group-item"><b>Network: </b><span class="badge" title="" data-container="body" data-toggle="popover" data-html=true data-placement="right" data-content="">Detailed</span><br> <span id="net"></span></li>
<li class="list-group-item"><b>Uptime: </b><span class="badge" title="" data-container="body" data-toggle="popover" data-placement="right" data-html=true htmldata-content="">Detailed</span><br> <span id="upt"></span></li>
</ul>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Prefix List<button type="button" class="btn btn-primary btn-block " style="display:inline-block;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;width:auto;min-width:10px;white-space:nowrap;vertical-align:baseline;border-radius:10px;float:right" onclick="loadJs('js/my.js');displayfib($('.nodelist .active').attr('id'));activate();return true;">Refresh</button></h3>
</div>
<div class="panel-body">
Displays only first 24 characters, mouse hovering on each item to get complete name.
<br/><br/>
<div class="list-group prefixlist">
</div>
</div>
</div>
</div>
<!--主栏,调用百度地图API-->
<div class="col-md-9 col-lg-9">
<div id="allmap"></div>
</div>
</div>
</div>
<!--Footer-->
<div class="site-footer">
<div class="container">
<!--<hr class="dashed" />-->
<div class="copyright clearfix">
<p><b>ICN Monitor</b> <a href="monitor.php">Monitor</a> • <a href="documentation.php">Documentation</a><!-- • <a href="free-psd.html">Free PSD</a> • <a href="color-picker.html">Color Picker</a>--></p>
<p>© 2016-<?php echo date("Y")?> NetVIP Lab in Peking University. All rights reserved.</p>
<p>Advise is welcome! Email us at <span class="connect">[email protected]</span></p>
</div>
</div>
</div>
</body>
</html>
<div class="hide" id="memory">
<table class="table">
<thead>
<tr>
<th>Memory_Total</th><th>Memory_Free</th><th>Visual Memory_Total</th><th>Visual Memory_Used</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="hide" id="cpu">
<table class="table">
<thead>
<tr>
<th>Processor</th><th>Core ID</th><th>CPU name</th><th>CPU Cores</th><th>CPU MHz</th><th>L2 Cache</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="hide" id="harddisk">
<table class="table">
<thead>
<tr>
<th>Total</th><th>Used</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="hide" id="network">
<table class="table">
<thead>
<tr>
<th rowspan="2">Interface</th><th colspan="4">Receive</th><th colspan="4">Transmit</th>
</tr>
<tr>
<th>Bytes</th><th>Packets</th><th>Errors</th><th>Drops</th><th>Bytes</th><th>Packets</th><th>Errors</th><th>Drops</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="hide" id="uptime">
<table class="table">
<thead>
<tr>
<th>Time</th><th>Free Rate</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<button class="hide" id="Alert" data-toggle="modal" data-target="#myModal"></button>
<button class="hide" id="Confirm" data-toggle="modal" data-target="#Conf"></button>
<button class="hide" id="Ensure" data-toggle="modal" data-target="#ensu"></button>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close"
data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title" id="myModalLabel">
Sorry :(
</h4>
</div>
<div class="modal-body">
There is something <span style="color:#C93756">WRONG</span> with this router.<br><br>
<p id="reason"></p>
Do you want to delete it ?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">Cancel
</button>
<button type="button" class="btn btn-primary" onClick="$('#Confirm').click()">
Yes
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
<div class="modal fade" id="Conf" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close"
data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title" id="ConfLabel">
Enter your password
</h4>
</div>
<div class="modal-body">
Please enter your password to delete the router:<br>
<input type="password" id='pass' class="form-control" placeholder="Please enter your password">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">Cancel
</button>
<button type="button" class="btn btn-primary" onClick="Checkpassword();">
Yes
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
<div class="modal fade" id="ensu" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close"
data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title" id="ensuLabel">
Ensure
</h4>
</div>
<div class="modal-body">
Are you sure to delete this router ?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel
</button>
<button type="button" class="btn btn-primary" data-dismiss="modal" onClick="ErrorAlert();">
Yes
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
<script type="text/javascript">
var map = new BMap.Map("allmap");
var PKU_point = new BMap.Point(116.319677,39.996656);//北京大学
map.centerAndZoom(PKU_point, 14);
//map.addControl(new BMap.NavigationControl());
map.enableScrollWheelZoom();
var mapType1 = new BMap.MapTypeControl({mapTypes: [BMAP_NORMAL_MAP,BMAP_HYBRID_MAP]});
var mapType2 = new BMap.MapTypeControl({anchor: BMAP_ANCHOR_TOP_LEFT});
var overView = new BMap.OverviewMapControl();
var pointsip = new Array(); // 以ip为索引的点集
var points = new Array(); // 以id为索引的点集
var lines = new Array(); //当前地图中线的集合
var arrows = new Array(); //当前地图中点的集合
var displaypoints = new Array();
function ErrorAlert()
{
execute('clean.php', {'event':'clean','id':$('.nodelist .active').attr('id')});
}
function addMarker(point,num){
var marker = new BMap.Marker(point);
map.addOverlay(marker);
marker.addEventListener("click", function(){
$('#'+num+' span').click();
});
}
map.addEventListener("zoomend", function () {
clear();//清除
content = $('.prefixlist .active').attr('id');
for(id in points) //对每个节点,查找其fib表里有没有该内容,如果有那么显示线
{
if(content in fibs[id])
{
addArrowLine(map, points[id]['lng'], points[id]['lat'], pointsip[fibs[id][content]['next']]['lng'], pointsip[fibs[id][content]['next']]['lat'], "blue", 5, 0.8, false);
displaypoints.push(points[id]);
displaypoints.push(pointsip[fibs[id][content]['next']]);
}
}
});
var tmp_point;
<?php //把所有结点标出来
$re233 = mysql_query("SELECT * FROM node");
while($row = mysql_fetch_array($re233))
{
echo 'tmp_point = new BMap.Point('.$row['longitude'].','.$row['latitude'].');';
echo "pointsip['".$row['ip']."'] = tmp_point;";
echo "points[".$row['node_id']."] = tmp_point;";
echo "addMarker(tmp_point,".$row['node_id'].");";
}
?>
var nodeactive=-1; var contentactive='';
displaylist();
displayNode($('.nodelist .active').attr('id'));
activate();
var timeId = setInterval("loadJs('js/my.js');displayinfo($('.nodelist .active').attr('id'));checkrouter();",2000);
var timeId2 = setInterval("loadJs('js/my.js');displaylist();displayNode($('.nodelist .active').attr('id'));activate();",86400000);
</script>
<?php
mysql_close($con);
?>