From 4130916b792ff7c9e48c08af39f54749f034fe05 Mon Sep 17 00:00:00 2001 From: Nagasai Vinaykumar Kapalavai Date: Wed, 11 Jul 2018 16:12:32 +0000 Subject: [PATCH] Rework on glance oscheck Currently the glance api check is giving tracebacks instead of meaningful errors. Couple of changes are made to address the issue. Change-Id: I6c71edb528677a4fde0c97eb3d465600b689d1bd Closes-Bug: #1784651 --- monitoring-for-openstack/oschecks/glance.py | 7 ++----- monitoring-for-openstack/oschecks/utils.py | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/monitoring-for-openstack/oschecks/glance.py b/monitoring-for-openstack/oschecks/glance.py index c097855..c892419 100644 --- a/monitoring-for-openstack/oschecks/glance.py +++ b/monitoring-for-openstack/oschecks/glance.py @@ -40,14 +40,11 @@ def _check_glance_api(): utils.critical(str(ex)) elapsed, images = utils.timeit(images_list) - if not images: - utils.critical("Unable to contact Glance API.") - - if elapsed > options.critical: + if images and elapsed > options.critical: utils.critical("Get images took more than %d seconds, " "it's too long.|response_time=%d" % (options.critical, elapsed)) - elif elapsed > options.warning: + elif images and elapsed > options.warning: utils.warning("Get images took more than %d seconds, " "it's too long.|response_time=%d" % (options.warning, elapsed)) diff --git a/monitoring-for-openstack/oschecks/utils.py b/monitoring-for-openstack/oschecks/utils.py index bbc949d..1d57f26 100644 --- a/monitoring-for-openstack/oschecks/utils.py +++ b/monitoring-for-openstack/oschecks/utils.py @@ -181,7 +181,7 @@ class Glance(object): (options, args) = self.glance.parser.parse_known_args(self.base_argv) if options.help: options.command = None - self.glance.do_help(options) + self.glance.do_help(options, self.glance.parser) sys.exit(2) api_version = ( getattr(options, 'os_image_api_version', api_version) or