API モニタリングジョブの設定

このページでは、API モニタリングジョブの設定方法について説明します。

API モニタリングジョブには、以下の詳細を設定できます。

  • ジョブをいつ、どこで、どの程度の頻度で実行するかのスケジュール。
  • タイムアウトの設定。
  • 警告イベントおよび重大イベントをトリガーするパフォーマンスしきい値の設定。

ジョブの作成

  1. コントローラ UI で、[User Experience] [>] [API Monitoring] をクリックします。
  2. [Add Collection] をクリックしてコレクション名を指定します。
  3. [Add] をクリックします。
  4. 新しく作成されたコレクションを選択し、ジョブを追加します。

新しいジョブの設定ページが表示されたら、以下の手順に進みます。

Configure API Requests

Specify a name for the API job, and then you can configure API requests through one of the following options:

GUI

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.

  1. Select an HTTP method from the right pane. The supported methods are GET, POST, PUT, and DELETE.
  2. Specify the URL to which you want to make the API call.
  3. 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:

    CODE
    {{<variable-name>}}
    CopyCODE
    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:

    JSON
    { title: "foo" body: "bar", userId: 100, }
    CopyJSON
    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 JavaScript

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:

  1. Click Import > Choose File, and then select the API collection JSON file that you exported from Postman.
  2. Click Import.
  3. When you get the success message, review the script on the Script Editor tab.
    Note: Any string enclosed with double curly brackets {{ }} is a variable. You must replace the variable manually with an appropriate value.

    You can verify if the collections are imported by navigating to User Experience > API Monitoring.

ロケーションを選択

ジョブを実行する 1 つ以上の場所を選択できます。毎回すべての場所をテストするようにジョブを構成することも、ジョブが実行されるたびに 1 つの場所をテストするように構成することもできます。合成エージェントの場所の完全なリストについては、「合成エージェントの場所」を参照してください。

ホステッドエージェントを使用して、パブリック API エンドポイントをモニタリングします。ホステッドエージェントを使用して、実際の API トラフィックまたはリクエストが生成された場所からの API ジョブをモニタリングできます。

プライベートエージェントを使用して、プライベート API をモニタリングします。たとえば、顧客ネットワーク内で使用される API などがあります。

注:
  • [Hosted Agent Locations] は、AppDynamics がパブリック合成エージェントをホストする場所です。Splunk AppDynamics には、17 ヵ所(AWS ロケーションのみ)にホステッドエージェントがあります。これらの 17 のホステッドエージェントの場所から API モニタリングジョブを実行できます。

  • API モニタリングプライベート合成エージェントを展開している場合は、[Hosted Agent Locations] または [Private Agent Locations] から選択できます。
  • [Private Agent Locations] は、プライベート合成エージェントをホストしている場所です。これらの環境のいずれかでプライベート合成エージェントを設定できます。

スケジュールの設定

警告: 複数のスケジュール機能は、SaaS コントローラ 22.2.0 以降のバージョンでのみサポートされています。

ジョブを作成または編集するときに、ジョブスケジュールを定義できます。

同じジョブに複数のスケジュールを作成できます。各スケジュールには、独自のタイムゾーン、頻度、および実行間隔を設定できます。これにより、以下のさまざまな頻度でジョブを実行できます。

周波数
1 日の異なる間隔

Schedule 1:午前 8 時から午後 8 時まで 1 分間隔でジョブを実行

Schedule 2:午後 8 時 1 分から午前 7 時 59 分まで 5 分間隔でジョブを実行

異なる曜日

Schedule 1:平日に 1 分間隔でジョブを実行

Schedule 2:週末に 5 分間隔でジョブを実行

異なるタイムゾーン

Schedule 1:PST タイムゾーンの午前 8 時から午後 8 時まで 1 分間隔でジョブを実行

Schedule 2:BST タイムゾーンの午前 8 時から午後 8 時まで 5 分間隔でジョブを実行

異なる日付間隔

Schedule 1:2022 年 2 月 21 日から 2022 年 3 月 31 日まで 1 分間隔でジョブを実行

Schedule 2:2022 年 4 月 1 日から 2026 年 3 月 31 日まで 5 分間隔でジョブを実行

重要: ジョブごとに最大 3 つのスケジュールを作成できます。

[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 ジョブがタイムアウトします。

注: タイムアウトのために失敗したジョブは、可用性の問題と見なされます。

パフォーマンスしきい値の構成

この手順は任意です。しきい値を超えたときに警告合成イベントまたは重大な合成イベントをトリガーするパフォーマンスしきい値を設定できます。

可用性の設定

API ジョブの失敗は、理由(無効なステータスコード、応答コンテンツの検証、応答サイズの検証など)に関係なく、デフォルトでは可用性イベントとして報告されるように設定されています。誤検出を避けるために、イベントをトリガーする前に特定の回数だけジョブを再テストするように設定することもできます。

パフォーマンスイベント

API ジョブの応答時間に基づいて、警告または重大なエラーのイベントをトリガーするように API ジョブを設定することができます。誤検出を避けるために、イベントをトリガーする前に特定の回数だけジョブを再テストするように設定することもできます。

注: クレデンシャルを合成クレデンシャル Vault に保存する方法については、次を参照してください。

Web モニタリング用のクレデンシャル Vault

.