2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Prints OSError.strerror in verbose mode, uses rsplit instead of split for parsing femon output (more robust, if name of dvb-card contains split character, i.e.'|')

This commit is contained in:
Nicolas Knotzer 2011-10-20 23:29:00 +02:00 committed by Steve Schnepp
parent 41be7c5f3d
commit aa9a9e802e

View File

@ -18,6 +18,7 @@
# Author: Nicolas Knotzer <nknotzer@gmail.com>
#
# v1.0 02/10/2011
# v1.1 20/10/2011 - Prints OSError.strerror in verbose mode, uses rsplit instead of split for parsing femon output
#
# Copyright (c) 2011 Nicolas Knotzer.
#
@ -48,7 +49,7 @@ statefiledir='/var/lib/munin/plugin-state'
import os, sys, string, subprocess
from math import log
plugin_version="1.0"
plugin_version="1.1"
def verboselog(s):
global plugin_name
@ -116,10 +117,11 @@ def print_dvb_adapter_values(dvb_adapter) :
verboselog('Reading values from '+dvb_adapter[0])
femon_output=subprocess.check_output([os.getenv('femonpath','/usr/bin/femon'), '-H', '-c 1', '-a '+dvb_adapter[0].replace('adapter','')])
verboselog(femon_output)
except :
except OSError, e:
verboselog('Cannot access femon values! Check user rights or proper femon installation.')
verboselog('Error: '+e.strerror)
sys.exit(1)
splitstr=femon_output.split ('|')
splitstr=femon_output.rsplit ('|',5)
print ('str.value '+splitstr[1].replace('signal','').strip(' %'))
print ('snr.value '+splitstr[2].replace('snr','').strip(' %'))
print ('ber.value '+splitstr[3].replace('ber','').strip(' '))
@ -257,7 +259,7 @@ B<munin-node-configure> use this to build the service links for this wildcard-pl
=head1 VERSION
Version 1.0
Version 1.1
=head1 BUGS