Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/dvb/femon | ||
|---|---|---|
| 2 | 2 |
# -*- encoding: iso-8859-1 -*- |
| 3 | 3 |
# |
| 4 | 4 |
# Wildcard-plugin to monitor DVB signal information via femon command line utility, |
| 5 |
#
|
|
| 6 |
# To monitor a dvb device, link femon_<device> to this file.
|
|
| 5 |
# |
|
| 6 |
# To monitor a dvb device, link femon_<device> to this file. |
|
| 7 | 7 |
# E.g. |
| 8 | 8 |
# ln -s /usr/share/munin/plugins/femon_ /etc/munin/plugins/femon_adapter0 |
| 9 | 9 |
# ...will monitor /dev/dvb/adapter0. |
| ... | ... | |
| 15 | 15 |
# Parameters |
| 16 | 16 |
# femonpath - Specify path to femon program (Default: /usr/bin/femon) |
| 17 | 17 |
# graph_args - Specify graph args (Default: --lower-limit 0 --upper-limit 100 --rigid) |
| 18 |
#
|
|
| 18 |
# |
|
| 19 | 19 |
# Author: Nicolas Knotzer <nknotzer@gmail.com> |
| 20 |
#
|
|
| 20 |
# |
|
| 21 | 21 |
# v1.0 02/10/2011 |
| 22 | 22 |
# v1.1 20/10/2011 - Prints OSError.strerror in verbose mode, uses rsplit instead of split for parsing femon output |
| 23 | 23 |
# 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) |
| 24 |
# v1.3 25/10/2011 - Configure upper and lower graph limits with graph_args environment variable.
|
|
| 24 |
# v1.3 25/10/2011 - Configure upper and lower graph limits with graph_args environment variable. |
|
| 25 | 25 |
# |
| 26 | 26 |
# Copyright (c) 2011 Nicolas Knotzer. |
| 27 | 27 |
# |
| ... | ... | |
| 70 | 70 |
adapters.append(adapter) |
| 71 | 71 |
except : |
| 72 | 72 |
continue |
| 73 |
except :
|
|
| 73 |
except : |
|
| 74 | 74 |
verboselog('Failed to list adapters in /dev/dvb')
|
| 75 | 75 |
return(adapters) |
| 76 | 76 |
|
| ... | ... | |
| 78 | 78 |
global plugin_name |
| 79 | 79 |
try : |
| 80 | 80 |
name=[plugin_name[string.rindex(plugin_name,'_')+1:]] |
| 81 |
|
|
| 81 |
|
|
| 82 | 82 |
# Check that the adapter exists in /dev/dvb |
| 83 | 83 |
if not os.path.exists('/dev/dvb/'+name[0]):
|
| 84 | 84 |
verboselog('/dev/dvb/'+name[0]+' not found!')
|
| ... | ... | |
| 117 | 117 |
try : |
| 118 | 118 |
verboselog('Reading values from '+dvb_adapter[0])
|
| 119 | 119 |
mypipe = subprocess.Popen([os.getenv('femonpath','/usr/bin/femon'), '-H', '-c 1', '-a '+dvb_adapter[0].replace('adapter','')], stdout=subprocess.PIPE)
|
| 120 |
femon_output = mypipe.communicate()[0]
|
|
| 120 |
femon_output = mypipe.communicate()[0] |
|
| 121 | 121 |
verboselog(femon_output) |
| 122 | 122 |
except OSError, e: |
| 123 | 123 |
verboselog('Cannot access femon values! Check user rights or proper femon installation.')
|
| ... | ... | |
| 145 | 145 |
print_adapter_config (dvb_adapter) |
| 146 | 146 |
sys.exit(0) |
| 147 | 147 |
elif sys.argv[1]=="autoconf" : |
| 148 |
if os.path.exists(os.getenv('femonpath','/usr/bin/femon')) :
|
|
| 148 |
if os.path.exists(os.getenv('femonpath','/usr/bin/femon')) :
|
|
| 149 | 149 |
if not find_dvb_adapters(): |
| 150 | 150 |
print('no (no dvb adapters accessible)')
|
| 151 | 151 |
else : |
| 152 | 152 |
print('yes')
|
| 153 | 153 |
sys.exit(0) |
| 154 |
else :
|
|
| 154 |
else : |
|
| 155 | 155 |
print('no (femon not found)')
|
| 156 | 156 |
sys.exit(0) |
| 157 | 157 |
elif sys.argv[1]=="suggest" : |
| ... | ... | |
| 179 | 179 |
|
| 180 | 180 |
=head1 APPLICABLE SYSTEMS |
| 181 | 181 |
|
| 182 |
Node with B<Python> interpreter and B<femon>
|
|
| 182 |
Node with B<Python> interpreter and B<femon> |
|
| 183 | 183 |
installed and in function. |
| 184 | 184 |
|
| 185 | 185 |
=head1 CONFIGURATION |
| 186 |
|
|
| 186 |
|
|
| 187 | 187 |
=head2 Create link in service directory |
| 188 | 188 |
|
| 189 | 189 |
To monitor a dvb device, create a link in the service directory |
| 190 | 190 |
of the munin-node named femon_<device>, which is pointing to this file. |
| 191 |
|
|
| 191 |
|
|
| 192 | 192 |
E.g. |
| 193 | 193 |
|
| 194 | 194 |
ln -s /usr/share/munin/plugins/femon_ /etc/munin/plugins/femon_adapter0 |
| ... | ... | |
| 211 | 211 |
=head2 Set Parameter if needed |
| 212 | 212 |
|
| 213 | 213 |
femonpath - Specify path to femon program (Default: /usr/bin/femon) |
| 214 |
|
|
| 214 |
|
|
| 215 | 215 |
=head1 INTERPRETATION |
| 216 | 216 |
|
| 217 | 217 |
|
Formats disponibles : Unified diff