mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Update plugins/dvb/femon
# v1.3 25/10/2011 - Configure upper and lower graph limits with graph_args environment variable.
This commit is contained in:
parent
bac376c23e
commit
dacd37d046
1 changed files with 19 additions and 16 deletions
|
@ -14,16 +14,18 @@
|
||||||
#
|
#
|
||||||
# Parameters
|
# Parameters
|
||||||
# femonpath - Specify path to femon program (Default: /usr/bin/femon)
|
# femonpath - Specify path to femon program (Default: /usr/bin/femon)
|
||||||
|
# graph_args - Specifiy graph args (Default: --lower-limit 0 --upper-limit 100 --rigid)
|
||||||
#
|
#
|
||||||
# Author: Nicolas Knotzer <nknotzer@gmail.com>
|
# Author: Nicolas Knotzer <nknotzer@gmail.com>
|
||||||
#
|
#
|
||||||
# v1.0 02/10/2011
|
# 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
|
# v1.1 20/10/2011 - Prints OSError.strerror in verbose mode, uses rsplit instead of split for parsing femon output
|
||||||
# v1.2 21/20/2011 - Uses subprocess.Popen instead of subprocess.check_output for compatibility with older python versions
|
# v1.2 21/10/2011 - Uses subprocess.Popen instead of subprocess.check_output for better compatibility with older python versions (i.e. works with python version >= 2.4)
|
||||||
|
# v1.3 25/10/2011 - Configure upper and lower graph limits with graph_args environment variable.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011 Nicolas Knotzer.
|
# Copyright (c) 2011 Nicolas Knotzer.
|
||||||
#
|
#
|
||||||
# The smart_ plugin by Nicolas Stransky <Nico@stransky.cx> was used as a template!
|
# The smart_ plugin by Nicolas Stransky <Nico@stransky.cx> was used as a template for this plugin!
|
||||||
#
|
#
|
||||||
# Permission to use, copy, and modify this software with or without fee
|
# Permission to use, copy, and modify this software with or without fee
|
||||||
# is hereby granted, provided that this entire notice is included in
|
# is hereby granted, provided that this entire notice is included in
|
||||||
|
@ -44,13 +46,12 @@
|
||||||
## You may edit the following 2 variables
|
## You may edit the following 2 variables
|
||||||
# Increase verbosity (True/False)
|
# Increase verbosity (True/False)
|
||||||
verbose=False
|
verbose=False
|
||||||
# Modify to your needs:
|
|
||||||
statefiledir='/var/lib/munin/plugin-state'
|
|
||||||
# You may not modify anything below this line
|
# You may not modify anything below this line
|
||||||
|
|
||||||
import os, sys, string, subprocess
|
import os, sys, string, subprocess
|
||||||
from math import log
|
from math import log
|
||||||
plugin_version="1.2"
|
plugin_version="1.3"
|
||||||
|
|
||||||
def verboselog(s):
|
def verboselog(s):
|
||||||
global plugin_name
|
global plugin_name
|
||||||
|
@ -90,10 +91,10 @@ def get_dvb_adapter_name() :
|
||||||
def print_adapter_config(dvb_adapter) :
|
def print_adapter_config(dvb_adapter) :
|
||||||
verboselog('Printing configuration')
|
verboselog('Printing configuration')
|
||||||
print ('graph_title DVB Femon Sensors '+dvb_adapter[0])
|
print ('graph_title DVB Femon Sensors '+dvb_adapter[0])
|
||||||
print ('graph_args -l 0')
|
print ('graph_args '+os.getenv('graph_args','--lower-limit 0 --upper-limit 100 --rigid'))
|
||||||
print ('graph_vlabel Quality')
|
print ('graph_vlabel Quality')
|
||||||
print ('graph_category DVB')
|
print ('graph_category DVB')
|
||||||
print ('graph_info This graph shows the femon values for your DVB '+dvb_adapter[0])
|
print ('graph_info This graph shows femon output for your dvb-'+dvb_adapter[0])
|
||||||
|
|
||||||
print ('str.label Signal Strength')
|
print ('str.label Signal Strength')
|
||||||
print ('str.info Signal Strength')
|
print ('str.info Signal Strength')
|
||||||
|
@ -114,7 +115,6 @@ def print_adapter_config(dvb_adapter) :
|
||||||
|
|
||||||
def print_dvb_adapter_values(dvb_adapter) :
|
def print_dvb_adapter_values(dvb_adapter) :
|
||||||
try :
|
try :
|
||||||
|
|
||||||
verboselog('Reading values from '+dvb_adapter[0])
|
verboselog('Reading values from '+dvb_adapter[0])
|
||||||
mypipe = subprocess.Popen([os.getenv('femonpath','/usr/bin/femon'), '-H', '-c 1', '-a '+dvb_adapter[0].replace('adapter','')], stdout=subprocess.PIPE)
|
mypipe = subprocess.Popen([os.getenv('femonpath','/usr/bin/femon'), '-H', '-c 1', '-a '+dvb_adapter[0].replace('adapter','')], stdout=subprocess.PIPE)
|
||||||
femon_output = mypipe.communicate()[0]
|
femon_output = mypipe.communicate()[0]
|
||||||
|
@ -123,12 +123,15 @@ def print_dvb_adapter_values(dvb_adapter) :
|
||||||
verboselog('Cannot access femon values! Check user rights or proper femon installation.')
|
verboselog('Cannot access femon values! Check user rights or proper femon installation.')
|
||||||
verboselog('Error: '+e.strerror)
|
verboselog('Error: '+e.strerror)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
splitstr=femon_output.rsplit ('|',5)
|
try :
|
||||||
print ('str.value '+splitstr[1].replace('signal','').strip(' %'))
|
splitstr=femon_output.rsplit ('|',5)
|
||||||
print ('snr.value '+splitstr[2].replace('snr','').strip(' %'))
|
print ('str.value '+splitstr[1].replace('signal','').strip(' %'))
|
||||||
print ('ber.value '+splitstr[3].replace('ber','').strip(' '))
|
print ('snr.value '+splitstr[2].replace('snr','').strip(' %'))
|
||||||
print ('unc.value '+splitstr[4].replace('unc','').strip(' '))
|
print ('ber.value '+splitstr[3].replace('ber','').strip(' '))
|
||||||
|
print ('unc.value '+splitstr[4].replace('unc','').strip(' '))
|
||||||
|
except :
|
||||||
|
verboselog ('Error processing femon output string.')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
### Main part ###
|
### Main part ###
|
||||||
|
|
||||||
|
@ -261,7 +264,7 @@ B<munin-node-configure> use this to build the service links for this wildcard-pl
|
||||||
|
|
||||||
=head1 VERSION
|
=head1 VERSION
|
||||||
|
|
||||||
Version 1.2
|
Version 1.3
|
||||||
|
|
||||||
=head1 BUGS
|
=head1 BUGS
|
||||||
|
|
||||||
|
@ -271,7 +274,7 @@ None known
|
||||||
|
|
||||||
(C) 2011 Nicolas Knotzer <nknotzer@gmail.com>
|
(C) 2011 Nicolas Knotzer <nknotzer@gmail.com>
|
||||||
|
|
||||||
The smart_ plugin by Nicolas Stransky <Nico@stransky.cx> was used as a template!
|
The smart_ plugin by Nicolas Stransky <Nico@stransky.cx> was used as a template for this plugin!
|
||||||
|
|
||||||
=head1 LICENSE
|
=head1 LICENSE
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue