mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add get ip and netstat diagnostics tools
This commit is contained in:
parent
9b258aedb8
commit
2f4e19176c
3 changed files with 38 additions and 5 deletions
|
@ -158,6 +158,12 @@ function index()
|
||||||
|
|
||||||
page = entry({"admin", "network", "diag_speedtest"}, post("diag_speedtest"), nil)
|
page = entry({"admin", "network", "diag_speedtest"}, post("diag_speedtest"), nil)
|
||||||
page.leaf = true
|
page.leaf = true
|
||||||
|
|
||||||
|
page = entry({"admin", "network", "diag_getip"}, post("diag_getip"), nil)
|
||||||
|
page.leaf = true
|
||||||
|
|
||||||
|
page = entry({"admin", "network", "diag_netstat"}, post("diag_netstat"), nil)
|
||||||
|
page.leaf = true
|
||||||
-- end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -438,6 +444,14 @@ function diag_iperf3(addr)
|
||||||
diag_command("iperf3 -c %q 2>&1", addr)
|
diag_command("iperf3 -c %q 2>&1", addr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function diag_getip(addr)
|
||||||
|
diag_command("curl %q", addr)
|
||||||
|
end
|
||||||
|
|
||||||
|
function diag_netstat(addr)
|
||||||
|
diag_command("netstat -lapute 2>&1", "openmptcprouter.com")
|
||||||
|
end
|
||||||
|
|
||||||
function diag_speedtest(addr)
|
function diag_speedtest(addr)
|
||||||
if addr then
|
if addr then
|
||||||
diag_command("speedtestc --server %q 2>&1", addr)
|
diag_command("speedtestc --server %q 2>&1", addr)
|
||||||
|
|
|
@ -11,11 +11,14 @@ local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6")
|
||||||
local has_traceroute6 = fs.access("/usr/bin/traceroute6")
|
local has_traceroute6 = fs.access("/usr/bin/traceroute6")
|
||||||
local has_speedtest = fs.access("/usr/sbin/speedtestc")
|
local has_speedtest = fs.access("/usr/sbin/speedtestc")
|
||||||
local has_iperf3 = fs.access("/usr/bin/iperf3")
|
local has_iperf3 = fs.access("/usr/bin/iperf3")
|
||||||
|
local has_curl = fs.access("/usr/bin/curl")
|
||||||
|
local has_netstat = fs.access("/bin/netstat")
|
||||||
|
|
||||||
local dns_host = luci.config.diag and luci.config.diag.dns or "dev.openwrt.org"
|
local dns_host = luci.config.diag and luci.config.diag.dns or "dev.openwrt.org"
|
||||||
local ping_host = luci.config.diag and luci.config.diag.ping or "dev.openwrt.org"
|
local ping_host = luci.config.diag and luci.config.diag.ping or "dev.openwrt.org"
|
||||||
local route_host = luci.config.diag and luci.config.diag.route or "dev.openwrt.org"
|
local route_host = luci.config.diag and luci.config.diag.route or "dev.openwrt.org"
|
||||||
local iperf3_host = luci.config.diag and luci.config.diag.iperf3 or "ping-ams1.online.net"
|
local iperf3_host = luci.config.diag and luci.config.diag.iperf3 or "ping-ams1.online.net"
|
||||||
|
local getip_host = luci.config.diag and luci.config.diag.getip or "ifconfig.co"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||||
|
@ -69,7 +72,7 @@ local iperf3_host = luci.config.diag and luci.config.diag.iperf3 or "ping-ams1.o
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div style="width:26%; float:left">
|
<div style="width:23%; float:left">
|
||||||
<input style="margin: 5px 0" type="text" value="<%=ping_host%>" name="ping" /><br />
|
<input style="margin: 5px 0" type="text" value="<%=ping_host%>" name="ping" /><br />
|
||||||
<% if has_ping6 then %>
|
<% if has_ping6 then %>
|
||||||
<select name="ping_proto" style="width:auto">
|
<select name="ping_proto" style="width:auto">
|
||||||
|
@ -82,7 +85,7 @@ local iperf3_host = luci.config.diag and luci.config.diag.iperf3 or "ping-ams1.o
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="width:26%; float:left">
|
<div style="width:23%; float:left">
|
||||||
<input style="margin: 5px 0" type="text" value="<%=route_host%>" name="traceroute" /><br />
|
<input style="margin: 5px 0" type="text" value="<%=route_host%>" name="traceroute" /><br />
|
||||||
<% if has_traceroute6 then %>
|
<% if has_traceroute6 then %>
|
||||||
<select name="traceroute_proto" style="width:auto">
|
<select name="traceroute_proto" style="width:auto">
|
||||||
|
@ -99,25 +102,39 @@ local iperf3_host = luci.config.diag and luci.config.diag.iperf3 or "ping-ams1.o
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="width:26%; float:left;">
|
<div style="width:23%; float:left;">
|
||||||
<input style="margin: 5px 0" type="text" value="<%=dns_host%>" name="nslookup" /><br />
|
<input style="margin: 5px 0" type="text" value="<%=dns_host%>" name="nslookup" /><br />
|
||||||
<input type="button" value="<%:Nslookup%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.nslookup)" />
|
<input type="button" value="<%:Nslookup%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.nslookup)" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if has_speedtest and false then %>
|
<% if has_speedtest and false then %>
|
||||||
<div style="width:10%; float:left;">
|
<div style="width:23%; float:left;">
|
||||||
<input style="margin: 5px 0" type="text" value="" name="speedtest" placeholder="alternate server" /><br />
|
<input style="margin: 5px 0" type="text" value="" name="speedtest" placeholder="alternate server" /><br />
|
||||||
<input type="button" value="<%:Speedtest%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.speedtest)" />
|
<input type="button" value="<%:Speedtest%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.speedtest)" />
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if has_iperf3 then %>
|
<% if has_iperf3 then %>
|
||||||
<div style="width:10%; float:left;">
|
<div style="width:23%; float:left;">
|
||||||
<input style="margin: 5px 0" type="text" value="<%=iperf3_host%>" name="iperf3" /><br />
|
<input style="margin: 5px 0" type="text" value="<%=iperf3_host%>" name="iperf3" /><br />
|
||||||
<input type="button" value="<%:Iperf3%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.iperf3)" />
|
<input type="button" value="<%:Iperf3%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.iperf3)" />
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if has_curl then %>
|
||||||
|
<div style="width:23%; float:left;">
|
||||||
|
<input style="margin: 5px 0" type="hidden" value="<%=getip_host%>" name="getip" /><br />
|
||||||
|
<input type="button" value="<%:Get public IP%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.getip)" />
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if has_netstat then %>
|
||||||
|
<div style="width:23%; float:left;">
|
||||||
|
<input style="margin: 5px 0" type="hidden" value="" name="netstat" /><br />
|
||||||
|
<input type="button" value="<%:Netstat%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.netstat)" />
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<br style="clear:both" /><br />
|
<br style="clear:both" /><br />
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -5,6 +5,8 @@ uci -q batch <<-EOF >/dev/null
|
||||||
set luci.diag.ping="openmptcprouter.com"
|
set luci.diag.ping="openmptcprouter.com"
|
||||||
set luci.diag.dns="openmptcprouter.com"
|
set luci.diag.dns="openmptcprouter.com"
|
||||||
set luci.diag.route="openmptcprouter.com"
|
set luci.diag.route="openmptcprouter.com"
|
||||||
|
set luci.diag.iperf3="ping-ams1.online.net"
|
||||||
|
set luci.diag.getip="ip.openmptcprouter.com"
|
||||||
commit luci
|
commit luci
|
||||||
EOF
|
EOF
|
||||||
rm -f /tmp/luci-indexcache
|
rm -f /tmp/luci-indexcache
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue