1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Add autoconf and enhance graphs

This commit is contained in:
Mehdi Abaakouk 2012-05-03 16:48:19 +02:00
parent 4a18b06213
commit 33cff547e9
6 changed files with 144 additions and 56 deletions

View file

@ -8,14 +8,21 @@
#
# Magic markers
#%# capabilities=autoconf
#%# family=keystone
#%# family=auto
import sys
import traceback
try:
from keystone.common import utils
from keystone import config
from keystone import exception
from keystone import identity
except ImportError:
succesful_import = False
else:
succesful_import = True
from keystone.common import utils
from keystone import config
from keystone import exception
from keystone import identity
CONF = config.CONF
@ -78,14 +85,26 @@ def print_values():
for (field, value) in stats[state].iteritems():
print "%s_%s.value %s" % (field, state, value)
def load_conf():
CONF(config_files=[utils.find_config('keystone.conf')])
if __name__ == '__main__':
if len(sys.argv) > 1:
if sys.argv[1] == "config":
print_config()
elif sys.argv[1] == "autoconf":
print "yes"
else:
CONF(config_files=[utils.find_config('keystone.conf')])
if not succesful_import:
print 'no (failed import keystone module)'
sys.exit(0)
try:
load_conf()
identity.Manager()
except:
print 'no (failed to connect keystone backend: %s'%traceback.format_exc()
sys.exit(0)
print 'yes'
elif succesful_import:
load_conf()
print_values()