def get_events(self, result, ds):
     """
     Return a list of event dictionaries informing about the health
     of the region server.
     """
     data = json.loads(result)
     # Check for dead servers.
     dead_nodes = [
         prepId(dead_node_name(node)[0])
         for node in version_diff(data["DeadNodes"])
     ]
     # Send error or clear event.
     severity = ((self.component in dead_nodes) and ZenEventClasses.Error
                 or ZenEventClasses.Clear)
     return [{
         'component':
         self.component,
         'summary':
         "Region server '{0}' is dead".format(
             self.component.replace('_', ':')),
         'eventKey':
         'hbase_regionserver_monitoring_error',
         'eventClass':
         '/Status',
         'severity':
         severity
     }]
    def process(self, result):
        """
        Parses resulting data into datapoints.
        """
        data = json.loads(result)
        node_id, region_id = self.component.split(NAME_SPLITTER)
        res = {}

        for node in version_diff(data["LiveNodes"]):
            if node_id == prepId(node['name']):
                for region in node["Region"]:
                    if region_id == prepId(region['name']):
                        res = {
                            'read_requests': (0, 'N'),
                            'write_requests': (0, 'N'),
                            'number_of_stores': (0, 'N'),
                            'number_of_store_files': (0, 'N'),
                            'store_file_size_mb': (0, 'N'),
                            'store_file_index_size_mb': (0, 'N'),
                            'memstore_size_mb': (0, 'N'),
                            'current_compacted_kv': (0, 'N'),
                            'total_compacting_kv': (0, 'N'),
                        }
                        return sum_perf_metrics(res, region)
        return res
    def process(self, result):
        """
        Parses resulting data into datapoints.
        """
        data = json.loads(result)

        for node in version_diff(data["LiveNodes"]):
            if self.component == prepId(node['name']):
                res = {
                    'requests_per_second': (node['requests'], 'N'),
                    'used_heap_mb': (node['heapSizeMB'], 'N'),
                    'max_heap_mb': (node['maxHeapSizeMB'], 'N'),
                    'regions': (len(node['Region']), 'N'),
                    'read_requests': (0, 'N'),
                    'write_requests': (0, 'N'),
                    'number_of_stores': (0, 'N'),
                    'number_of_store_files': (0, 'N'),
                    'store_file_size_mb': (0, 'N'),
                    'store_file_index_size_mb': (0, 'N'),
                    'memstore_size_mb': (0, 'N'),
                    'current_compacted_kv': (0, 'N'),
                    'total_compacting_kv': (0, 'N'),
                }
                for region in node["Region"]:
                    res = sum_perf_metrics(res, region)
                return res
        return {}
    def process(self, result):
        """
        Parses resulting data into datapoints.
        """
        data = json.loads(result)

        for node in version_diff(data["LiveNodes"]):
            if self.component == prepId(node['name']):
                res = {
                    'requests_per_second': (node['requests'], 'N'),
                    'used_heap_mb': (node['heapSizeMB'], 'N'),
                    'max_heap_mb': (node['maxHeapSizeMB'], 'N'),
                    'regions': (len(node['Region']), 'N'),
                    'read_requests': (0, 'N'),
                    'write_requests': (0, 'N'),
                    'number_of_stores': (0, 'N'),
                    'number_of_store_files': (0, 'N'),
                    'store_file_size_mb': (0, 'N'),
                    'store_file_index_size_mb': (0, 'N'),
                    'memstore_size_mb': (0, 'N'),
                    'current_compacted_kv': (0, 'N'),
                    'total_compacting_kv': (0, 'N'),
                }
                for region in node["Region"]:
                    res = sum_perf_metrics(res, region)
                return res
        return {}
Exemple #5
0
    def process(self, result):
        """
        Parses resulting data into datapoints.
        """
        data = json.loads(result)
        self.dead = version_diff(data['DeadNodes'])
        self.live = version_diff(data['LiveNodes'])

        # Calculate the percentage of dead servers.
        overall_servers = len(self.dead) + len(self.live)
        percent_dead_servers = 0.00
        if overall_servers:
            percent_dead_servers = len(self.dead) * 100.00 / overall_servers

        return {
            'live_servers': (len(self.live), 'N'),
            'dead_servers': (len(self.dead), 'N'),
            'requests_per_second': (data['requests'], 'N'),
            'regions': (data['regions'], 'N'),
            'average_load': (data['averageLoad'], 'N'),
            'percent_dead_servers': (percent_dead_servers, 'N'),
        }
    def process(self, result):
        """
        Parses resulting data into datapoints.
        """
        data = json.loads(result)
        self.dead = version_diff(data['DeadNodes'])
        self.live = version_diff(data['LiveNodes'])

        # Calculate the percentage of dead servers.
        overall_servers = len(self.dead) + len(self.live)
        percent_dead_servers = 0.00
        if overall_servers:
            percent_dead_servers = len(self.dead) * 100.00 / overall_servers

        return {
            'live_servers': (len(self.live), 'N'),
            'dead_servers': (len(self.dead), 'N'),
            'requests_per_second': (data['requests'], 'N'),
            'regions': (data['regions'], 'N'),
            'average_load': (data['averageLoad'], 'N'),
            'percent_dead_servers': (percent_dead_servers, 'N'),
        }
 def get_events(self, result, ds):
     """
     Return a list of event dictionaries informing about the health
     of the region server.
     """
     data = json.loads(result)
     # Check for dead servers.
     dead_nodes = [prepId(dead_node_name(node)[0]) for node
                   in version_diff(data["DeadNodes"])]
     # Send error or clear event.
     severity = ((self.component in dead_nodes) and ZenEventClasses.Error
                 or ZenEventClasses.Clear)
     return [{
         'component': self.component,
         'summary': "Region server '{0}' is dead".format(
             self.component.replace('_', ':')),
         'eventKey': 'hbase_regionserver_monitoring_error',
         'eventClass': '/Status',
         'severity': severity
     }]