1
0
mirror of https://github.com/moexe/FFFGateway-Monitoring.git synced 2024-12-22 02:03:42 +01:00

list l2tp Router

This commit is contained in:
Robert Langhammer 2017-01-24 21:20:14 +00:00
parent 23fbd72fcf
commit b21cfb036e
5 changed files with 43 additions and 31 deletions

View File

@ -6,7 +6,7 @@
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Responsive Menu Test</title>
<title>Status der Gateways in den Hoods HAS und HAS-SUED</title>
<!-- Apply Responsive Menu CSS -->
<link href="css/responsive-menu.css" rel="stylesheet">
@ -155,7 +155,7 @@
<header>
<div class="wrapper">
<div class="brand">
<p><a href="#" class="logo">FFF</a></p>
<p><a href="index.php" class="logo">FFF</a></p>
</div>
<!-- START Responsive Menu HTML -->
@ -183,12 +183,10 @@
<li><a href="http://5.189.142.26:8080">fff-roffl</a></li>
<li><a href="http://163.172.161.233:8082">fff-rola1</a></li>
</ul></li>
<li><a href="#">Main Item 3</a>
<li><a href="#">Router via l2tp</a>
<ul>
<li><a href="#">Sub Item 1</a></li>
<li><a href="#">Sub Item 2</a></li>
<li><a href="#">Sub Item 3</a></li>
<li><a href="#">Sub Item 4</a></li>
<li><a href="routers.php">has-sued</a></li>
<li><a href="#">has (geht noch net)</a></li>
</ul></li>
</ul>
</nav>

19
html/routers.html Normal file
View File

@ -0,0 +1,19 @@
<div id="content">
<H1>Router via l2tp in der has-sued</H1>
<?php
$routers = shell_exec('sudo -n /var/www/html/has-mon/sensors/l2tp-routers.sh');
$router = explode(PHP_EOL, $routers);
for($i = 1; $i < count($router); ++$i) {
echo "<a href=\"https://monitoring.freifunk-franken.de/routers?q=^$router[$i]\$\">$router[$i]</a><br>";
}
--$i;
echo "<br>l2tp Router has-sued: $i"
?>
</div>
</div></div>
</div></div></div>
</body>
</html>

View File

@ -7,29 +7,6 @@ echo "<p align=center>Hoods: has und has-süd";
?>
<div class="ampel">
<table border="0">
<tr><td><b>Status</b></td></tr>
<?php
$uptime = shell_exec('uptime --pretty');
echo "<tr><td>Uptime:</td><td>$uptime</td><td><img src=img/ampelgr.jpg></td></tr>";
$load = shell_exec('cat /proc/loadavg');
$load = explode(" ", $load);
$load[0] > 2? $ampel = 'ampelgelb.jpg' : $ampel = 'ampelgr.jpg';
$load[0] > 3? $ampel = 'ampelrot.jpg' : "";
echo "<tr><td>Load:</td><td>$load[0] $load[1] $load[2]</td><td><img src=img/$ampel></td></tr>";
$leases = shell_exec('dhcp-lease-list --parsable | wc -l');
$leases < 3? $ampel = 'ampelgelb.jpg' : $ampel = 'ampelgr.jpg';
$leases > 120? $ampel = 'ampelrot.jpg': "";
echo "<tr><td>DHCP:</td><td>Leases in use: <b>$leases</b></td><td><img src=img/$ampel></td></tr>";
?>
</table>
<hr />
<?php
$l2tp = shell_exec('ip l | grep -c l2tp');
echo "<b>Anzahl der l2tp Tunnel</b><br>has-sued: <b>$l2tp</b><br><br>";
@ -58,7 +35,7 @@ echo $clients;
<div class=mrtg>
<b>Speedtest der has und has-sued GWs (Kabel, wr-841, l2tp)</b>
<b>Speedtest has und has-sued (Kabel, wr-841, l2tp)</b>
<img src="http://163.172.161.233/top/img/speed.png">
<hr />

6
routers.php Normal file
View File

@ -0,0 +1,6 @@
<?php
include 'html/responsive-menu.html';
include 'html/routers.html';
?>

12
sensors/l2tp-routers.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
# Diese Datei in /etc/sudoers eintragen!!!! z.B. so:
# www-data ALL=(ALL) NOPASSWD: /var/www/html/has-mon/sensors/l2tp-routers.sh
ips=$(ip l2 s tunnel | awk '/From/ {print $4}')
journalctl -u tunneldigger-broker-sued.service > /tmp/td.log
for ip in $ips; do
rname="$rname$(grep $ip /tmp/td.log | awk '/Creating/ {gsub ("\\(","");gsub ("\\)",""); print $10"\\n"}')"
done
echo -e $rname | grep -v ^" " | uniq | sort -f