(self)
Returns a dictionary with JMX domain names as keys
Returns a dictionary with JMX domain names as keys
Returns a dictionary with JMX domain names as keys
def _list_request(self):
        """Returns a dictionary with JMX domain names as keys"""
        try:
            # https://jolokia.org/reference/html/protocol.html
            #
            # A maxDepth of 1 restricts the return value to a map with the JMX
            # domains as keys. The values of the maps don't have any meaning
            # and are dummy values.
            #
            # maxCollectionSize=0 means "unlimited". This works around an issue
            # prior to Jolokia 1.3 where results were truncated at 1000
            #
            url = "http://%s:%s/%s%s?maxDepth=1&maxCollectionSize=0" % (
                self.config['host'],
                self.config['port'],
                self.jolokia_path,
                self.LIST_URL)
            # need some time to process the downloaded metrics, so that's why
            # timeout is lower than the interval.
            timeout = max(2, float(self.config['interval']) * 2 / 3)
            with closing(urllib2.urlopen(self._create_request(url),
                                         timeout=timeout)) as response:
                return self._read_json(response)
        except (urllib2.HTTPError, ValueError) as e:
            self.log.error('Unable to read JSON response: %s', str(e))
            return {}
def _list_request ( self ) : try : # https://jolokia.org/reference/html/protocol.html # # A maxDepth of 1 restricts the return value to a map with the JMX # domains as keys. The values of the maps don't have any meaning # and are dummy values. # # maxCollectionSize=0 means "unlimited". This works around an issue # prior to Jolokia 1.3 where results were truncated at 1000 # url = "http://%s:%s/%s%s?maxDepth=1&maxCollectionSize=0" % ( self . config [ 'host' ] , self . config [ 'port' ] , self . jolokia_path , self . LIST_URL ) # need some time to process the downloaded metrics, so that's why # timeout is lower than the interval. timeout = max ( 2 , float ( self . config [ 'interval' ] ) * 2 / 3 ) with closing ( urllib2 . urlopen ( self . _create_request ( url ) , timeout = timeout ) ) as response : return self . _read_json ( response ) except ( urllib2 . HTTPError , ValueError ) as e : self . log . error ( 'Unable to read JSON response: %s' , str ( e ) ) return { }