API モニタリングジョブの設定
このページでは、API モニタリングジョブの設定方法について説明します。
API モニタリングジョブには、以下の詳細を設定できます。
- ジョブをいつ、どこで、どの程度の頻度で実行するかのスケジュール。
- タイムアウトの設定。
- 警告イベントおよび重大イベントをトリガーするパフォーマンスしきい値の設定。
ジョブの作成
- コントローラ UI で、[User Experience] > [API Monitoring] をクリックします。
- [Add Collection] をクリックしてコレクション名を指定します。
- [追加(Add)] をクリックします。
- 新しく作成されたコレクションを選択し、ジョブを追加します。
新しいジョブの設定ページが表示されたら、以下の手順に進みます。
Configure API Requests
Specify a name for the API job, and then you can configure API requests through one of the following options:
If you do not want to manually create JavaScripts for configuring jobs, the GUI option provides an easy way to configure jobs.
Click GUI and configure an API request:
The API Requests pane on the left displays the API request that you configure. The API request that you create is named Request 1, you can edit the name later from the API requests list view.
- Select an HTTP method from the right pane. The supported methods are
GET,POST,PUT, andDELETE. - Specify the URL to which you want to make the API call.
- Specify the following details based on the method type:
Tabs Description Settings Select the Follow Redirects option if the API redirects to another API.
When you enable Follow Redirects, you can specify the maximum number under Follow Redirects count. This indicates the number of redirects that are checked for the particular URL.
Response Validation You can validate the response by adding assertions.
For example, when you select Status Code, =, and enter the value as
200, then the job will be successful only when the status code is 200. Similarly, you can add multiple assertions, such as response content, and response time.Params Enter the parameter that you want to query along with the value.
Initialise You can create initial variables. Specify a variable name and a value. Then you can use it using the following syntax:
CopyCODECODE{{<variable-name>}}Header Enter a header name and value as key-value pair. Body XML and JSON body types are supported.
Select a body type and enter the details. For example:
CopyJSONJSON{ title: "foo" body: "bar", userId: 100, }Authentication The following authentication types are supported:
- Basic Auth: Specify the username and password.
- Token: Specify the bearer token.
- No Auth: No value is required.
You can also store your secrets in the Synthetic Credential Vault.
Create a JavaScript for your job and enter it in the Script Editor.
For sample JavaScripts for API Monitoring, see JavaScript.
Import API Collection from Postman
You can import the API collections of Postman to the API monitoring jobs.
Instead of manually creating the API collections again on Controller, you can import the existing API collections of Postman.
You must first export the API collection as a JSON file from Postman, and then import the JSON file to API Monitoring jobs. Choose the recommended Collection v2.1 while exporting. Exporting the file as Collection v2 is not supported.
Perform the following steps to import the Postman collections:
Select Locations
You can select one or more locations in which the job runs. You can configure the job to test all of the locations every time or one location each time the job runs. For a complete list of Synthetic Agent locations, see Synthetic Agent Locations.
Use the hosted agents to monitor public API endpoints. You can use hosted agents to monitor the API jobs from locations where the real API traffic or request is generated.
Use the private agents to monitor the private APIs. For example, APIs used within a customer network.
-
The Hosted Agent Locations are where Splunk AppDynamics hosts public synthetic agents. Splunk AppDynamics has hosted agents in 17 locations (AWS locations only). You can execute the API monitoring jobs from these 17 hosted agent locations.
- If you have deployed an API Monitoring Private Synthetic Agent, you can choose from Hosted Agent Locations or Private Agent Locations.
-
The Private Agent Locations are where you host your private synthetic agents. You can set up private synthetic agents in any of these environments.
スケジュールの設定
ジョブを作成または編集するときに、ジョブスケジュールを定義できます。
同じジョブに複数のスケジュールを作成できます。各スケジュールには、独自のタイムゾーン、頻度、および実行間隔を設定できます。これにより、以下のさまざまな頻度でジョブを実行できます。
| 周波数 | 例 |
|---|---|
| 1 日の異なる間隔 |
スケジュール 1:午前 8 時から午後 8 時まで 1 分間隔でジョブを実行 Schedule 2:午後 8 時 1 分から午前 7 時 59 分まで 5 分間隔でジョブを実行 |
| 異なる曜日 |
スケジュール 1:平日に 1 分間隔でジョブを実行 スケジュール 2:週末に 5 分間隔でジョブを実行 |
| 異なるタイムゾーン |
スケジュール 1:PST タイムゾーンの午前 8 時から午後 8 時まで 1 分間隔でジョブを実行 スケジュール 2:BST タイムゾーンの午前 8 時から午後 8 時まで 5 分間隔でジョブを実行 |
| 異なる日付間隔 |
スケジュール 1:2022 年 2 月 21 日から 2022 年 3 月 31 日まで 1 分間隔でジョブを実行 スケジュール 2:2022 年 4 月 1 日から 2026 年 3 月 31 日まで 5 分間隔でジョブを実行 |
[スケジュールの追加(Add Schedule)] をクリックして、同じジョブの別のスケジュールを設定します。少なくとも 1 つのスケジュールを作成する必要があります。
メンテナンス期間中のジョブの実行を防止できます。
2022 年 3 月 21 日(午前 1 時 1 分~ 午前 5 時)に 4 時間のメンテナンス期間があると仮定します。その場合、次のように複数のスケジュールを設定できます。
- Schedule 1:2022 年 2 月 21 日午前 8 時から 2022 年 3 月 21 日午前 1 時まで 1 分間隔でジョブを実行
- Schedule 2:2022 年 2 月 21 日午前 5 時 1 分から 2026 年 3 月 21 日午前 12 時まで 1 分間隔でジョブを実行
タイムアウト時間の設定
ジョブの実行時間が一定の期間を超えた場合にジョブが失敗するようにタイムアウトを設定できます。デフォルトでは、ジョブの実行が 5 分以内に完了しない場合に API ジョブがタイムアウトします。
Configure Performance Thresholds
This is an optional step. You can configure performance thresholds that will trigger warning or critical synthetic events when the thresholds are exceeded.
API jobs failure irrespective of the reason, namely, invalid status code, response content validation, response size validation, and so on, are configured to be reported as an availability event by default. To avoid false positives, you can configure to re-test the jobs a specific number of times before triggering the events.
You can configure API jobs to trigger warning or critical error events based on the response time of the API jobs. To avoid false positives, you can configure to re-test the jobs a specific number of times before triggering the events.