Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/SpectrumIM/spectrum2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/munin
diff options
context:
space:
mode:
authorHanzZ <hanzz.k@gmail.com>2013-01-31 21:39:04 +0400
committerHanzZ <hanzz.k@gmail.com>2013-01-31 21:39:04 +0400
commitd85474b70b00341d1e64cad667fff624770fd071 (patch)
tree916e1464d57b0f46a8a5c28cdb231a7e16cffb96 /munin
parent14b08332f610f32509bc6028198979d47d5fbd9e (diff)
support specifying jids in munin script
Diffstat (limited to 'munin')
-rwxr-xr-xmunin/spectrum2_23
1 files changed, 14 insertions, 9 deletions
diff --git a/munin/spectrum2_ b/munin/spectrum2_
index d0dc7a36..b2cd9f0c 100755
--- a/munin/spectrum2_
+++ b/munin/spectrum2_
@@ -21,10 +21,9 @@
# 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
-# in /etc/spectrum. If you use a different directory, you can specify the
-# environment-variable "base". If you do not want to monitor all instances,
-# you can give an explicit listing of the corresponding configuration files
-# with the environment variable "cfgs".
+# in /etc/spectrum2/transports. If you do not want to monitor all instances,
+# you can give an explicit listing of the corresponding instances
+# with the environment variable "jids".
#
# Here is an example of a configuration. Note again that you can ommit both
# env.cfgs and env.base:
@@ -32,8 +31,7 @@
# [spectrum_*]
# user spectrum
# group spectrum
-# env.cfgs xmpp.example.com.cfg,irc.example.com.cfg
-# env.base /etc/spectrum
+# env.jids xmpp.example.com,irc.example.com
#
# Author:
# Mathias Ertl <mati@fsinf.at>
@@ -94,9 +92,16 @@ def handle_field( string ):
# get runtime variables
suffix = sys.argv[0].partition('_')[2]
verbose = os.environ.get( 'verbose' )
-proc = Popen(['spectrum2_manager', 'list'], stdout=PIPE, stderr=PIPE)
-out, err = proc.communicate()
-jids = out.split('\n')[:-1]
+
+jids = []
+
+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
if suffix == 'uptime':