Events API

ビジネスアプリケーションのすべての正常性ルール違反を取得する

このページでは、イベントを作成、管理、およびモニターするために使用できる、イベント API メソッドについて説明します。

指定したタイムフレーム内にアプリケーションで発生したすべての正常性ルールに対する違反を返します。

URI

/controller/rest/applications/application_id/problems/healthrule-violations

入力パラメータ

パラメータ名 Parameter Type 必須

application_id

URI

アプリケーション名またはアプリケーション ID のいずれかを指定します。

あり

time-range-type

クエリ

可能な値は以下の通りです:

BEFORE_NOW BEFORE_NOW" duration-in-mins"" オプションを使用するには、" および " パラメータも指定する必要があります。BEFORE_TIMEBEFORE_TIME"duration-in-mins""end-time" オプションを使用するには、" および " パラメータも指定する必要があります。AFTER_TIMEAFTER_TIME" duration-in-mins""start-time" オプションを使用するには、" および " パラメータも指定する必要があります。

BETWEEN_TIMES

このオプションを使用するには、"start-time" および "end-time" パラメータも指定する必要があります。"BETWEEN_TIMES" の範囲には start-time が含まれますが、end-time は除外されます。

あり

duration-in-mins

クエリ

メトリックデータを返す期間(分単位)。

time-range-type が BEFORE_NOW, BEFORE_TIME, または AFTER_TIME の場合

start-time

クエリ

メトリックデータが返される期間の開始時刻(ミリ秒単位)。

time-range-type が AFTER_TIME または BETWEEN_TIMES の場合

end-time

クエリ

メトリックデータが返される期間の終了時刻(ミリ秒単位)。

time-range-type が BEFORE_TIME または BETWEEN_TIMES の場合

output

クエリ

出力形式を変更するために URL の一部として含まれている HTTP リクエストパラメータ。有効な値は XML(デフォルト)または JSON です。

いいえ

http://demo.appdynamics.com/controller/rest/applications/7/problems/healthrule-violations?time-range-type=BEFORE_NOW&duration-in-mins=15 <policy-violations><policy-violation> <id>266</id> <name>CPU utilization is too high</name> <startTimeInMillis>1452630655000</startTimeInMillis> <detectedTimeInMillis>0</detectedTimeInMillis> <endTimeInMillis>1452630715000</endTimeInMillis> <incidentStatus>RESOLVED</incidentStatus> <severity>WARNING</severity> <triggeredEntityDefinition> <entityType>POLICY</entityType> <entityId>30</entityId> <name>CPU utilization is too high</name> </triggeredEntityDefinition> <affectedEntityDefinition> <entityType>APPLICATION_COMPONENT_NODE</entityType> <entityId>16</entityId> <name>Fulfillment</name> </affectedEntityDefinition> <deepLinkUrl>http://demo.appdynamics.com/controller/#location=APP_INCIDENT_DETAIL&incident=266</deepLinkUrl> <description>AppDynamics has detected a problem.<br><b>errorAbhi</b> is violating. </description> </policy-violation> <policy-violation> <id>268</id> <name>CPU utilization is too high</name> <startTimeInMillis>1452630655000</startTimeInMillis> <detectedTimeInMillis>0</detectedTimeInMillis> <endTimeInMillis>1452630715000</endTimeInMillis> <incidentStatus>RESOLVED</incidentStatus> <severity>WARNING</severity> <triggeredEntityDefinition> <entityType>POLICY</entityType> <entityId>30</entityId> <name>CPU utilization is too high</name> </triggeredEntityDefinition> <affectedEntityDefinition> <entityType>APPLICATION_COMPONENT_NODE</entityType> <entityId>20</entityId> <name>FulfillmentClient</name> </affectedEntityDefinition> <deepLinkUrl>http://demo.appdynamics.com/controller/#location=APP_INCIDENT_DETAIL&incident=268</deepLinkUrl> <description>AppDynamics has detected a problem with Node <b>FulfillmentClient</b>.<br><b>CPU utilization is too high</b> started violating and is now <b>warning</b>.<br>All of the following conditions were found to be violating<br>For Node <b>FulfillmentClient</b>:<br>1) Hardware Resources|CPU|%Busy Condition<br><b>%Busy's</b> value <b>76.0</b> was <b>greater than</b> the threshold <b>75.0</b> for the last <b>30</b> minutes<br></description> </policy-violation> </policy-violations>

イベントデータを取得する

eventtypes パラメータにリストされているイベントタイプのデータをキャプチャできます。

URI /controller/rest/applications/application_id/events

入力パラメータ

パラメータ名 Parameter Type 必須

application_id

URI

アプリケーション名またはアプリケーション ID のいずれかを指定します。

あり

summary クエリイベントの概要を指定します。あり
コメント クエリイベントのコメント(存在する場合)を指定します。いいえ
eventtype クエリ APPLICATION_DEVELOPMENT あり

time-range-type

クエリ

可能な値は以下の通りです:

BEFORE_NOW:「BEFORE_NOW」オプションを使用するには、「duration-in-mins」パラメータも指定する必要があります。BEFORE_TIME:「BEFORE_TIME」オプションを使用するには、「duration-in-mins」および「end-time」パラメータも指定する必要があります。AFTER_TIME:「AFTER_TIME」オプションを使用するには、「duration-in-mins」および「start-time」パラメータも指定する必要があります。

BETWEEN_TIMES

このオプションを使用するには、「start-time」および「end-time」パラメータも指定する必要があります。[BETWEEN_TIMES] の範囲には start-time が含まれますが、end-time は除外されます。

あり

duration-in-mins

クエリ

メトリックデータを返す期間(分単位)を指定します。

time-range-type が BEFORE_NOW, BEFORE_TIME、または AFTER_TIME の場合

start-time

クエリ

メトリックデータが返される期間の開始時刻(ミリ秒単位)を指定します。

ttime-range-type が AFTER_TIME または BETWEEN_TIMES の場合

end-time

クエリ

メトリックデータが返される期間の終了時刻(ミリ秒単位)を指定します。

time-range-type が BEFORE_TIME または BETWEEN_TIMES の場合

event-types

クエリ

イベント情報を取得するイベントタイプのカンマ区切りリストを指定します。イベント参考資料 Events Reference

あり

重大度

クエリ

重大度レベルを指定します。イベント情報を取得する重大度のカンマ区切りリストを指定します。使用できる値は、次のとおりです。

  • INFO
  • WARN
  • エラー

UI では、これらの値が Info、Warning、および Critical になります。

あり

出力

クエリ

出力形式を変更するために URL の一部として含まれている HTTP リクエストパラメータ。有効な値は XML(デフォルト)または JSON です。

いいえ

階層 クエリアプリケーションの階層名いいえ
注: この API を使用して、一度に 600 件のイベントを取得できます。

指定した時間範囲内で発生した任意のシビラティ(重大度)の APPLICATION_ERROR または DIAGNOSTIC_SESSION タイプのイベントリストを取得します。

curl --user user1@customer1:your_password http://demo.appdynamics.com//controller/rest/applications/6/events?time-range-type=BEFORE_NOW\&duration-in-mins=30\&event-types=%20APPLICATION_ERROR,DIAGNOSTIC_SESSION\&severities=INFO,WARN,ERROR
<events><event>
<id>44658</id>
<type>DIAGNOSTIC_SESSION</type>
<subType>ERROR_DIAGNOSTIC_SESSION</subType>
<eventTime>1451343453085</eventTime>
<severity>WARN</severity>
<summary>ビジネストランザクションで一連のエラーが発生した後、診断セッションを開始した現地時間の 2015 年 12 月 28 日 22:57 から 1 分間にリクエストの 18%(2/11)にエラーが発生</summary>
<affectedEntities>
<entity-definition>
<entityType>APPLICATION</entityType>
<entityId>6</entityId>
<name>ECommerce</name>
</entity-definition>
<entity-definition>
<entityType>APPLICATION_COMPONENT</entityType>
<entityId>11</entityId>
<name>ECommerce-Services</name>
</entity-definition>
<entity-definition>
<entityType>APPLICATION_COMPONENT_NODE</entityType>
<entityId>19</entityId>
<name>ECommerce_WEB2</name>
</entity-definition>
<entity-definition>
<entityType>BUSINESS_TRANSACTION</entityType>
<entityId>35</entityId>
<name>/items/all.GET</name>
</entity-definition>
<entity-definition>
<entityType>MACHINE_INSTANCE</entityType>
<entityId>8</entityId>
<name>ECommerce-web1</name>
</entity-definition>
</affectedEntities>
<triggeredEntity>
<entityType>APPLICATION_COMPONENT_NODE</entityType>
<entityId>19</entityId>
<name>ECommerce_WEB2</name>
</triggeredEntity>
<markedAsRead>false</markedAsRead>
<markedAsResolved>false</markedAsResolved>
<archived>false</archived>
<deepLinkUrl>http://demo.appdynamics.com:8090/controller/#location=APP_EVENT_VIEWER_MODAL&eventSummary=44658</deepLinkUrl>
</event>
</events>

Create Events

Application deployment events notify Splunk AppDynamics when you upgrade your application, push new code, etc. This lets you correlate these application deployment activities with other data inside Splunk AppDynamics. This is useful for regression analysis, root cause analysis, and performance studies. It is beneficial to inject your application deployment event into Splunk AppDynamics as part of the build process for deploying a new version of your application.

The Splunk AppDynamics REST API lets you integrate events of type APPLICATION_DEPLOYMENT with other systems.

For example, to create an event automatically in your Splunk AppDynamics monitored system for every new release you would integrate these systems and use the following REST API to create an event of type "APPLICATION_DEPLOYMENT" in your managed environment.

You should receive the event ID after the successful invocation of the request.

Roles and Permissions

重要: Creating events requires the Create Events permission. See Application Permissions.

URI

POST /controller/rest/applications/application_id/events

Input parameters

Parameter Name Parameter Type Value Mandatory

application_id

URI

Provide either application name or application id.

Yes

summary

Query

Provide a summary describing the event.

Yes

comment

Query

Provide the comments (if any) for the event.

No

eventtype

Query

APPLICATION_DEPLOYMENT

Yes

severity QueryProvide a severity level. Allowed values include:
  • "INFO"
  • "WARN"
  • "ERROR"

In the UI, these become "Info", "Warning", and "Critical"

Yes

Create a Custom Event

You can create custom events to be reported in the Splunk AppDynamics event viewer and in the event panels on the Splunk AppDynamics dashboards. See Monitor Events to learn how to filter on your custom events. Then you can create alerts triggered by these events as you do for Splunk AppDynamics standard events.

You should receive the event ID after the successful invocation of the request.

Roles and Permissions

重要: Creating a custom event requires the Create Events permission. See Application Permission

URI

POST /controller/rest/applications/application_id/events

Input parameters

Parameter Name Parameter Type Value Mandatory

application_id

URI

Provide either application name or application id.

Yes

summary

Query

Provide a summary describing the event.

Yes

comment

Query

Provide a comment for the event.

No

severity Query

Provide a severity level. Allowed values include:

  • "INFO"
  • "WARN"
  • "ERROR"

In the UI, these become "Info", "Warning", and "Critical"

Yes

eventtype

Query

CUSTOM

Yes

customeventtype QueryProvide a name for the " type". For example, the source could be " nagios". No
node QueryProvide the affected node name.No
tier QueryProvide the affected tier name.Yes, if node and bt are specified
bt QueryProvide the affected business transaction name.No
propertynames QueryProvide a property name as a pair, i.e., the " key". No, but if one element of the pair is defined, the other must be defined also
propertyvalues QueryProvide the property value as a pair, i.e., the " value" . The value is limited to 5000 characters.

No, but if one element of the pair is defined, the other must be defined also

Example

curl -X POST --user user1@customer1:your_password 'http://demo.appdynamics.com/controller/rest/applications/5/events?severity=INFO&summary=test1&eventtype=CUSTOM&customeventtype=mycustomevent&propertynames=key1&propertynames=key2&propertyvalues=value1&propertyvalues=value'
警告: Notice the pattern for custom properties: propertynames and propertyvalues get matched up by order position, so to set N property values, you need N occurrences of propertynames and N occurrences of propertyvalues.

Create Custom URLs for Notifications

Single tenants in a multi-tenant Controller instance should use this API method to specify a custom or vanity URL for notification purposes. Instead of a URL such as paid8.appdynamics.com being displayed as the host, the custom URL can be displayed as yourcompany.appdynamics.com in the notification.

URI

POST /controller/rest/accounts/customer_name/update-controller-url

Input parameters

Parameter Name Parameter Type Value Mandatory
customer_name URIThe customer account nameYes

Body Parameter

As Application/JSON content:

{
"controllerURL": "http://<my-custom-hostname:port>"
}
注:

If the URL in the alerts is invalid, you can set it using the following curl command:

curl -k --basic --user root@system --header "Content-Type: application/json" --data '{ "controllerURL": "http://<controller>:<port>" }' http://<controller>:<port>/controller/rest/accounts/<ACCOUNT-NAME>/update-controller-url
curl -k --basic --user root@system --header "Content-Type: application/json" --data '{ "controllerURL": "http://<controller>:<port>" }' http://<controller>:<port>/controller/rest/accounts/<ACCOUNT-NAME>/update-controller-url

For example:

curl -k --basic --user root@system --header "Content-Type: application/json" --data '{ "controllerURL": "https://myVIP:443" }' https://myhost:8181/controller/rest/accounts/customer1/update-controller-url

There is no need to reset the Controller as upgrading it will reset the deep link URL settings.