(self, request, tenant_id)
return json.dumps({'values': values, 'metadata': metadata})
Gets entities, checks and alarms grouped with their latest alarm states.
Gets entities, checks and alarms grouped with their latest alarm states.
Gets entities checks and alarms grouped with their latest alarm states .
def change_logs(self, request, tenant_id):
        """
        Gets entities, checks and alarms grouped with their latest alarm states.
        """
        all_alarm_states = self._entity_cache_for_tenant(
            tenant_id).maas_store.alarm_states

        values = [{'id': text_type(uuid4()),  # probably "correct" would be each_alarm_state.id
                   'timestamp': int(1000 * self._session_store.clock.seconds()),
                   'entity_id': each_alarm_state.entity_id,
                   'alarm_id': each_alarm_state.alarm_id,
                   'check_id': each_alarm_state.check_id,
                   'status': each_alarm_state.status,
                   'state': each_alarm_state.state,
                   'previous_state': each_alarm_state.previous_state,
                   'observation': each_alarm_state.status,
                   'analyzed_by_monitoring_zone_id': each_alarm_state.analyzed_by_monitoring_zone_id}
                  for each_alarm_state in all_alarm_states]
        metadata = {'count': len(values),
                    'marker': None,
                    'next_marker': None,
                    'limit': 1000,
                    'next_href': None}

        request.setResponseCode(200)
        return json.dumps({'values': values, 'metadata': metadata})
def change_logs ( self , request , tenant_id ) : all_alarm_states = self . _entity_cache_for_tenant ( tenant_id ) . maas_store . alarm_states values = [ { 'id' : text_type ( uuid4 ( ) ) , # probably "correct" would be each_alarm_state.id 'timestamp' : int ( 1000 * self . _session_store . clock . seconds ( ) ) , 'entity_id' : each_alarm_state . entity_id , 'alarm_id' : each_alarm_state . alarm_id , 'check_id' : each_alarm_state . check_id , 'status' : each_alarm_state . status , 'state' : each_alarm_state . state , 'previous_state' : each_alarm_state . previous_state , 'observation' : each_alarm_state . status , 'analyzed_by_monitoring_zone_id' : each_alarm_state . analyzed_by_monitoring_zone_id } for each_alarm_state in all_alarm_states ] metadata = { 'count' : len ( values ) , 'marker' : None , 'next_marker' : None , 'limit' : 1000 , 'next_href' : None } request . setResponseCode ( 200 ) return json . dumps ( { 'values' : values , 'metadata' : metadata } )