Last active
February 17, 2016 21:29
-
-
Save jhavard/abb2f6f9af0eba486499 to your computer and use it in GitHub Desktop.
Novra S300N Status Graphs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a quick and dirty script to grab the xml status from the Novra 'cmcs' utility, | |
grab the items we care about, add those to an rrd file, and then generate graphs. Not | |
really concerned with much more than the past day, but I made the rrd database large | |
enough to give a decade's worth of data to the 15 minute mark (I think). Since I can | |
never remember how to generate an rrd file, I googled for some little online thing | |
that will help. Take a look at http://rrdwizard.appspot.com/ if you are in the same boat. | |
This entire thing is probably wrong, but it works, so close enough. | |
rrdtool create satellite.rrd --step '60' \ | |
'DS:sigdbm:GAUGE:180:-100:5' 'DS:sigcn:GAUGE:180:-100:100' 'DS:dvbaccepted:COUNTER:180:U:U' \ | |
'DS:ethout:COUNTER:180:U:U' DS:freqoffset:GAUGE:180:-10000000:10000000 \ | |
'DS:uncorr:GAUGE:180:0:1000000' 'DS:VBER:GAUGE:180:-1000000:1000000' \ | |
'DS:PER:GAUGE:180:-1000000:1000000' 'RRA:MAX:0.5:1:130000' \ | |
'RRA:AVERAGE:0.5:1:130000' 'RRA:MIN:0.5:1:130000' 'RRA:MAX:0.5:5:260000' \ | |
'RRA:AVERAGE:0.5:5:260000' 'RRA:MIN:0.5:5:260000' 'RRA:MAX:0.5:15:350400' \ | |
'RRA:AVERAGE:0.5:15:350400' 'RRA:MIN:0.5:15:350400' 'RRA:LAST:0.5:1:260000' | |
Also, please note that on my systems, the 'cmcs' command is actually a wrapper that supplies | |
the appropriate IP and password for the receiver and then passes all arguments to the real | |
cmcs utility. Actually, since the satellite multicast network is on a separate switch, | |
I took it a step further. The real cmcs utility is on the host that runs the | |
NOAAport ingest processes, as is the first level wrapper. All the other hosts on the | |
network have a second level wrapper that connects to that machine via ssh and runs | |
the top-level wrapper. | |
That being said, the script that updates the rrd file and generates the graphs is running | |
on the NOAAport box, and that directory is mounted via nfs on the web server. It doesn't | |
have to be that way, it just seemed right at the time. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use XML::Simple; | |
use Data::Dumper; | |
use RRDs; | |
use POSIX qw(strftime); | |
$now_string = strftime "%a %b %e %H:%M:%S %Y", localtime; | |
$infoo = `/usr/local/bin/cmcs -xmlstatus`; | |
my $dat = XMLin($infoo); | |
$upd = sprintf "N:%s:%s:%s:%s:%s:%s:%s:%s", $dat->{'SIGNAL_STRENGTH_AS_DBM'}, $dat->{'CARRIER_TO_NOISE'}, $dat->{'TOTAL_DVB_PACKETS_ACCEPTED'}, | |
$dat->{'TOTAL_ETHERNET_PACKETS_OUT'}, $dat->{'FREQUENCY_OFFSET'}, $dat->{'TOTAL_UNCORRECTABLE_TS_PACKETS'}, | |
$dat->{'VBER'}, $dat->{'PER'}; | |
$BASE='/export/stats'; | |
$SATF="$BASE/satellite.rrd"; | |
RRDs::update($SATF, $upd); | |
sub do_graph { | |
$file = "$BASE/graphs/" . $_[0]; | |
$key = $_[1]; | |
$color = $_[2]; | |
$comment = $_[3]; | |
$unit = $_[4]; | |
RRDs::graph $file, "--start", "end-93600s", "--end", "now", "--width", "600", "-W", "HEATER Labs / WXLAB $now_string", "-E", | |
"DEF:xa=$SATF:${key}:AVERAGE", | |
"DEF:xl=$SATF:${key}:MIN", | |
"DEF:xh=$SATF:${key}:MAX", | |
"DEF:xn=$SATF:${key}:LAST", | |
"LINE1:xa#${color}:${comment}", | |
"GPRINT:xn:LAST:Current %5.2lf $unit", "GPRINT:xh:LAST:Max %5.2lf $unit", "GPRINT:xa:LAST:Avg %5.2lf $unit", "GPRINT:xl:LAST:Min %5.2lf $unit"; | |
} | |
do_graph "day_cn.png", "sigcn", "FF0000", "dB C/N", "dB"; | |
do_graph "day_dbm.png", "sigdbm", "FF0000", "Signal Strength (dBm)", "dBm"; | |
do_graph "day_dvbacc.png", "dvbaccepted", "00AA00", "DVB Packets Accepted", "pps"; | |
do_graph "day_ethout.png", "ethout", "00AA00", "Ethernet Packets Out","pps"; | |
do_graph "day_freqerr.png", "freqoffset", "0000BB", "Frequency Offset / Error", "Hz"; | |
do_graph "day_uncorr.png", "uncorr", "FF0000", "Uncorrectable Packets", "pkts"; | |
do_graph "day_vber.png", "VBER", "FF9911", "VBER", "VBER"; | |
do_graph "day_per.png", "PER", "99FF11", "PER", "PER"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Satellite Graphs</title> | |
</head> | |
<body> | |
<img src="graphs/day_dbm.png"><br> | |
<img src="graphs/day_cn.png"><br> | |
<img src="graphs/day_dvbacc.png"><br> | |
<img src="graphs/day_ethout.png"><br> | |
<img src="graphs/day_freqerr.png"><br> | |
<img src="graphs/day_uncorr.png"><br> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment