AppDynamics¶
Enable AppDynamics Healthrule violations check and optionally query underlying Elasticsearch cluster raw logs.
-
appdynamics(url=None, username=None, password=None, es_url=None, index_prefix='') Initialize AppDynamics wrapper.
Parameters:
Note
If username and password are not supplied, then OAUTH2 will be used.
If appdynamics() is initialized with no args, then plugin configuration values will be used.
Methods of AppDynamics¶
-
healthrule_violations(application, time_range_type=BEFORE_NOW, duration_in_mins=5, start_time=None, end_time=None, severity=None)¶ Return Healthrule violations for AppDynamics application.
Parameters: - application (str) – Application name or ID
- time_range_type (str) – Valid time range type. Valid range types are BEFORE_NOW, BEFORE_TIME, AFTER_TIME and BETWEEN_TIMES. Default is BEFORE_NOW.
- duration_in_mins (int) – Time duration in mins. Required for BEFORE_NOW, AFTER_TIME, BEFORE_TIME range types. Default is 5 mins.
- start_time (int) – Start time (in milliseconds) from which the metric data is returned. Default is 5 mins ago.
- end_time (int) – End time (in milliseconds) until which the metric data is returned. Default is now.
- severity (str) – Filter results based on severity. Valid values are CRITICAL or WARNING.
Returns: List of healthrule violations
Return type: list
Example query:
appdynamics('https://appdynamics/controller/rest').healthrule_violations('49', time_range_type='BEFORE_NOW', duration_in_mins=5) [ { affectedEntityDefinition: { entityId: 408, entityType: "BUSINESS_TRANSACTION", name: "/error" }, detectedTimeInMillis: 0, endTimeInMillis: 0, id: 39637, incidentStatus: "OPEN", name: "Backend errrors (percentage)", severity: "CRITICAL", startTimeInMillis: 1462244635000, } ]
-
metric_data(application, metric_path, time_range_type=BEFORE_NOW, duration_in_mins=5, start_time=None, end_time=None, rollup=True)¶ AppDynamics’s metric-data API
Parameters: - application (str) – Application name or ID
- metric_path (str) – The path to the metric in the metric hierarchy
- time_range_type (str) – Valid time range type. Valid range types are BEFORE_NOW, BEFORE_TIME, AFTER_TIME and BETWEEN_TIMES. Default is BEFORE_NOW.
- duration_in_mins (int) – Time duration in mins. Required for BEFORE_NOW, AFTER_TIME, BEFORE_TIME range types.
- start_time (int) – Start time (in milliseconds) from which the metric data is returned. Default is 5 mins ago.
- end_time (int) – End time (in milliseconds) until which the metric data is returned. Default is now.
- rollup (bool) – By default, the values of the returned metrics are rolled up into a single data point
(rollup=True). To get separate results for all values within the time range, set the
rollupparameter toFalse.
Returns: metric values for a metric
Return type: list
-
query_logs(q='', body=None, size=100, source_type=SOURCE_TYPE_APPLICATION_LOG, duration_in_mins=5)¶ Perform search query on AppDynamics ES logs.
Parameters: - q (str) – Query string used in search.
- body (dict) – (dict) holding an ES query DSL.
- size (int) – Number of hits to return. Default is 100.
- source_type (str) –
sourceTypefield filtering. Default toapplication-log, and will be part ofq. - duration_in_mins (int) – Duration in mins before current time. Default is 5 mins.
Returns: ES query result
hits.Return type: list
-
count_logs(q='', body=None, source_type=SOURCE_TYPE_APPLICATION_LOG, duration_in_mins=5)¶ Perform count query on AppDynamics ES logs.
Parameters: - q (str) – Query string used in search. Will be ingnored if
bodyis not None. - body (dict) – (dict) holding an ES query DSL.
- source_type (str) –
sourceTypefield filtering. Default toapplication-log, and will be part ofq. - duration_in_mins (int) – Duration in mins before current time. Default is 5 mins. Will be ignored if
bodyis not None.
Returns: Query match count.
Return type: - q (str) – Query string used in search. Will be ingnored if
Note
In case of passing an ES query DSL in body, then all filter parameters should be explicitly added in the query body (e.g. eventTimestamp, application_id, sourceType).