def __init__(self, title, probe_id, interval): super(BaseCpuNodePuller, self).__init__( title=title, probe_id=probe_id, interval=interval, ) self.wrapper = HostMonitoring()
def __init__(self, title, probe_id, interval): super(BaseMemoryNodePuller, self).__init__( title=title, probe_id=probe_id, interval=interval, ) self.wrapper = HostMonitoring()
class BaseSwapNodePuller(MetricPuller): def __init__(self, title, probe_id, interval): super(BaseSwapNodePuller, self).__init__( title=title, probe_id=probe_id, interval=interval, ) self.wrapper = HostMonitoring() @property def metric(self): raise NotImplementedError # HostMetric attribute @property def unit(self): raise NotImplementedError # (unicode string) def do_pull(self): LOG.info("[%s] Pulling measurements...", self.key) value = self.wrapper.swap_usage(self.metric) resource_metadata = {"host": platform.node(), "title": self.title} measurement = Measurement( name=self.probe_id, unit=self.unit, type_="gauge", value=value, resource_id=platform.node(), resource_metadata=resource_metadata, ) LOG.info("[%s] Measurements collected.", self.key) return [measurement]
class BaseSwapNodePuller(MetricPuller): def __init__(self, title, probe_id, interval): super(BaseSwapNodePuller, self).__init__( title=title, probe_id=probe_id, interval=interval, ) self.wrapper = HostMonitoring() @property def metric(self): raise NotImplementedError # HostMetric attribute @property def unit(self): raise NotImplementedError # (unicode string) def do_pull(self): LOG.info("[%s] Pulling measurements...", self.key) value = self.wrapper.swap_usage(self.metric) resource_metadata = { "host": platform.node(), "title": self.title } measurement = Measurement( name=self.probe_id, unit=self.unit, type_="gauge", value=value, resource_id=platform.node(), resource_metadata=resource_metadata, ) LOG.info("[%s] Measurements collected.", self.key) return [measurement]