support specifying jids in munin script
This commit is contained in:
parent
14b08332f6
commit
d85474b70b
1 changed files with 14 additions and 9 deletions
|
@ -21,10 +21,9 @@
|
||||||
# You have to configure the plugin to run as user and group "spectrum".
|
# You have to configure the plugin to run as user and group "spectrum".
|
||||||
#
|
#
|
||||||
# By default, the plugin monitors all instances configured in a config-file
|
# By default, the plugin monitors all instances configured in a config-file
|
||||||
# in /etc/spectrum. If you use a different directory, you can specify the
|
# in /etc/spectrum2/transports. If you do not want to monitor all instances,
|
||||||
# environment-variable "base". If you do not want to monitor all instances,
|
# you can give an explicit listing of the corresponding instances
|
||||||
# you can give an explicit listing of the corresponding configuration files
|
# with the environment variable "jids".
|
||||||
# with the environment variable "cfgs".
|
|
||||||
#
|
#
|
||||||
# Here is an example of a configuration. Note again that you can ommit both
|
# Here is an example of a configuration. Note again that you can ommit both
|
||||||
# env.cfgs and env.base:
|
# env.cfgs and env.base:
|
||||||
|
@ -32,8 +31,7 @@
|
||||||
# [spectrum_*]
|
# [spectrum_*]
|
||||||
# user spectrum
|
# user spectrum
|
||||||
# group spectrum
|
# group spectrum
|
||||||
# env.cfgs xmpp.example.com.cfg,irc.example.com.cfg
|
# env.jids xmpp.example.com,irc.example.com
|
||||||
# env.base /etc/spectrum
|
|
||||||
#
|
#
|
||||||
# Author:
|
# Author:
|
||||||
# Mathias Ertl <mati@fsinf.at>
|
# Mathias Ertl <mati@fsinf.at>
|
||||||
|
@ -94,9 +92,16 @@ def handle_field( string ):
|
||||||
# get runtime variables
|
# get runtime variables
|
||||||
suffix = sys.argv[0].partition('_')[2]
|
suffix = sys.argv[0].partition('_')[2]
|
||||||
verbose = os.environ.get( 'verbose' )
|
verbose = os.environ.get( 'verbose' )
|
||||||
proc = Popen(['spectrum2_manager', 'list'], stdout=PIPE, stderr=PIPE)
|
|
||||||
out, err = proc.communicate()
|
jids = []
|
||||||
jids = out.split('\n')[:-1]
|
|
||||||
|
base = os.environ.get( 'base', '/etc/spectrum' )
|
||||||
|
if 'jids' in os.environ.keys():
|
||||||
|
jids = os.environ.get( 'cfgs' ).split(',')
|
||||||
|
else:
|
||||||
|
proc = Popen(['spectrum2_manager', 'list'], stdout=PIPE, stderr=PIPE)
|
||||||
|
out, err = proc.communicate()
|
||||||
|
jids = out.split('\n')[:-1]
|
||||||
|
|
||||||
# set variables based on wildcard
|
# set variables based on wildcard
|
||||||
if suffix == 'uptime':
|
if suffix == 'uptime':
|
||||||
|
|
Loading…
Add table
Reference in a new issue