Multiple client interfaces now possible in nodewatcher, fixed bug that nodewatcher does not send the number of clients, fixed bug that wlan0 is not added to mesh bridge on wr1043nd, prepare for firmware version 0.2

This commit is contained in:
floh1111 2011-05-26 17:12:29 +00:00
parent 008db5c4d2
commit d81c4195b5
6 changed files with 92 additions and 11 deletions

View File

@ -1,5 +1,5 @@
config 'script'
option 'version' '18'
option 'version' '19'
option 'error_level' '0'
option 'logfile' '/var/log/nodewatcher.log'

View File

@ -1,2 +1,2 @@
FIRMWARE_VERSION="0.1"
RELEASE_DATE="15.02.2010"
FIRMWARE_VERSION="0.2"
RELEASE_DATE="30.05.2011"

View File

@ -19,6 +19,8 @@ if [ -f /etc/config/nodewatcher ];then
CRAWL_NICKNAME=`uci get nodewatcher.@crawl[0].nickname`
CRAWL_PASSWORD=`uci get nodewatcher.@crawl[0].password`
UPDATE_AUTOUPDATE=`uci get nodewatcher.@update[0].autoupdate`
MESH_INTERFACE=`uci get nodewatcher.@network[0].mesh_interface`
CLIENT_INTERFACES=`uci get nodewatcher.@network[0].client_interfaces`
else
. $SCRIPT_DIR/nodewatcher_config
fi
@ -30,6 +32,12 @@ fi
if [ -n $API_RETRY ]; then
API_RETRY="3"
fi
if [ -n $MESH_INTERFACE ]; then
MESH_INTERFACE="br-mesh"
fi
if [ -n $CLIENT_INTERFACES ]; then
CLIENT_INTERFACES="ath0"
fi
API_RETRY=$(($API_RETRY - 1))
@ -102,7 +110,7 @@ update() {
echo "`date`: Suche neue Version" >> $logfile
fi
netmon_api=`get_url`
command="wget -q -O - http://$netmon_api/api_nodewatcher.php?section=version"
command="wget -q -O - http://$netmon_api/api_nodewatcher.php?section=version&nodewatcher_version=$SCRIPT_VERSION"
ergebnis=`$command&sleep $API_TIMEOUT; kill $!`
return=`echo $ergebnis| cut '-d;' -f1`
version=`echo $ergebnis| cut '-d;' -f2`
@ -112,7 +120,7 @@ update() {
if [ $error_level -gt "1" ]; then
echo "`date`: Eine neue Version ist Verfügbar, script wird geupdated" >> $logfile
fi
wget -q -O $SCRIPT_DIR/nodewatcher.sh http://$netmon_api/api_nodewatcher.php?section=update
wget -q -O $SCRIPT_DIR/nodewatcher.sh http://$netmon_api/api_nodewatcher.php?section=update&nodewatcher_version=$SCRIPT_VERSION
uci set nodewatcher.@script[0].version=$version
uci commit
else
@ -398,13 +406,14 @@ crawl() {
mv /etc/bat-hosts.tmp /etc/bat-hosts
#CLIENTS
MESHDEVICE='br-mesh'
CLIENTDEVICE='ath0'
SEDDEV=`brctl showstp $MESHDEVICE | egrep '\([0-9]\)' | sed -e "s/(//;s/)//" | awk '{ print "s/^ "$2"/"$1"/;" }'`
CLIENT_MACS=`brctl showmacs $MESHDEVICE | sed -e "$SEDDEV" | awk '{if ($3 != "yes" && $1 == "ath0") print $2}'`
SEDDEV=`brctl showstp $MESH_INTERFACE | egrep '\([0-9]\)' | sed -e "s/(//;s/)//" | awk '{ print "s/^ "$2"/"$1"/;" }'`
for entry in $CLIENT_INTERFACES; do
CLIENT_MACS=$CLIENT_MACS`brctl showmacs $MESH_INTERFACE | sed -e "$SEDDEV" | awk '{if ($3 != "yes" && $1 == "'"$entry"'") print $2}'`" "
done
i=0
for client in $CLIENT_MACS; do
# clients=$clients"clients[$i][mac_addr]=$client&"
i=`expr $i + 1` #Zähler um eins erhöhen
done
client_count=$i
@ -413,7 +422,7 @@ crawl() {
SYSTEM_DATA="status=online&hostname=$hostname&description=$description&location=$location&latitude=$latitude&longitude=$longitude&luciname=$luciname&luciversion=$luciversion&distname=$distname&distversion=$distversion&chipset=$chipset&cpu=$cpu&memory_total=$memory_total&memory_caching=$memory_caching&memory_buffering=$memory_buffering&memory_free=$memory_free&loadavg=$loadavg&processes=$processes&uptime=$uptime&idletime=$idletime&local_time=$local_time&community_essid=$community_essid&community_nickname=$community_nickname&community_email=$community_email&community_prefix=$community_prefix&batman_advanced_version=$batman_adv_version&kernel_version=$kernel_version&nodewatcher_version=$nodewatcher_version&firmware_version=$firmware_version"
INTERFACE_DATA="$int"
BATMAN_ADV_ORIGINATORS="$batman_adv_originators"
CLIENT_DATA="$client_count"
CLIENT_DATA="client_count=$client_count"
DATA="$AUTHENTIFICATION_DATA&$SYSTEM_DATA&$INTERFACE_DATA&$BATMAN_ADV_INTERFACES&$BATMAN_ADV_ORIGINATORS&$CLIENT_DATA"

View File

@ -0,0 +1,26 @@
config 'script'
option 'version' '19'
option 'error_level' '0'
option 'logfile' '/var/log/nodewatcher.log'
config 'api'
option 'ipv4_address' '1'
option 'ipv6_interface' 'br-mesh'
option 'ipv6_address' 'fe80::201:2ff:fe03:405'
option 'timeout' '3'
option 'retry' '3'
config 'update'
option 'autoupdate' '1'
config 'crawl'
option 'method' 'hash'
option 'nickname' '1'
option 'password' '1'
option 'router_id' '1'
option 'update_hash' '1'
option 'login_string' '1'
config 'network'
option 'mesh_interface' 'br-mesh'
option 'client_interfaces' 'ath0 eth0.1'

View File

@ -0,0 +1,26 @@
config 'script'
option 'version' '19'
option 'error_level' '0'
option 'logfile' '/var/log/nodewatcher.log'
config 'api'
option 'ipv4_address' '1'
option 'ipv6_interface' 'br-mesh'
option 'ipv6_address' 'fe80::201:2ff:fe03:405'
option 'timeout' '3'
option 'retry' '3'
config 'update'
option 'autoupdate' '1'
config 'crawl'
option 'method' 'hash'
option 'nickname' '1'
option 'password' '1'
option 'router_id' '1'
option 'update_hash' '1'
option 'login_string' '1'
config 'network'
option 'mesh_interface' 'br-mesh'
option 'client_interfaces' 'wlan0 eth0.1'

View File

@ -0,0 +1,20 @@
*/5 * * * * killall klogd
*/5 * * * * killall syslogd
*/5 * * * * killall logger
*/5 * * * * sh /etc/tincstart.sh
*/5 * * * * sh /etc/nodewatcher.sh
15 01 * * * rdate -s time.fu-berlin.de > /dev/null
#Enable zapp script if you are running a gateway
#*/1 * * * * /etc/init.d/zapp
*/5 * * * * killall -HUP dnsmasq
#* * * * * /usr/sbin/ff_olsr_test_gw
#*/5 * * * * /usr/sbin/ff_olsr_watchdog
#0 */4 * * * /usr/sbin/ff_rdate
#17 * * * * /usr/sbin/ff_mapupdate
#Fix only for WR1043ND becuase wlan0 is not added after bootup
*/5 * * * * brctl addif br-mesh wlan0