예제 #1
0
def convert_timestamp_format(current_timestamp_format, timestamp):

    return datetime_utils.change_time_str_format(
        timestamp,
        current_timestamp_format,
        TIMESTAMP_FORMAT
    )
예제 #2
0
def convert_timestamp_format(current_timestamp_format, timestamp):

    return datetime_utils.change_time_str_format(
        timestamp,
        current_timestamp_format,
        TIMESTAMP_FORMAT
    )
예제 #3
0
    def _create_vertex(self, entity_event):

        update_timestamp = datetime_utils.change_time_str_format(
            entity_event[NagiosProperties.LAST_CHECK],
            '%Y-%m-%d %H:%M:%S',
            tbase.TIMESTAMP_FORMAT)

        sample_timestamp = entity_event[DSProps.SAMPLE_DATE]

        update_timestamp = self._format_update_timestamp(update_timestamp,
                                                         sample_timestamp)

        metadata = {
            VProps.NAME: entity_event[NagiosProperties.SERVICE],
            VProps.SEVERITY: entity_event[NagiosProperties.STATUS],
            VProps.INFO: entity_event[NagiosProperties.STATUS_INFO]
        }

        return graph_utils.create_vertex(
            self._create_entity_key(entity_event),
            entity_category=EntityCategory.ALARM,
            entity_type=entity_event[DSProps.ENTITY_TYPE],
            entity_state=self._get_alarm_state(entity_event),
            sample_timestamp=sample_timestamp,
            update_timestamp=update_timestamp,
            metadata=metadata)
예제 #4
0
 def _unify_time_format(entity_event):
     try:
         entity_event[ZProps.TIMESTAMP] = format_unix_timestamp(
             entity_event[ZProps.LAST_CHANGE], tbase.TIMESTAMP_FORMAT)
     except ValueError:
         entity_event[ZProps.TIMESTAMP] = change_time_str_format(
             entity_event[ZProps.LAST_CHANGE],
             ZProps.ZABBIX_TIMESTAMP_FORMAT, tbase.TIMESTAMP_FORMAT)
예제 #5
0
 def _unify_time_format(entity_event):
     try:
         entity_event[ZProps.TIMESTAMP] = format_unix_timestamp(
             entity_event[ZProps.LAST_CHANGE], tbase.TIMESTAMP_FORMAT)
     except ValueError:
         entity_event[ZProps.TIMESTAMP] = change_time_str_format(
             entity_event[ZProps.LAST_CHANGE],
             ZProps.ZABBIX_TIMESTAMP_FORMAT,
             tbase.TIMESTAMP_FORMAT)
예제 #6
0
    def _create_nagios_neighbors(self, entity_event):
        vitrage_id = self._create_entity_key(entity_event)
        timestamp = datetime_utils.change_time_str_format(
            entity_event[NagiosProperties.LAST_CHECK],
            '%Y-%m-%d %H:%M:%S',
            tbase.TIMESTAMP_FORMAT)

        resource_type = entity_event[NagiosProperties.RESOURCE_TYPE]
        if resource_type:
            return [self._create_neighbor(
                vitrage_id,
                timestamp,
                resource_type,
                entity_event[NagiosProperties.RESOURCE_NAME])]

        return []
예제 #7
0
 def _unify_prop_time_format(entity_event, prop):
     entity_event[prop] = change_time_str_format(entity_event[prop],
                                                 EventProps.TIME_FORMAT,
                                                 tbase.TIMESTAMP_FORMAT)
예제 #8
0
 def _timestamp(entity_event):
     return datetime_utils.change_time_str_format(
         entity_event[AodhProps.TIMESTAMP], AodhProps.TIME_FORMAT,
         tbase.TIMESTAMP_FORMAT)
예제 #9
0
 def _timestamp(entity_event):
     return datetime_utils.change_time_str_format(
         entity_event[AodhProps.TIMESTAMP],
         '%Y-%m-%dT%H:%M:%S.%f',
         tbase.TIMESTAMP_FORMAT)
예제 #10
0
 def _timestamp(entity_event):
     return datetime_utils.change_time_str_format(
         entity_event[AodhProps.TIMESTAMP], '%Y-%m-%dT%H:%M:%S.%f',
         tbase.TIMESTAMP_FORMAT)