gluon-status-page: simple status page

This adds a simple status page, which is just a shell script outputting HTML.
On this page the following information is available:

 * hostname
 * uptime
 * loadavg
 * network addresses of br-client
 * memory usage (RAM + ROM)
 * wlan IBSS neighbours (+ links to status pages constructed from MAC)
This commit is contained in:
Nils Schneider 2014-02-04 13:15:53 +01:00
commit 694c22ace7
2 changed files with 71 additions and 9 deletions

View File

@ -0,0 +1,60 @@
#!/bin/sh
linknodes() {
PREFIX=$(uci get network.local_node_route6.target | cut -d: -f 1-4)
sed 's#\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\):\([0-9a-f]\{2\}\)#<a href="http://['$PREFIX':\1\2:\3ff:fe\4:\5\6]/">&</a>#g'
}
echo Content-type: text/html
echo ""
cat <<EOF
<!DOCTYPE html>
<html>
<head>
<title>$(cat /proc/sys/kernel/hostname)</title>
</head>
<body>
EOF
echo "<h1>$(cat /proc/sys/kernel/hostname)</h1>"
echo "<pre>"
echo "Firmware release: $(cat /lib/gluon/release)"
echo
uptime | sed 's/^ \+//'
echo
ip address show dev br-client
echo
free -m
echo
df /rom /overlay
echo "</pre>"
echo "<h2>Neighbours</h2>"
iw dev | grep IBSS -B 4 | grep Interface | cut -d' ' -f2 | while read if
do
echo "<h3>$if</h3>"
echo "<pre>"
iw dev $if link
echo
iw dev $if station dump | linknodes
echo "</pre>"
done
cat <<EOF
</body>
</html>
EOF

View File

@ -1,10 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Status page TODO</title>
</head>
<body>
<p>TODO</p>
</body>
<html>
<head>
<meta http-equiv="refresh" content="0; URL=/cgi-bin/status">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT">
<meta http-equiv="pragma" content="no-cache">
</head>
<body>
<a href="/cgi-bin/status">Redirecting...</a>
</body>
</html>