Skip to content

Instantly share code, notes, and snippets.

@cbandy
Created January 6, 2012 04:50
Show Gist options
  • Select an option

  • Save cbandy/1569045 to your computer and use it in GitHub Desktop.

Select an option

Save cbandy/1569045 to your computer and use it in GitHub Desktop.
#!/bin/sh
MODEM_HOST="Cable Modem"
MODEM_IP="192.168.100.1"
SIGNAL_URL="http://$MODEM_IP/RgSignal.asp"
ZABBIX_SERVER="127.0.0.1"
curl --silent "$SIGNAL_URL" |
sed -n -e '
/Downstream/,/Upstream/ {
# 0,/Downstream/ { s/<[^>]*>/ /g p }
/Frequency/ { s/<[^>]*>/ /g ; s/[^0-9]*\([0-9.]*\).*/- surfboard.downstream.frequency \1/ p }
/Power Level/ { /snapshot/ ! { s/<[^>]*>/ /g ; s/[^0-9]*\([0-9.]*\).*/- surfboard.downstream.power \1/ p } }
/Signal To Noise Ratio/ { s/<[^>]*>/ /g ; s/[^0-9]*\([0-9.]*\).*/- surfboard.downstream.snr \1/ p }
}
/Upstream/,/Downstream/ {
# 0,/Upstream/ { s/<[^>]*>/ /g p }
# /Channel/ { s/<[^>]*>/ /g p }
/Frequency/ { s/<[^>]*>/ /g ; s/[^0-9]*\([0-9.]*\).*/- surfboard.upstream.frequency \1/ p }
/Power/ { s/<[^>]*>/ /g ; s/[^0-9]*\([0-9.]*\).*/- surfboard.upstream.power \1/ p }
}' |
zabbix_sender --zabbix-server "$ZABBIX_SERVER" --host "$MODEM_HOST" --input-file -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment