From eca3d0044a875252feadb8663665713199688151 Mon Sep 17 00:00:00 2001 From: Jason Brooks Date: Sat, 21 May 2011 07:08:22 +0200 Subject: [PATCH] Initial version --- plugins/other/novra_s300 | 84 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 plugins/other/novra_s300 diff --git a/plugins/other/novra_s300 b/plugins/other/novra_s300 new file mode 100755 index 00000000..e3f15623 --- /dev/null +++ b/plugins/other/novra_s300 @@ -0,0 +1,84 @@ +#!/usr/bin/perl -w +# -*- perl -*- +# novra_s300 +# Munin plugin for Novra S300 Satellite Receiver +# Displays Signal and Carrier to Noise values +# +#%# family=auto +#%# capabilities=autoconf +# +############################################################################### +# +# This plugin monitors the signal strength and carrier to noise ratio on +# a Novra S300 satellite receiver +# @author Jason Brooks +# @version 2011.05.20.01 +# @email icedown@gmail.com +# +# Usage: +# Copy this to your plugin folder (default: /usr/share/munin/plugins) +# Edit is file, replacing CMCS, IP, and PW with your values +# Make a symlink to your active plugins folder (default: /etc/munin/plugins) +# Finally run munin-node-config and restart munin-node +# +# +################################################################################ + + +use strict; +use warnings; + +my $CMCS = "/usr/bin/cmcs"; +my $IP = "192.168.1.1"; +my $PW = "Password"; + +my $xmlcheck = 0; + +if(! eval "require XML::Simple;") { + $xmlcheck = "Missing XML::Simple"; +} +my $command = "$CMCS -ip $IP -pw $PW -xmlstatus"; + + +if (defined($ARGV[0]) and ($ARGV[0] eq 'config')) { + print "graph_title Novra S300\n"; + print "graph_vlabel Signal\n"; + print "graph_category NOAAPort\n"; + print "s300.signal Signal\n"; + print "s300.ctn CtN\n"; + exit(0); +} +if (defined($ARGV[0]) and ($ARGV[0] eq 'autoconf')) { + if($xmlcheck) { + print "no ($xmlcheck)\n"; + exit(0); + } + + if(-e $CMCS) { + my $status = `$command`; + if($status =~ m/Login unsuccessful/) { + print "No (Invalid receiver details)\n"; + exit(0); + } + print "yes\n"; + exit(0); + } + + print "no (Cannot locate CMCS)\n"; + exit(0); + + +} +require XML::Simple; + + +my $data = `$command`; + +my $xml = new XML::Simple; + +my $output = $xml->XMLin($data); + +print "s300.signal " . $output->{SIGNAL_STRENGTH_AS_DBM} . "\n"; +print "s300.ctn " . $output->{CARRIER_TO_NOISE} . "\n"; + +