#!/bin/sh # config times='1h 4h 12h 24h 2d 7d 2w 4w' stats='Drahtlos Transfer Gateways System OLSR' Drahtlos='SNR RATE' Transfer='WIFI LAN' Gateways='WAN GW1 GW2' System='SYS LOAD' OLSR='HNA RST LQ1 LQ2' # get strings and eval if [ -n "$QUERY_STRING" ]; then IFS=\& set ${QUERY_STRING%%[^%&=+-:@-_a-z~]*} unset IFS for i in $*; do i_var="${i%=*}" i_val=$(eval echo \${$i_var}) test "$i_val" && i="${i_var}=${i_val},${i#*=}" eval $i done fi # get user-default-settings test -z "$STAT" && STAT="$(nvram get ff_stat_startpage)" selected() { if $(echo $(eval echo \${$1}) | grep -q "^$2\|,$2\|-$2"); then echo ' checked' fi } # standard-frame export DATE="25.6.2007" export TITLE="Statistik: $STAT" . ${0%/*}/cgi-bin-pre.sh # output selectbox cat< EOF # build selectbox-content zindex='10' for stat in $stats; do opts=$(eval echo \${$stat}) opt_cnt='0' for opt in $opts; do opt_cnt=$((${opt_cnt}+1)) done zindex=$((${zindex}-1)) echo "
" all_opts=$(echo $opts | sed 's# #,#g') echo "${stat}" echo "
" for opt in $opts; do echo " ${opt}
" done echo '
' done time_cnt='0' for time in $times; do time_cnt=$((${time_cnt}+1)) done zindex=$((${zindex}-1)) echo "
" cat<
EOF for time in $times; do echo " ${time}
" done cat<

EOF # generate table/image with rrd-template IFS=, for ST in $STAT; do test -n "$ST" && { rrd_stat="/www/rrd_${ST}" echo '