(self, base_url, vhosts, custom_tags)
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
        that the check passes.
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
        that the check passes.
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 that the check passes .
def _check_aliveness(self, base_url, vhosts, custom_tags):
        """
        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
        that the check passes.
        """

        for vhost in vhosts:
            tags = ['vhost:{}'.format(vhost)] + custom_tags
            # We need to urlencode the vhost because it can be '/'.
            path = u'aliveness-test/{}'.format(quote_plus(vhost))
            aliveness_url = urljoin(base_url, path)
            aliveness_response = {}
            try:
                aliveness_response = self._get_data(aliveness_url)
            except Exception as e:
                self.log.debug("Couldn't get aliveness status from vhost, %s: %s", vhost, e)

            if aliveness_response.get('status') == 'ok':
                status = AgentCheck.OK
                message = None
            else:
                status = AgentCheck.CRITICAL
                message = u"Response from aliveness API: {}".format(aliveness_response)

            self.service_check('rabbitmq.aliveness', status, tags, message=message)
def _check_aliveness ( self , base_url , vhosts , custom_tags ) : for vhost in vhosts : tags = [ 'vhost:{}' . format ( vhost ) ] + custom_tags # We need to urlencode the vhost because it can be '/'. path = u'aliveness-test/{}' . format ( quote_plus ( vhost ) ) aliveness_url = urljoin ( base_url , path ) aliveness_response = { } try : aliveness_response = self . _get_data ( aliveness_url ) except Exception as e : self . log . debug ( "Couldn't get aliveness status from vhost, %s: %s" , vhost , e ) if aliveness_response . get ( 'status' ) == 'ok' : status = AgentCheck . OK message = None else : status = AgentCheck . CRITICAL message = u"Response from aliveness API: {}" . format ( aliveness_response ) self . service_check ( 'rabbitmq.aliveness' , status , tags , message = message )