Splunk AppDynamics

Method to get Event Data using AppDynamicsREST Python API

CommunityUser
Splunk Employee
Splunk Employee

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 ?

Labels (1)
Tags (4)
0 Karma
1 Solution

Sajna_Sreenivas
Path Finder

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

View solution in original post

0 Karma

Sajna_Sreenivas
Path Finder

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 

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

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 ?

0 Karma

Sajna_Sreenivas
Path Finder

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

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...