Table des matières
Plugins de monitoring OpenWRT
Ajouter un plugin munin a muninlite
Pour ajouter un plugin munin à muninlite(1.0.4), il faut se connecter sur votre OpenWRT et :
- créer le repertoire “/usr/sbin/munin-node-plugin.d/” s'il n'existe pas encore :
mkdir /usr/sbin/munin-node-plugin.d/
- deposer votre plugin dans ce répertoire
- ajouter “plugindir_” a la variable PLUGINS situé au début du /usr/sbin/munin-node, comme par exemple comme ceci :
PLUGINS="cpu if_ if_err_ load memory processes netstat uptime interrupts irqstats plugindir_"
Pour tester le bon fonctionnement, vour pouvez demander la liste des plugins disponibles en utilisant telnet :
root@frtls-ap04:~# telnet localhost 4949
# munin node at frtls-ap04
list
cpu if_eth0 if_eth1 if_br_lan if_eth1VLAN55 if_eth1VLAN54 if_eth1VLAN53 if_eth1VLAN2 if_br_mobile if_br_tls if_br_guest if_br_coin if_wlan0 if_wlan0_1 if_wlan0_2 if_wlan0_3 if_err_eth0 if_err_eth1 if_err_br_lan if_err_eth1VLAN55 if_err_eth1VLAN54 if_err_eth1VLAN53 if_err_eth1VLAN2 if_err_br_mobile if_err_br_tls if_err_br_guest if_err_br_coin if_err_wlan0 if_err_wlan0_1 if_err_wlan0_2 if_err_wlan0_3 load memory processes uptime interrupts irqstats openwrt_ap
quit
Connection closed by foreign host
Comme on peut le voir le plugin “openwrt_ap” apparait bien dans la liste, c'est gagné
Lister les clients connectés et la force du signal
Pour monitorer les clients connectés sur un point d'acces WiFi OpenWRT on peut utiliser le script :
#!/bin/sh # # Copyright (C) 2012 Jerome Drouet - jerome -at- drouet.eu # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 dated June, # 1991. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # # Plugin to monitor number of connected wlan clients # #%# family=auto #%# capabilities=autoconf PATH="/bin:/sbin:/usr/bin:/usr/sbin:$PATH" if [ "$1" = "autoconf" ]; then if [ ! -x `which iw` ]; then echo no exit 1 fi if [ -n "`iw`" ]; then echo yes exit 0 else echo no exit 1 fi fi interfaces="egrep \'\(\^interface=|\^bss=|\^ssid=\)\' /var/run/hostapd-phy0.conf | sed -e 's/interface=//' -e 's/ssid=//' -e 's/bss=//' | awk -F' ' '{a=$0;getline b; print a,b}'" ap_name=`grep hostname /etc/config/system | cut -f3 -d" " | sed "s/'//g"` if [ "$1" = "config" ]; then echo "graph_title Wireless Clients on $ap_name" echo 'graph_args --base 1000 -l 0' echo 'graph_vlabel Signal Strength / Total Clients' echo 'graph_category network' echo 'graph_info This graph shows the number of connected Wireless Clients and Signal Strength on this AccessPoint.' fi egrep '(^interface=|^bss=|^ssid=)' /var/run/hostapd-phy0.conf | sed -e 's/interface=//' -e 's/ssid=//' -e 's/bss=//' | awk -F' ' '{a=$0;getline b; print a,b}' | while read devname ssid; do if [ "$1" = "config" ]; then echo "$ssid.label $ssid" echo "$ssid.info Connected clients on SSID $ssid" fi wl_clients=`iw dev $devname station dump | grep Station | cut -f2 -d" "` if [ -n "$wl_clients" ]; then for mac in $wl_clients; do mac_label=`echo $mac | tr ':' '_'` if [ "$1" = "config" ]; then echo "$mac_label.label ${ssid}_${mac}" echo "$mac_label.info Signal strength for $mac" fi signal=`iw dev $devname station get $mac | grep "signal " | cut -f2 -d"-" | cut -f1 -d' '` echo "$mac_label.value $signal" done fi echo -n "$ssid.value " echo $wl_clients | wc -w | tr -d ' ' done exit 0
Ce script gere les multiples SSID et fonctionne sur OpenWRT Backfire (10.03.1, r29592) sur un WRT160NL