#!/bin/sh #------------------------------------------------------------------------------ # opt/files/srv/www/admin/dsltool.cgi __FLI4LVER__ # # Creation: 06.02.2013 cspiess # Last Update: $Id$ #------------------------------------------------------------------------------ . /srv/www/include/cgi-helper #set_debug=yes ## get some internal variables . /var/run/dsltool.conf if [ "$DSLTOOL_RRD" = "yes" ] then . /srv/www/include/rrd-common.inc . /srv/www/include/rrd-dsltool.inc fi # Security check_rights "dsltool" "view" #globals : ${FORM_action:=dsltool_info} if [ "$DSLTOOL_RRD" = "yes" ] then _dsltool_modemstate="dsltool_modemstate" _dsltool_attenuation="dsltool_attenuation" _dsltool_noisemargin="dsltool_noisemargin" _dsltool_txpower="dsltool_txpower" _dsltool_bandwidth="dsltool_bandwidth" _dsltool_errors="dsltool_errors" _dsltool_failures="dsltool_failures" : ${FORM_rrd_graphtime_dsltool_modemstate:=$rrd_default_graphtime} : ${FORM_rrd_graphtime_dsltool_attenuation:=$rrd_default_graphtime} : ${FORM_rrd_graphtime_dsltool_noisemargin:=$rrd_default_graphtime} : ${FORM_rrd_graphtime_dsltool_txpower:=$rrd_default_graphtime} : ${FORM_rrd_graphtime_dsltool_bandwidth:=$rrd_default_graphtime} : ${FORM_rrd_graphtime_dsltool_errors:=$rrd_default_graphtime} : ${FORM_rrd_graphtime_dsltool_failures:=$rrd_default_graphtime} fi # functions dsltool_info () { rm /srv/www/img/dsltool.dat /usr/bin/dsltool-info.sh if [ -e /srv/www/img/dsltool.dat ] then . /srv/www/img/dsltool.dat show_tab_header "$_DSLTOOL_INFO_STATUS" "no" cat < $_DSLTOOL_INFO_DSLTYPE $dsltype $_DSLTOOL_INFO_MODEMSTATE $modemstate_str $_DSLTOOL_INFO_OPERATIONMODE $operationmode $channelmode EOF show_tab_footer case "$dsltype" in "ADSL2"|"ADSL2+") show_tab_header "$_DSLTOOL_INFO_LINE" "no" cat < $_DSLTOOL_INFO_BITRATE $_DSLTOOL_INFO_NOISEMARGIN $_DSLTOOL_INFO_ATTENUATION $_DSLTOOL_INFO_TXPOWER $_DSLTOOL_INFO_UPSTREAM $bandwidth_kbit_up $noisemargin_up $attenuation_up $txpower_up $_DSLTOOL_INFO_DOWNSTREAM $bandwidth_kbit_down $noisemargin_down $attenuation_down $txpower_down EOF show_tab_footer ;; "VDSL2") show_tab_header "$_DSLTOOL_INFO_LINE" "no" cat < $_DSLTOOL_INFO_BITRATE max. $_DSLTOOL_INFO_BITRATE $_DSLTOOL_INFO_TXPOWER $_DSLTOOL_INFO_UPSTREAM $bandwidth_kbit_up $maxbandwidth_kbit_up $txpower_up $_DSLTOOL_INFO_DOWNSTREAM $bandwidth_kbit_down $maxbandwidth_kbit_down $txpower_down EOF for i in `seq 1 3` do if [ $dslband -gt $i ] then eval nm_up='$noisemargin'$i'_up' eval at_up='$attenuation'$i'_up' eval nm_down='$noisemargin'$i'_down' eval at_down='$attenuation'$i'_down' cat < EOF fi done cat < EOF show_tab_footer ;; esac show_tab_header "$_DSLTOOL_INFO_ERRORS" "no" cat <
$_DSLTOOL_INFO_NOISEMARGIN $_DSLTOOL_INFO_ATTENUATION
$_DSLTOOL_INFO_UPSTREAM 0 $noisemargin_up $attenuation_up
$_DSLTOOL_INFO_DOWNSTREAM 0 $noisemargin_down $attenuation_down
$_DSLTOOL_INFO_UPSTREAM $i $nm_up $at_up
$_DSLTOOL_INFO_DOWNSTREAM $i $nm_down $at_down
$_DSLTOOL_INFO_FEC $_DSLTOOL_INFO_CRC $_DSLTOOL_INFO_HEC
$_DSLTOOL_INFO_RX $error_rx_FEC $error_rx_CRC $error_rx_HEC
$_DSLTOOL_INFO_TX $error_tx_FEC $error_tx_CRC $error_tx_HEC
EOF show_tab_footer show_tab_header "$_DSLTOOL_INFO_FAILURES" "no" cat < $_DSLTOOL_INFO_ERRSEC $_DSLTOOL_INFO_15M $error_secs_15min $_DSLTOOL_INFO_DAY $error_secs_day EOF show_tab_footer case "$dsltype" in "ADSL2"|"ADSL2+") show_tab_header "$_DSLTOOL_INFO_ATM" "no" cat < $_DSLTOOL_INFO_VPI $_DSLTOOL_INFO_VCI $ATM_VPI $ATM_VCI
$_DSLTOOL_INFO_VENDOR $_DSLTOOL_INFO_VENDSPEC $_DSLTOOL_INFO_REVISION
$_DSLTOOL_INFO_ATUC $ATU_C_vendor $ATU_C_vendspec $ATU_C_revision
$_DSLTOOL_INFO_ATUR $ATU_R_vendor $ATU_R_vendspec $ATU_R_revision
EOF show_tab_footer ;; esac else show_error "$_MN_err" "$_DSLTOOL_ERR_NO_ANSWER ${DSLTOOL_HOST}" fi } dsltool_spectrum_show() { # echo "\"DSL-Tool" echo "\"DSL-Tool" } dsltool_spectrum () { /usr/bin/dsltool-info.sh dsltool_spectrum_show bits echo "
" dsltool_spectrum_show snr echo "
" case $DSLTOOL_MODEM in demo | speedtouch) dsltool_spectrum_show char echo "
" ;; esac } dsltool_statistics () { if [ "$DSLTOOL_RRD" = "yes" ] then tab_list="" for i in modemstate attenuation noisemargin txpower bandwidth errors failures do eval local rrd_source_time='$FORM_rrd_graphtime_'$rrd_source : ${rrd_source_time:=$rrd_default_graphtime} case $i in modemstate) label=$(translate_label "${_DSLTOOL_MODEMSTATE}") ;; attenuation) label=$(translate_label "${_DSLTOOL_ATTENUATION}") ;; noisemargin) label=$(translate_label "${_DSLTOOL_NOISEMARGIN}") ;; txpower) label=$(translate_label "${_DSLTOOL_TXPOWER}") ;; bandwidth) label=$(translate_label "${_DSLTOOL_BANDWIDTH}") ;; errors) label=$(translate_label "${_DSLTOOL_ERRORS}") ;; failures) label=$(translate_label "${_DSLTOOL_FAILURES}") ;; esac if [ "$FORM_action" = "dsltool_$i" ] then tab_list=`echo "$tab_list $label no"` else tab_list=`echo "$tab_list $label $myname?action=dsltool_$i"` fi done show_tab_header $tab_list rrd_open_tab_list $FORM_action rrd_render_graph $FORM_action rrd_close_tab_list show_tab_footer fi } dsltool_control () { echo "
" echo "" echo "" echo "" echo "
" } dsltool_debug () { /usr/bin/dsltool-dump.sh http_header download "filename=ctype=application/download;filename=dsltool.tgz" cat /tmp/dsltool.tgz } if [ "$DSLTOOL_DEBUG" = "yes" -a "$FORM_action" = "dsltool_debug" ] then dsltool_debug else show_html_header "DSL-Tool" tab_list="" if [ "$DSLTOOL_RRD" = "yes" ] then tabs=`echo "info spectrum statistics control"` else tabs=`echo "info spectrum control"` fi if [ "$DSLTOOL_DEBUG" = "yes" ] then tabs=`echo "$tabs debug"` fi for i in $tabs do case $i in info) label=$(translate_label "${_DSLTOOL_INFO}") ;; spectrum) label=$(translate_label "${_DSLTOOL_SPECTRUM}") ;; statistics) label=$(translate_label "${_DSLTOOL_STATISTICS}") ;; control) label=$(translate_label "${_DSLTOOL_CONTROL}") ;; debug) label=$(translate_label "${_DSLTOOL_DEBUG}") ;; esac if [ "$FORM_action" = "dsltool_$i" ] then tab_list=`echo "$tab_list $label no"` elif [ "$i" = "statistics" ] then display="$myname?action=dsltool_$i" for a in modemstate attenuation noisemargin txpower bandwidth errors failures do if [ "$FORM_action" = "dsltool_$a" ] then display="no" fi done tab_list=`echo "$tab_list $label $display"` else tab_list=`echo "$tab_list $label $myname?action=dsltool_$i"` fi done show_tab_header $tab_list case $FORM_action in dsltool_info) dsltool_info ;; dsltool_spectrum) FORM_action="dsltool_spectrum_bits" dsltool_spectrum ;; dsltool_spectrum_bits | dsltool_spectrum_snr | \ dsltool_spectrum_char | dsltool_spectrum_all) dsltool_spectrum ;; dsltool_statistics) FORM_action="dsltool_modemstate" dsltool_statistics ;; dsltool_modemstate | dsltool_attenuation | \ dsltool_noisemargin | dsltool_txpower | dsltool_bandwidth | \ dsltool_errors | dsltool_failures) dsltool_statistics ;; dsltool_control) case "$FORM_command" in "$_DSLTOOL_CTRL_RESYNC") /usr/bin/dsltool-resync.sh ;; "$_DSLTOOL_CTRL_REBOOT") /usr/bin/dsltool-reboot.sh ;; esac dsltool_control ;; esac show_tab_footer show_html_footer fi