From b21cfb036e4360af1b9b456e1873c8b50e5fb606 Mon Sep 17 00:00:00 2001 From: Robert Langhammer Date: Tue, 24 Jan 2017 21:20:14 +0000 Subject: [PATCH] list l2tp Router --- html/responsive-menu.html | 12 +++++------- html/routers.html | 19 +++++++++++++++++++ html/start.html | 25 +------------------------ routers.php | 6 ++++++ sensors/l2tp-routers.sh | 12 ++++++++++++ 5 files changed, 43 insertions(+), 31 deletions(-) create mode 100644 html/routers.html create mode 100644 routers.php create mode 100755 sensors/l2tp-routers.sh diff --git a/html/responsive-menu.html b/html/responsive-menu.html index 8dc62e1..002fca5 100644 --- a/html/responsive-menu.html +++ b/html/responsive-menu.html @@ -6,7 +6,7 @@ - Responsive Menu Test + Status der Gateways in den Hoods HAS und HAS-SUED @@ -155,7 +155,7 @@
-

+

@@ -183,12 +183,10 @@
  • fff-roffl
  • fff-rola1
  • -
  • Main Item 3 +
  • Router via l2tp
  • diff --git a/html/routers.html b/html/routers.html new file mode 100644 index 0000000..de52d67 --- /dev/null +++ b/html/routers.html @@ -0,0 +1,19 @@ +
    +

    Router via l2tp in der has-sued

    + +$router[$i]
    "; +} +--$i; +echo "
    l2tp Router has-sued: $i" +?> + +
    +
    + + + + diff --git a/html/start.html b/html/start.html index c16a03a..2920482 100644 --- a/html/start.html +++ b/html/start.html @@ -7,29 +7,6 @@ echo "

    Hoods: has und has-süd"; ?>

    - - - -"; - -$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 ""; - -$leases = shell_exec('dhcp-lease-list --parsable | wc -l'); -$leases < 3? $ampel = 'ampelgelb.jpg' : $ampel = 'ampelgr.jpg'; -$leases > 120? $ampel = 'ampelrot.jpg': ""; -echo ""; - -?> -
    Status
    Uptime:$uptime
    Load:$load[0] $load[1] $load[2]
    DHCP:Leases in use: $leases
    - -
    - Anzahl der l2tp Tunnel
    has-sued: $l2tp

    "; @@ -58,7 +35,7 @@ echo $clients;
    -Speedtest der has und has-sued GWs (Kabel, wr-841, l2tp) +Speedtest has und has-sued (Kabel, wr-841, l2tp)
    diff --git a/routers.php b/routers.php new file mode 100644 index 0000000..265ab14 --- /dev/null +++ b/routers.php @@ -0,0 +1,6 @@ + + + diff --git a/sensors/l2tp-routers.sh b/sensors/l2tp-routers.sh new file mode 100755 index 0000000..06ecae3 --- /dev/null +++ b/sensors/l2tp-routers.sh @@ -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