class MonitoringAgent(ABCMonitoringAgent): def __init__(self): self.cmclient = CeilometerClient() LOG.debug("initialised monitoring agent") def deploy(self, token, tenant): pass def address(self, token): pass def get_item(self, res_id, item_name, **kwargs): LOG.debug("Monitor: request resource %s for %s" % (res_id, item_name)) item_value = self.cmclient.get_statitics(resource_id=res_id, meter_name=item_name, period=kwargs.get('period') or 60) LOG.debug("Monitor: received %s" % item_value) return item_value def dispose(self, token): pass
def __init__(self): self.cmclient = CeilometerClient() LOG.debug("initialised monitoring agent")
__author__ = 'micha' from clients.ceilometer import Client as CeiloClient if __name__ == '__main__': client = CeiloClient() print client.get_statitics(resource_id='8ada93a2-6cbb-43f7-9c4f-6c6857', meter_name='cpu_util', period=60)