-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmonitor_tab.htm
250 lines (220 loc) · 8.42 KB
/
monitor_tab.htm
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
<%+header%>
<h2><%:Maxwell Mesh Monitor%></h2>
<h3>Mesh nodes and internet connection <input id="buttonNodes" type="button" onclick="noderefresh()"> </h3>
<p id="internet">Internet connection status will go here</p>
<p id="nodes">Nodes will go here</p>
<br>
<h3>Test download from internet <input id="buttonDownload" type="button" onclick="myDownload()" value="Run"> </h3>
<pre id="download">Test download result here</pre>
<br>
<h3>Speedtest of internet <input type="button" onclick="mySpeedtest()" value="Run"> </h3>
<pre id="speedtest">Speedtest result here</pre>
<br>
<h3>Bandwidth between me and nodes <input type="button" onclick="myBandwidth()" value="Run"> </h3>
<pre id="bandwidth">Bandwidth result here</pre>
<br>
<h3>Super-cool network map <input type="button" onclick="myMap()" value="Run"> </h3>
<div id="map"><pre>Map link will appear here</pre></div>
<br>
<h3>Trace of path to each node <input type="button" onclick="myTraceall()" value="Run"> </h3>
<pre id="traceall">Output will go here</pre>
<br>
<h3>Routing decision table for this node <input id="buttonBatctlo" type="button" onclick="myBatctlo()" value="Run"> </h3>
<pre id="batctlo">Output will go here</pre>
<br>
<h3>Tails of mesh node logs <input type="button" onclick="myLogtails()" value="Run"> </h3>
<pre id="logtails">Output will go here</pre>
<br>
<h3>Modify mesh node setup</h3>
<form>
<label for="nodepass">Root Login Password:</label>
<input type="text" id="nodepass" value=""> <input type="button" value="Change Root Login Password" onclick="changenodepass()"><br><br>
<label for="apchange">Access Point SSID:</label> <input type="text" id="apssid" value="">
<label for="apchange">and Password:</label> <input type="text" id="appass" value="">
<input type="button" value="Change Access Point SSID and Password" onclick="changeapssidpass()"><br><br>
<label for="messchange">Hidden Mesh Name:</label> <input type="text" id="meshname" value="">
<label for="apchange">and Password:</label> <input type="text" id="meshpass" value="">
<input type="button" value="Change Hidden Mesh Name and Password" onclick="changemeshnamepass()"><br>
</form>
<pre id="commandout">Command output here</pre>
<br>
<h3>Other misc setup</h3>
<form>
<input type="button" value="Update these scripts from github" onclick="updatehaasmesh()"> <input type="button" value="Update the firmware from dropbox" onclick="updatefirmware()">
<input type="button" value="Reboot node(s)" onclick="rebootnode()"> <input type="button" value="Reset node(s) to factory state" onclick="factoryreset()">
<br>
<input type="button" value="Rotate Luma ethernet ports" onclick="rotatelumaeth()">
<br>
</form>
<pre id="othercommandout">Command output here</pre>
<br>
Maxwell mesh wifi is open-source, by DrAndyHaas. <a href="https://github.com/drandyhaas/haasmesh">All code available in github here.</a>
<script>
window.onload = onLoad();
var noderefreshtimer
var noderefreshing
function onLoad(){
noderefreshing=0
noderefresh()
postcmdval("/root/script/getapssid.sh","apssid")
postcmdval("/root/script/getmeshname.sh","meshname")
}
function noderefresh(){
if (noderefreshing){
noderefreshing=0
clearInterval(noderefreshtimer)
document.getElementById("buttonNodes").value="Start refreshing"
}
else {
noderefreshing=1
myNodes()
document.getElementById("buttonNodes").value="Stop refreshing"
noderefreshtimer = setInterval(myNodes,30000)
}
}
function changenodepass(){
if (confirm("Do you really want to change the root login password?")){
document.getElementById("commandout").innerHTML="working...";
postcmd("/root/script/setpasswds.sh "+document.getElementById("nodepass").value,"commandout");
}
}
function changeapssidpass(){
if (confirm("Do you really want to change the access point SSID and password?")){
document.getElementById("commandout").innerHTML="working...";
postcmd("/root/script/setapssidpw.sh "+document.getElementById("apssid").value+" "+document.getElementById("appass").value,"commandout");
}
}
function changemeshnamepass(){
if (confirm("Do you really want to change the hidden mesh name and password?")){
document.getElementById("commandout").innerHTML="working...";
postcmd("/root/script/setmeshssidpw.sh "+document.getElementById("meshname").value+" "+document.getElementById("meshpass").value,"commandout");
}
}
function myNodes() {
//document.getElementById("internet").innerHTML="working...";
postcmd("/root/script/internethtml.sh","internet");
//document.getElementById("nodes").innerHTML="working...";
postcmd("/root/script/nodeshtml.sh","nodes");
}
function removeNode(n) {
if (confirm("Do you really want to forget about node "+n+"?")){
postcmd("/root/script/removenode.sh "+n,"nodes");
//postcmd("/root/script/nodeshtml.sh","nodes");
}
}
function flashNode(n) {
document.getElementById("othercommandout").innerHTML="Trying to flash LED on node "+n+"...";
postcmd("/root/script/flashlednode.sh "+n,"othercommandout");
}
function myTraceall() {
document.getElementById("traceall").innerHTML="working...";
postcmd("/root/script/traceall.sh","traceall");
}
function myBatctlo() {
document.getElementById("batctlo").innerHTML="working...";
postcmd("/root/script/batctlo.sh","batctlo");
}
function myDownload() {
document.getElementById("download").innerHTML="working...";
postcmd("/root/script/speed_download.sh","download");
}
function mySpeedtest() {
document.getElementById("speedtest").innerHTML="working...";
postcmd("/root/script/speedtest.sh","speedtest");
}
function myBandwidth() {
document.getElementById("bandwidth").innerHTML="working...";
postcmd("/root/script/speednodes.sh","bandwidth");
}
function rotatelumaeth() {
if (confirm("Do you really want to rotate the Luma ethernet ports on this node?")){
document.getElementById("othercommandout").innerHTML="working...";
postcmd("/root/script/rotatelumaeth.sh","othercommandout");
}
}
function updatehaasmesh() {
if (confirm("Do you really want to update the scripts (on all nodes if this is a hub!)?")){
document.getElementById("othercommandout").innerHTML="working...";
postcmd("/root/script/foreachnodeparallel.sh \" /root/script/updatehaasmesh.sh \" ","othercommandout");
}
}
function factoryreset() {
if (confirm("Do you really want to FACTORY RESET (on ALL NODES if this is a hub!)??!!")){
document.getElementById("othercommandout").innerHTML="working...";
postcmd("/root/script/foreachnodeparallel.sh \" /root/script/factoryreset10s.sh & \" ","othercommandout");
}
}
function rebootnode() {
if (confirm("Do you really want to reboot (on ALL NODES if this is a hub!)?")){
document.getElementById("othercommandout").innerHTML="working...";
postcmd("/root/script/foreachnodeparallel.sh \" /root/script/reboot10s.sh & \" ","othercommandout");
}
}
function updatefirmware() {
if (confirm("Do you really want to update the firmware (on ALL NODES if this is a hub!)?")){
document.getElementById("othercommandout").innerHTML="working...";
postcmd("/root/script/foreachnodeparallel.sh \" /root/script/updatefirmware.sh \" ","othercommandout");
}
}
function myLogtails() {
document.getElementById("logtails").innerHTML="working...";
postcmd("/root/script/foreachnode.sh \"logread|tail\" ","logtails");
}
function myMap() {
document.getElementById("map").innerHTML="working...";
postcmd("/root/script/makebatmap.sh","map");
}
function postcmd(cmd,elem) {
(new XHR()).post("<%=luci.dispatcher.build_url("admin", "haas_mesh_tab", "webcmd")%>", {"cmd":cmd}, function(x) {
document.getElementById(elem).innerHTML = x.response ;
});
}
function postcmdval(cmd,elem) {
(new XHR()).post("<%=luci.dispatcher.build_url("admin", "haas_mesh_tab", "webcmd")%>", {"cmd":cmd}, function(x) {
document.getElementById(elem).value = x.response ;
});
}
</script>
<style>
.reddot {
height: 15px;
width: 15px;
background-color: #d00;
border-radius: 50%;
display: inline-block;
}
</style>
<style>
.yellodot {
height: 15px;
width: 15px;
background-color: #dd0;
border-radius: 50%;
display: inline-block;
}
</style>
<style>
.greendot {
height: 15px;
width: 15px;
background-color: #0d0;
border-radius: 50%;
display: inline-block;
}
</style>
<style>
table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
border: 1px solid #ddd;
}
th, td {
text-align: center;
padding: 8px;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
</style>
<%+footer%>