2011-05-21 07:08:22 +02:00
|
|
|
#!/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:
|
2018-08-02 02:03:42 +02:00
|
|
|
# Copy this to your plugin folder (default: /usr/share/munin/plugins)
|
2011-05-21 07:08:22 +02:00
|
|
|
# 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";
|
2017-02-24 23:54:53 +01:00
|
|
|
print "graph_category sensors\n";
|
2011-05-21 07:08:22 +02:00
|
|
|
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);
|
2018-08-02 02:03:42 +02:00
|
|
|
}
|
2011-05-21 07:08:22 +02:00
|
|
|
print "yes\n";
|
|
|
|
exit(0);
|
|
|
|
}
|
2018-08-02 02:03:42 +02:00
|
|
|
|
2011-05-21 07:08:22 +02:00
|
|
|
print "no (Cannot locate CMCS)\n";
|
|
|
|
exit(0);
|
2018-08-02 02:03:42 +02:00
|
|
|
|
|
|
|
|
2011-05-21 07:08:22 +02:00
|
|
|
}
|
|
|
|
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";
|
|
|
|
|
|
|
|
|