#!/usr/bin/perl -w use strict; my $ip = shift; my $port = shift; ($ip && $port) || die "Usage: $0 ip port\n"; open(NC, "nc $ip $port |") || die "Couldn't spawn nc: $!\n"; while(<NC>) { if(/Signal level:-?(\d+).*Noise level:-?(\d+)/) { print "$1 $2\n"; exit; } } die "Warning: couldn't find signal and noise!\n";
/usr/local/rrdtool/bin/rrdtool create \ /home/rob/radio/radio.rrd \ --step 300 \ DS:signal:GAUGE:600:0:150 \ DS:noise:GAUGE:600:0:150 \ RRA:AVERAGE:0.5:1:600 \ RRA:AVERAGE:0.5:6:700 \ RRA:AVERAGE:0.5:24:775 \ RRA:AVERAGE:0.5:288:797 \ RRA:MAX:0.5:1:600 \ RRA:MAX:0.5:6:700 \ RRA:MAX:0.5:24:775 \ RRA:MAX:0.5:288:797
/usr/local/rrdtool/bin/rrdtool graph - \ --imgformat=PNG \ --start="-604800" \ --title=" Radio" \ --rigid \ --base=1000 \ --height=120 \ --width=500 \ --upper-limit=105 \ --lower-limit=60 \ --vertical-label="dBm" \ DEF:a="/home/rob/radio/ radio.rrd":signal:AVERAGE \ DEF:b="/home/rob/radio/ radio.rrd":noise:AVERAGE \ AREA:a#74C366:"Signal" \ LINE1:b#FF0000:"Noise" \ > graph.png
O'Reilly Home | Privacy Policy © 2007 O'Reilly Media, Inc. Website: | Customer Service: | Book issues:
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.