From 4fb8fb803960e51f41899667e56315b41f66ec9e Mon Sep 17 00:00:00 2001 From: Peter Sabaini Date: Fri, 7 Jul 2017 10:38:03 +0200 Subject: [PATCH] Don't hardcode api port, use helper to determine port The NRPE healthcheck included with swift-proxy uses hardcoded api port, 8070, to talk to swift. However, the charm configures the api port differently if swift-proxy is configured for https. Closes-Bug: 1702847 Change-Id: I3e8d025e66799d9eb24ede530b6a7d0936613620 --- hooks/swift_hooks.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hooks/swift_hooks.py b/hooks/swift_hooks.py index eb574f7..0ed1b87 100755 --- a/hooks/swift_hooks.py +++ b/hooks/swift_hooks.py @@ -64,6 +64,7 @@ from charmhelpers.contrib.openstack.ha.utils import ( from charmhelpers.contrib.hahelpers.cluster import ( get_hacluster_config, is_elected_leader, + determine_api_port, ) from charmhelpers.core.hookenv import ( @@ -704,12 +705,14 @@ def update_nrpe_config(): nrpe.copy_nrpe_checks() nrpe.add_init_service_checks(nrpe_setup, services(), current_unit) nrpe.add_haproxy_checks(nrpe_setup, current_unit) + api_port = determine_api_port(config('bind-port'), + singlenode_mode=True) nrpe_setup.add_check( shortname="swift-proxy-healthcheck", description="Check Swift Proxy Healthcheck", check_cmd="/usr/lib/nagios/plugins/check_http \ - -I localhost -u /healthcheck -p 8070 \ - -e \"OK\"" + -I localhost -u /healthcheck -p {} \ + -e \"OK\"".format(api_port) ) nrpe_setup.write()