soloscli: Add script to syslog ADSL line stats
authorJohn Crispin <john@openwrt.org>
Thu, 29 Mar 2012 09:01:33 +0000 (09:01 +0000)
committerJohn Crispin <john@openwrt.org>
Thu, 29 Mar 2012 09:01:33 +0000 (09:01 +0000)
I run this from cron. With remote syslog enabled, this means I have a
record of ADSL line quality variation — which is useful when diagnosing
and reporting faults.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
SVN-Revision: 31136

package/soloscli/Makefile
package/soloscli/files/solos-log-stats [new file with mode: 0644]

index 490186dbecedc9b48f5e1f4408e599b46b207272..9a7cd894f957c15844589df51d73b1d87d288d5b 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=soloscli
 PKG_VERSION:=0.11
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=solos-pci-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/openadsl
@@ -37,6 +37,7 @@ endef
 define Package/soloscli/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/soloscli/soloscli $(1)/usr/bin/
+       $(INSTALL_BIN) ./files/solos-log-stats $(1)/usr/bin/
        $(INSTALL_DIR) $(1)/etc/hotplug.d/atm
        $(INSTALL_DATA) ./files/etc/hotplug.d/atm/15-solos-init $(1)/etc/hotplug.d/atm/
 endef
diff --git a/package/soloscli/files/solos-log-stats b/package/soloscli/files/solos-log-stats
new file mode 100644 (file)
index 0000000..2b75ee3
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+cd /sys/class/atm/ || exit 1
+
+for PORT in solos-pci* ; do
+
+    RXRATE=`cat $PORT/parameters/RxBitRate`
+    TXRATE=`cat $PORT/parameters/TxBitRate`
+    RXSNR=`cat $PORT/parameters/LocalSNRMargin | sed "s/ dB//"`
+    TXSNR=`cat $PORT/parameters/RemoteSNRMargin | sed "s/ dB//"`
+    RXERR=`cat $PORT/parameters/RSUnCorrectedErrorsDn`
+    TXERR=`cat $PORT/parameters/RSUnCorrectedErrorsUp`
+    RXFEC=`cat $PORT/parameters/RSCorrectedErrorsDn`
+    TXFEC=`cat $PORT/parameters/RSCorrectedErrorsUp`
+
+    echo "$RXRATE $RXSNR $RXERR $RXFEC / $TXRATE $TXSNR $TXERR $TXFEC" |
+       logger -t $PORT
+done
+