(self, beans, metrics, tags)
Get HDFS namenode metrics from JMX
Get HDFS namenode metrics from JMX
Get HDFS namenode metrics from JMX
def _hdfs_namenode_metrics(self, beans, metrics, tags):
        """
        Get HDFS namenode metrics from JMX
        """
        bean = next(iter(beans))
        bean_name = bean.get('name')

        if bean_name != bean_name:
            raise Exception("Unexpected bean name {}".format(bean_name))

        for metric, (metric_name, metric_type) in iteritems(metrics):
            metric_value = bean.get(metric)

            if metric_value is not None:
                self._set_metric(metric_name, metric_type, metric_value, tags)

        if 'CapacityUsed' in bean and 'CapacityTotal' in bean:
            capacity_in_use = compute_percent(float(bean['CapacityUsed']), float(bean.get('CapacityTotal', 0)))
            self._set_metric(
                'hdfs.namenode.capacity_in_use',
                self.GAUGE,
                capacity_in_use,
                tags,
            )
def _hdfs_namenode_metrics ( self , beans , metrics , tags ) : bean = next ( iter ( beans ) ) bean_name = bean . get ( 'name' ) if bean_name != bean_name : raise Exception ( "Unexpected bean name {}" . format ( bean_name ) ) for metric , ( metric_name , metric_type ) in iteritems ( metrics ) : metric_value = bean . get ( metric ) if metric_value is not None : self . _set_metric ( metric_name , metric_type , metric_value , tags ) if 'CapacityUsed' in bean and 'CapacityTotal' in bean : capacity_in_use = compute_percent ( float ( bean [ 'CapacityUsed' ] ) , float ( bean . get ( 'CapacityTotal' , 0 ) ) ) self . _set_metric ( 'hdfs.namenode.capacity_in_use' , self . GAUGE , capacity_in_use , tags , )