Skip to content

Commit

Permalink
Removing the unused 'skip_proxy' variable in the rabbitmq integration
Browse files Browse the repository at this point in the history
All informations about proxies are handle by the 'self.get_instance_proxy' helper.
  • Loading branch information
hush-hush committed Jun 30, 2017
1 parent 4462c32 commit 3c40cce
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions rabbitmq/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def _get_config(self, instance):
custom_tags = instance.get('tags', [])
parsed_url = urlparse.urlparse(base_url)
ssl_verify = _is_affirmative(instance.get('ssl_verify', True))
skip_proxy = _is_affirmative(instance.get('no_proxy', False))
if not ssl_verify and parsed_url.scheme == 'https':
self.log.warning('Skipping SSL cert validation for %s based on configuration.' % (base_url))

Expand Down Expand Up @@ -148,7 +147,7 @@ def _get_config(self, instance):

auth = (username, password)

return base_url, max_detailed, specified, auth, ssl_verify, skip_proxy, custom_tags
return base_url, max_detailed, specified, auth, ssl_verify, custom_tags

def _get_vhosts(self, instance, base_url, auth=None, ssl_verify=True):
vhosts = instance.get('vhosts')
Expand All @@ -163,21 +162,21 @@ def _get_vhosts(self, instance, base_url, auth=None, ssl_verify=True):
return vhosts

def check(self, instance):
base_url, max_detailed, specified, auth, ssl_verify, skip_proxy, custom_tags = self._get_config(instance)
base_url, max_detailed, specified, auth, ssl_verify, custom_tags = self._get_config(instance)
try:
# Generate metrics from the status API.
self.get_stats(instance, base_url, QUEUE_TYPE, max_detailed[QUEUE_TYPE], specified[QUEUE_TYPE], custom_tags,
auth=auth, ssl_verify=ssl_verify, skip_proxy=skip_proxy)
auth=auth, ssl_verify=ssl_verify)
self.get_stats(instance, base_url, NODE_TYPE, max_detailed[NODE_TYPE], specified[NODE_TYPE], custom_tags,
auth=auth, ssl_verify=ssl_verify, skip_proxy=skip_proxy)
auth=auth, ssl_verify=ssl_verify)

vhosts = self._get_vhosts(instance, base_url, auth=auth, ssl_verify=ssl_verify)
self.get_connections_stat(instance, base_url, CONNECTION_TYPE, vhosts, custom_tags,
auth=auth, ssl_verify=ssl_verify, skip_proxy=skip_proxy)
auth=auth, ssl_verify=ssl_verify)

# Generate a service check from the aliveness API. In the case of an invalid response
# code or unparseable JSON this check will send no data.
self._check_aliveness(instance, base_url, vhosts, custom_tags, auth=auth, ssl_verify=ssl_verify, skip_proxy=skip_proxy)
self._check_aliveness(instance, base_url, vhosts, custom_tags, auth=auth, ssl_verify=ssl_verify)

# Generate a service check for the service status.
self.service_check('rabbitmq.status', AgentCheck.OK, custom_tags)
Expand All @@ -197,7 +196,7 @@ def _get_data(self, url, auth=None, ssl_verify=True, proxies={}):
except ValueError as e:
raise RabbitMQException('Cannot parse JSON response from API url: {} {}'.format(url, str(e)))

def get_stats(self, instance, base_url, object_type, max_detailed, filters, custom_tags, auth=None, ssl_verify=True, skip_proxy=False):
def get_stats(self, instance, base_url, object_type, max_detailed, filters, custom_tags, auth=None, ssl_verify=True):
"""
instance: the check instance
base_url: the url of the rabbitmq management api (e.g. http://localhost:15672/api)
Expand Down Expand Up @@ -312,7 +311,7 @@ def _get_metrics(self, data, object_type, custom_tags):
self.log.debug("Caught ValueError for %s %s = %s with tags: %s" % (
METRIC_SUFFIX[object_type], attribute, value, tags))

def get_connections_stat(self, instance, base_url, object_type, vhosts, custom_tags, auth=None, ssl_verify=True, skip_proxy=False):
def get_connections_stat(self, instance, base_url, object_type, vhosts, custom_tags, auth=None, ssl_verify=True):
"""
Collect metrics on currently open connection per vhost.
"""
Expand Down Expand Up @@ -355,7 +354,7 @@ def alert(self, base_url, max_detailed, size, object_type, custom_tags):

self.event(event)

def _check_aliveness(self, instance, base_url, vhosts, custom_tags, auth=None, ssl_verify=True, skip_proxy=False):
def _check_aliveness(self, instance, base_url, vhosts, custom_tags, auth=None, ssl_verify=True):
"""
Check the aliveness API against all or a subset of vhosts. The API
will return {"status": "ok"} and a 200 response code in the case
Expand Down

0 comments on commit 3c40cce

Please sign in to comment.