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 add_maps(self, res, ds): """ Check for added/removed regionservers and return a RelationshipMap if any changes took place. Otherwise return ObjectMap which only cleares the events of non-existiong components. """ # Check for removed/added region servers. dead_nodes = [prepId(dead_node_name(node)[0]) for node in self.dead] live_nodes = [prepId(node['name']) for node in self.live] nodes = set(dead_nodes + live_nodes) self.added = list(nodes.difference(set(ds.regionserver_ids))) self.removed = list(set(ds.regionserver_ids).difference(nodes)) # Check for removed/added regions. regions = set(region.get('name') for node in self.live for region in node.get('Region')) change = regions.symmetric_difference(ds.region_ids) # Remodel Regions and RegionServers only if some of them # were added/removed. if self.added or self.removed or change: ds.id = ds.device result = {'status': res, 'conf': None} return HBaseCollector().process(ds, result, log) # If nothing changed, just clear events. return [ObjectMap({'getClearEvents': True})]
def add_maps(self, res, ds): """ Check for added/removed regionservers and return a RelationshipMap if any changes took place. Otherwise return ObjectMap which only cleares the events of non-existiong components. """ # Check for removed/added region servers. dead_nodes = [prepId(dead_node_name(node)[0]) for node in self.dead] live_nodes = [prepId(node['name']) for node in self.live] nodes = set(dead_nodes + live_nodes) self.added = list(nodes.difference(set(ds.regionserver_ids))) self.removed = list(set(ds.regionserver_ids).difference(nodes)) # Check for removed/added regions. regions = set( region.get('name') for node in self.live for region in node.get('Region')) change = regions.symmetric_difference(ds.region_ids) # Remodel Regions and RegionServers only if some of them # were added/removed. if self.added or self.removed or change: ds.id = ds.device result = {'status': res, 'conf': None} return HBaseCollector().process(ds, result, log) # If nothing changed, just clear events. return [ObjectMap({'getClearEvents': True})]
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 }]