def start_time(self):
        """
        Gets the timestamp of the metric data, converting it from an AppDynamics timestamp to standard
        Python :class:`datetime`.

        :return: Time the violation was resolved
        :rtype: :class:`datetime.datetime`
        """
        return from_ts(self.start_time_ms)
    def end_time(self):
        """
        Gets the end time of the violation, converting it from an AppDynamics timestamp to standard
        Python :class:datetime.

        :return: Time the violation was resolved
        :rtype: datetime
        """
        return from_ts(self.end_time_ms)
    def start_time(self):
        """
        Gets the timestamp of the metric data, converting it from an AppDynamics timestamp to standard
        Python :class:`datetime`.

        :return: Time the violation was resolved
        :rtype: :class:`datetime.datetime`
        """
        return from_ts(self.start_time_ms)
 def created_on(self):
     """
     :rtype: datetime.datetime
     """
     return from_ts(self.created_on_ms)
 def detected_time(self):
     return from_ts(self.detected_time_ms)
 def start_time(self):
     return from_ts(self.start_time_ms)
gn_prod = [x for x in apps if x.name == "MyApp"][0]

# Calculate start and end times for the report: 24h period ending with midnight last night
#
today = to_ts(datetime.now().date())
yesterday = today - (86400 * 1000)

# Get the list of nodes so we can look up by node_id
#
all_nodes = c.get_nodes(gn_prod.id)
nodes_by_id = dict(list(zip([x.id for x in all_nodes], all_nodes)))

# Get all health rule violations and print them
#
violations = c.get_healthrule_violations(gn_prod.id,
                                         'BETWEEN_TIMES',
                                         start_time=yesterday,
                                         end_time=today)
for v in violations:
    print("-" * 70)
    print("Start time:   ", from_ts(v.start_time_ms))
    print("End time:     ", from_ts(v.end_time_ms))
    print("Description:  ", v.description)
    print("Details:      ", v.deep_link_url)
    if v.affected_entity.type == "APPLICATION_COMPONENT_NODE":
        try:
            print("Affected Node: ",
                  nodes_by_id[v.affected_entity.entity_id].name)
        except KeyError:
            print("Affected Node: UNKNOWN")
 def created_on(self):
     """
     :rtype: datetime.datetime
     """
     return from_ts(self.created_on_ms)
# Get the application list and find "MyApp"
#
apps = c.get_applications()
gn_prod = [x for x in apps if x.name == "MyApp"][0]

# Calculate start and end times for the report: 24h period ending with midnight last night
#
today = to_ts(datetime.now().date())
yesterday = today - (86400 * 1000)

# Get the list of nodes so we can look up by node_id
#
all_nodes = c.get_nodes(gn_prod.id)
nodes_by_id = dict(list(zip([x.id for x in all_nodes], all_nodes)))

# Get all health rule violations and print them
#
violations = c.get_healthrule_violations(gn_prod.id, 'BETWEEN_TIMES', start_time=yesterday, end_time=today)
for v in violations:
    print("-" * 70)
    print("Start time:   ", from_ts(v.start_time_ms))
    print("End time:     ", from_ts(v.end_time_ms))
    print("Description:  ", v.description)
    print("Details:      ", v.deep_link_url)
    if v.affected_entity.type == "APPLICATION_COMPONENT_NODE":
        try:
            print("Affected Node: ", nodes_by_id[v.affected_entity.entity_id].name)
        except KeyError:
            print("Affected Node: UNKNOWN")

Exemple #10
0
 def server_start_time(self):
     return from_ts(self.server_start_time_ms)
Exemple #11
0
 def local_start_time(self):
     return from_ts(self.local_start_time_ms)