cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Method to get Event Data using AppDynamicsREST Python API

ayan.dutta2
Producer

Hi ,

In AppDynamics we can get the Events Details using the REST URI like the following

http://<IP:PORT>/controller/rest/applications/8/events?time-range-type=BEFORE_NOW&duration-in-mins=300&event-types=APPLICATION_CONFIG_CHANGE,APPLICATION_ERROR,DIAGNOSTIC_SESSION,APPLICATION_CONFIG_CHANGE,APPLICATION_DEPLOYMENT,APPLICATION_ERROR,APP_SERVER_RESTART&severities=ERROR,INFO,WARN&output=JSON

 

I am looking for a method in the AppDynamicsREST Python API at http://appdynamicsrest.readthedocs.io/en/latest/api.html

 

But so far unable to to figure out any .

Can anybody provide some pointer on this ?

 

 

3 REPLIES 3

Sajna.Sreenivasan
AppDynamics Team

Hi Ayan,

 

Can you please try using the following API

 

def get_events(self, app_id=None, event_types='ALL', severities='ERROR', time_range_type='BEFORE_NOW',
                   duration_in_mins=15, start_time=None, end_time=None):
        """
        Retrieves events.

        :param int app_id: Application ID to retrieve nodes for. If :const:`None`, the value stored in the
            `app_id` property will be used.
        :param str event_types: CSV of the events types to search on
        :param str severities: CSV of the severities to search on
        :param str time_range_type: Must be one of :const:`BEFORE_NOW`, :const:`BEFORE_TIME`,
            :const:`AFTER_TIME`, or :const:`BETWEEN_TIMES`.
            See :ref:`time-range-types` for a full explanation.
        :param int duration_in_mins: Number of minutes before now. Only valid if the
            :attr:`time_range_type` is :const:`BEFORE_NOW`.
        :param long start_time: Start time, expressed in milliseconds since epoch. Only valid if the
            :attr:`time_range_type` is :const:`AFTER_TIME` or :const:`BETWEEN_TIMES`.
        :param long end_time: End time, expressed in milliseconds since epoch. Only valid if the
            :attr:`time_range_type` is :const:`BEFORE_TIME` or :const:`BETWEEN_TIMES`.
        :param bool rollup: If :const:`False`, return individual data points for each time slice in
            the given time range. If :const:`True`, aggregates the data and returns a single data point.
        :returns: A list of events for the specified app, filtered by the event type and severities desired.
        :rtype: appd.model.Events
        """

 

GIT Hub reference link:

https://github.com/Appdynamics/AppDynamicsREST

Thanks and Regards,

Sajna 



Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.

Hi ,
On which object I need to invoke this method ?

Once the client is created like the following 

 

client=AppDynamicsClient("URL","uid","pwd")


The client has methods like get_metrics,get_snapshots etc but not anything like get_events.

Could you please explain bit further ?

 

Hi Ayan,

Sorry for the late reply.

The client should have the method like get_events.For some reason it is missing in the http://appdynamicsrest.readthedocs.io/en/latest/api.html.I will look into it.

In your case, you can call it like 

 

client=AppDynamicsClient("URL","uid","pwd")

resp = client.get_events(app_id=16,

                    event_types='APPLICATION_CONFIG_CHANGE',

                    severities='INFO,WARN,ERROR',

                    time_range_type='BEFORE_NOW',

                    duration_in_mins='60000')

 

Let me know whether it works.

GIT Hub reference link:

https://github.com/Appdynamics/AppDynamicsREST

 

Thanks and Regards,

Sajna Sreenivasan



Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.