モニター API リファレンス

フィールドに指定できる値

モニターの地域

説明
US_EAST_1北バージニア
CA_CENTRAL_1カナダ (モントリオール)
EU_CENTRAL_1フランクフルト
AP_NORTHEAST_1東京

モニターのアラートの種類

説明
INCIDENTインシデントのアラート
EMAILメールのアラート
SMSSMS のアラート
SLACKSlack のアラート
DISCORDDiscord のアラート
MICROSOFT_TEAMSMicrosoft Teams のアラート
PHONE_CALL電話のアラート
WEBHOOKWebhook のアラート
GOOGLE_CHATGoogle Chat のアラート
WHATSAPPWhatsApp のアラート

モニターのステータス

説明
UPモニターは正常に動作しています
DOWNモニターが失敗しました
DEGRADEDモニターに問題が発生しています
UNKNOWNモニターの状態を判定できません

モニターを取得する

このエンドポイントを使うと、既存のモニターの一覧を検索したり、たどったりできます。

エンドポイント:

GET /:page_id/monitors

クエリパラメーター

パラメーター既定値説明
pagenumber1取得するページ番号。
limitnumber1001 ページあたりのモニターの件数。
searchstringnull結果を絞り込むための検索語。
statusenumnullステータスによる絞り込み ('UP'、'DOWN'、'UNKNOWN'、'DEGRADED')

リクエストの例

GET /1/monitors?limit=3&page=2&status=DOWN

レスポンスの例

{
"monitors": [{ "...": "monitor objects" }],
"total": 10,
"page": 3,
"totalPages": 5,
"limit": 2
}

モニターを作成する

エンドポイント:

POST /monitors

リクエストの例

{
"pageId": "page123",
"url": "https://example.com",
"httpMethod": "GET",
"body": null,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token"
},
"queryParams": {
"search": "test",
"limit": "10"
},
"basicAuth": {
"username": "user",
"password": "password"
},
"type": "HTTP",
"assertions": [
{
"type": "STATUSCODE",
"comparison": "EQUALS",
"selector": null,
"target": "200"
}
],
"alerts": ["alert-id-1", "alert-id-2"],
"name": "Example Monitor",
"locations": "US_EAST_1",
"checksInterval": 300,
"createComponent": true,
"createMetric": true,
"onFail": {
"createIncident": true,
"createOutageDuration": true,
"publishIncident": true,
"notifySubscribers": true
},
"onRecover": {
"resolveIncident": true,
"resolveOutageDuration": true,
"publishIncident": true,
"notifySubscribers": true
}
}

レスポンスの例

{
"monitor": {
"pageId": "page123",
"url": "https://example.com",
"httpMethod": "GET",
"body": null,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token"
},
"queryParams": {
"search": "test",
"limit": "10"
},
"basicAuth": {
"username": "user",
"password": "password"
},
"type": "HTTP",
"assertions": [
{
"id": "assertion1",
"type": "STATUSCODE",
"comparison": "EQUALS",
"selector": null,
"target": "200"
}
],
"alerts": ["alert1", "alert2"],
"name": "Example Monitor",
"locations": "US_EAST_1",
"checksInterval": 300,
"createComponent": true,
"createMetric": true,
"onFail": {
"createIncident": true,
"createOutageDuration": true,
"publishIncident": true,
"notifySubscribers": true
},
"onRecover": {
"resolveIncident": true,
"resolveOutageDuration": true,
"publishIncident": true,
"notifySubscribers": true
},
"createdAt": "2023-08-08T12:00:00Z",
"updatedAt": "2023-08-08T12:00:00Z"
},
"message": "Monitor created successfully"
}

モニターを更新する

エンドポイント:

PUT /monitors/:id

リクエストの例

{
"url": "https://updated.com",
"name": "Updated Monitor Name"
}

レスポンスの例

{
"monitor": {
"pageId": "page123",
"url": "https://updated.com",
"httpMethod": "GET",
"body": null,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token"
},
"queryParams": {
"search": "test",
"limit": "10"
},
"basicAuth": {
"username": "user",
"password": "password"
},
"type": "HTTP",
"assertions": [
{
"id": "assertion1",
"type": "STATUSCODE",
"comparison": "EQUALS",
"selector": null,
"value": "200"
}
],
"alerts": ["alert1", "alert2"],
"name": "Updated Monitor Name",
"locations": "US_EAST_1",
"checksInterval": 300,
"createComponent": true,
"createMetric": true,
"onFail": {
"createIncident": true,
"createOutageDuration": true,
"publishIncident": true,
"notifySubscribers": true
},
"onRecover": {
"resolveIncident": true,
"resolveOutageDuration": true,
"publishIncident": true,
"notifySubscribers": true
},
"createdAt": "2023-08-08T12:00:00Z",
"updatedAt": "2023-08-08T12:00:00Z"
},
"message": "Monitor updated successfully"
}

モニターを削除する

エンドポイント:

DELETE /monitors/:id

リクエストの例

DELETE /monitors/monitor-id-1

レスポンスの例

{
"message": "Monitor deleted successfully."
}

モニターのログを取得する

エンドポイント:

GET /monitors/:id/logs

クエリパラメーター

パラメーター既定値説明
limitnumber1001 ページあたりの件数。1000 を超えられません。
pagenumber1取得するページ番号。
monitorIdstring-モニターの ID。
locationstringnullモニターの地域。
createdAtstring | object | numbernull作成日時。文字列、数値、または gtelte を持つオブジェクトを指定できます。
isSuccessfulbooleannullチェックが成功したかどうか。
isSSLCheckbooleannullチェックが SSL のチェックかどうか。
httpStatusCodestringnullレスポンスの HTTP ステータスコード。
status('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')nullモニターのステータス。
dnsTimestring | number | objectnullDNS の名前解決にかかった時間。
tcpTimestring | number | objectnullTCP の接続にかかった時間。
tlsTimestring | number | objectnullTLS のハンドシェイクにかかった時間。
firstByteTimestring | number | objectnull最初の 1 バイトを受信するまでにかかった時間。
downloadTimestring | number | objectnullダウンロードにかかった時間。
responseTimestring | number | objectnull応答時間の合計。
performanceTimestring | number | objectnullパフォーマンスの時間。
accessabilityScorestring | number | objectnullアクセシビリティのスコア。
seoScorestring | number | objectnullSEO のスコア。
bestPracticesScorestring | number | objectnullベストプラクティスのスコア。
successfulAssertionsstring | number | objectnull成功したアサーションの数。
sortstring時系列順並べ替えに使うフィールド。

リクエストの例

GET /monitors/monitor-id-1/logs?limit=100&page=1

レスポンスの例

{
"monitorLogs": [
// {monitor log object},
// {monitor log object 2}
],
"total": 478,
"page": 1,
"totalPages": 5,
"limit": 100
}

ID を指定してモニターのチェックを実行する

エンドポイント:

GET /monitors/:id/run

クエリパラメーター

パラメーター既定値説明
location'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'-モニターの地域。指定された値のいずれかである必要があります。
retrybooleanfalse処理を再試行するかどうかを指定します。任意。
monitorLogIdstringnullモニターのログの一意な識別子。任意。

リクエストの例

GET /monitors/monitor-id-1/run?monitorId=abc123&location=US_EAST_1&retry=true&monitorLogId=log456

レスポンスの例

{
"status": "success",
"message": "Monitor check run successfully."
}

モニターのアラートを作成する

エンドポイント:

POST /monitor-alerts

リクエストの例

{
"type": "EMAIL",
"pageId": "page123",
"recipient": "user@example.com",
"recipientWorkspace": "workspace123",
"whenFails": true,
"whenRecovers": true,
"whenDegrades": false,
"whenSslExpires": true,
"sslExpiresInDays": 30,
"monitors": ["monitor1", "monitor2"],
"metadata": "Additional information about the alert"
}

レスポンスの例

{
"monitor": {
"id": "alert123",
"siteId": "site123",
"type": "EMAIL",
"recipient": "user@example.com",
"whenFails": true,
"whenRecovers": true,
"whenDegrades": false,
"whenSslExpires": true,
"sslExpiresInDays": 30,
"monitors": [{ "id": "monitor1" }, { "id": "monitor2" }],
"createdAt": "2023-08-08T12:00:00Z",
"updatedAt": "2023-08-08T12:00:00Z",
"metadata": "Additional information about the alert"
},
"message": "Monitor Alert created successfully"
}

モニターのアラートを更新する

エンドポイント:

PUT /monitor-alerts/:id

リクエストの例

{
"type": "EMAIL",
"monitors": ["monitor-1-id", "monitor-2-id", "monitor-3-id"]
}

レスポンスの例

{
"monitor": {
"type": "EMAIL",
"pageId": "page123",
"recipient": "user@example.com",
"recipientWorkspace": "workspace123",
"whenFails": true,
"whenRecovers": true,
"whenDegrades": false,
"whenSslExpires": true,
"sslExpiresInDays": 30,
"monitors": ["monitor-1-id", "monitor-2-id"],
"metadata": "Additional information about the alert"
},
"message": "Monitor alert updated successfully."
}

モニターのアラートを取得する

エンドポイント:

GET /:page_id/monitor-alerts

クエリパラメーター

パラメーター既定値説明
limitnumber1001 ページあたりの件数。
pagenumber1取得するページ番号。

リクエストの例

GET /1/monitor-alerts?limit=2&page=3

レスポンスの例

{
"monitorAlerts": [
{...monitor alert objects}
],
"total": 27,
"page": 3,
"totalPages": 14,
"limit": 2
}

モニターのアラートを削除する

エンドポイント:

DELETE /monitor-alerts/:id

リクエストの例

DELETE /monitor-alerts/alert-id-1

レスポンスの例

{
"message": "Monitor alert deleted successfully."
}

モニターのグループを作成する

エンドポイント:

POST /monitors-groups

リクエストの例

{
"pageId": "page123",
"name": "Example Name",
"childId": "child456"
}

レスポンスの例

{
"monitor": {
"id": "group123",
"name": "Example Name",
"siteId": "site123",
"collapsed": false,
"monitors": [{ "id": "monitor1" }, { "id": "monitor2" }],
"groupId": "parentGroup123",
"children": [
{ "id": "childGroup1", "name": "Child Group 1" },
{ "id": "childGroup2", "name": "Child Group 2" }
],
"order": 1,
"createdAt": "2023-08-08T12:00:00Z",
"updatedAt": "2023-08-08T12:00:00Z",
"parents": ["parent1", "parent2"],
"componentId": "component123"
},
"message": "Monitor group created successfully."
}

モニターのグループを更新する

エンドポイント:

PUT /monitors-groups/:id

リクエストの例

{
"name": "Updated Monitor Group Name"
}

レスポンスの例

{
"monitor": {
"id": "group123",
"name": "Updated Monitor Group Name",
"siteId": "site123",
"collapsed": true,
"monitors": [{ "id": "monitor1" }, { "id": "monitor2" }],
"groupId": "parentGroup123",
"children": [
{ "id": "childGroup1", "name": "Child Group 1" },
{ "id": "childGroup2", "name": "Child Group 2" }
],
"order": 1,
"createdAt": "2023-08-08T12:00:00Z",
"updatedAt": "2023-08-08T12:00:00Z",
"parents": ["parent1", "parent2"],
"componentId": "component123"
},
"message": "Monitor group updated successfully."
}

モニターのグループを削除する

エンドポイント:

DELETE /monitors-groups/:id

リクエストの例

DELETE /monitors-groups/group-id-1

レスポンスの例

{
"message": "Monitor group deleted successfully."
}

グループにモニターを追加する

エンドポイント:

POST /monitors-groups/:id/monitors

リクエストの例

{
"monitors": ["monitor1", "monitor2", "monitor3"]
}

レスポンスの例

{
"message": "Monitors added to the group successfully."
}

モニターのグループのチェックを実行する

エンドポイント:

GET /monitors-groups/:id/run

クエリパラメーター

パラメーター既定値説明
location'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'-モニターの地域。指定された値のいずれかである必要があります。
retrybooleanfalse処理を再試行するかどうかを指定します。任意。
monitorLogIdstringnullモニターのログの一意な識別子。任意。

リクエストの例

GET /monitors-groups/group-id-1/run

レスポンスの例

{
"result": "OK",
"monitorLogId": "monitor-log-id-1"
}

cron モニター

cron モニターは、HTTP の ping を使ってスケジュール実行のジョブを追跡します。製品側の設定やダッシュボードでの使い方は、cron 監視を参照してください。

フィールドに指定できる値

cron モニターのステータス

説明
UPモニターは正常に動作しています
DOWNモニターが失敗しました
DEGRADEDモニターに問題が発生しています
UNKNOWNモニターの状態を判定できません

cron モニターの状態

説明
ACTIVEモニターが有効でチェックされています
PAUSEDモニターのチェックが一時停止されています
MUTEDモニターがミュートされています (通知なし)

cron モニターのログのステータス

説明
SUCCESSジョブが正常に完了しました
FAILUREジョブが明示的に失敗を報告しました
MISSEDジョブが想定した時間内に ping を送りませんでした
LATEジョブが周期を過ぎてから、猶予時間内に ping を送りました
STARTEDジョブが開始を報告しました (実行時間の計測用)

周期と猶予時間

periodgrace はどちらもで指定します。period はジョブを実行する間隔、grace はモニターが障害とマークされるまでに追加で許容する時間です。

cron モニターを取得する

エンドポイント:

GET /:page_id/monitors/cron

クエリパラメーター

パラメーター既定値説明
limitnumber1001 ページあたりの cron モニターの件数。最大 100 件です。
pagenumber1ページ番号。
searchstringnull名前で結果を絞り込むための検索語。
statusenumnullステータスによる絞り込み ('UP'、'DOWN'、'UNKNOWN'、'DEGRADED')

リクエストの例

GET /page123/monitors/cron?limit=10&page=1&status=DOWN

レスポンスの例

{
"cronMonitors": [
{
"id": "cron-abc123",
"name": "Daily backup",
"slug": "my-page-x7k2m9n4p1q8w3e5",
"period": 86400,
"grace": 3600,
"status": "UP",
"state": "ACTIVE",
"siteId": "page123",
"order": 1,
"groupId": null,
"componentId": "component-id-1",
"onFailCreateIncident": true,
"onFailCreateOutageDuration": false,
"onFailPublishIncident": true,
"onFailNotifySubscribers": true,
"onRecoverResolveIncident": true,
"onRecoverResolveOutageDuration": false,
"onRecoverPublishIncident": true,
"onRecoverNotifySubscribers": true,
"createTemplateId": null,
"resolveTemplateId": null,
"createdAt": "2024-01-15T08:00:00.000Z",
"updatedAt": "2024-01-15T08:00:00.000Z"
}
],
"total": 1,
"page": 1,
"totalPages": 1,
"limit": 10
}

cron モニターを作成する

エンドポイント:

POST /monitors/cron

リクエストの例

{
"pageId": "page123",
"name": "Daily backup",
"period": 86400,
"grace": 3600,
"alerts": ["alert-id-1", "alert-id-2"],
"createComponent": true,
"onFail": {
"createIncident": true,
"createOutageDuration": false,
"publishIncident": true,
"notifySubscribers": true
},
"onRecover": {
"resolveIncident": true,
"resolveOutageDuration": false,
"publishIncident": true,
"notifySubscribers": true
}
}

レスポンスの例

{
"cronMonitor": {
"id": "cron-abc123",
"name": "Daily backup",
"slug": "my-page-x7k2m9n4p1q8w3e5",
"period": 86400,
"grace": 3600,
"status": "UP",
"state": "ACTIVE",
"siteId": "page123",
"order": 1,
"groupId": null,
"componentId": "component-id-1",
"onFailCreateIncident": true,
"onFailCreateOutageDuration": false,
"onFailPublishIncident": true,
"onFailNotifySubscribers": true,
"onRecoverResolveIncident": true,
"onRecoverResolveOutageDuration": false,
"onRecoverPublishIncident": true,
"onRecoverNotifySubscribers": true,
"createTemplateId": null,
"resolveTemplateId": null,
"createdAt": "2024-01-15T08:00:00.000Z",
"updatedAt": "2024-01-15T08:00:00.000Z"
},
"message": "Cron monitor created successfully."
}

レスポンスには slug が含まれます。これを使って、ジョブ用の ping URL を組み立てます。最初の ping が成功すると、バックグラウンドのチェックジョブが予約されます。

cron モニターを更新する

エンドポイント:

PUT /monitors/cron/:id

リクエストの例

{
"name": "Daily backup (updated)",
"period": 43200,
"grace": 1800,
"state": "PAUSED",
"alerts": ["alert-id-1"],
"onFail": {
"notifySubscribers": false
}
}

レスポンスの例

{
"cronMonitor": {
"id": "cron-abc123",
"name": "Daily backup (updated)",
"slug": "my-page-x7k2m9n4p1q8w3e5",
"period": 43200,
"grace": 1800,
"status": "UP",
"state": "PAUSED",
"siteId": "page123",
"order": 1,
"groupId": null,
"componentId": "component-id-1",
"onFailCreateIncident": true,
"onFailCreateOutageDuration": false,
"onFailPublishIncident": true,
"onFailNotifySubscribers": false,
"onRecoverResolveIncident": true,
"onRecoverResolveOutageDuration": false,
"onRecoverPublishIncident": true,
"onRecoverNotifySubscribers": true,
"createTemplateId": null,
"resolveTemplateId": null,
"alerts": [
{
"id": "alert-id-1",
"type": "EMAIL",
"recipient": "ops@example.com"
}
],
"createdAt": "2024-01-15T08:00:00.000Z",
"updatedAt": "2024-01-16T10:30:00.000Z"
},
"message": "Cron monitor updated successfully."
}

cron モニターを削除する

エンドポイント:

DELETE /monitors/cron/:id

リクエストの例

DELETE /monitors/cron/cron-abc123

レスポンスの例

{
"cronMonitor": {
"id": "cron-abc123",
"name": "Daily backup",
"slug": "my-page-x7k2m9n4p1q8w3e5",
"period": 86400,
"grace": 3600,
"status": "UP",
"state": "ACTIVE",
"siteId": "page123",
"order": 1,
"groupId": null,
"componentId": "component-id-1",
"onFailCreateIncident": true,
"onFailCreateOutageDuration": false,
"onFailPublishIncident": true,
"onFailNotifySubscribers": true,
"onRecoverResolveIncident": true,
"onRecoverResolveOutageDuration": false,
"onRecoverPublishIncident": true,
"onRecoverNotifySubscribers": true,
"createTemplateId": null,
"resolveTemplateId": null,
"createdAt": "2024-01-15T08:00:00.000Z",
"updatedAt": "2024-01-15T08:00:00.000Z"
},
"message": "Cron monitor deleted successfully."
}

cron モニターのログを取得する

エンドポイント:

GET /monitors/cron/:id/logs

クエリパラメーター

パラメーター既定値説明
limitnumber1001 ページあたりのログの件数。最大 127 件です。
pagenumber1ページ番号。最大 1000 です。
startDatestring1 年前ログの期間の開始日 (ISO 8601)。
endDatestring現在ログの期間の終了日 (ISO 8601)。
importanceenumnull重要度でログを絞り込みます ('all'、'important')

リクエストの例

GET /monitors/cron/cron-abc123/logs?limit=50&page=1&importance=important

レスポンスの例

{
"logs": [
{
"id": "log-xyz789",
"monitorId": "cron-abc123",
"status": "SUCCESS",
"requestType": "GET",
"agent": "curl/8.4.0",
"ipAddress": "203.0.113.10",
"createdAt": "2024-01-16T06:00:00.000Z",
"startedAt": "2024-01-16T05:59:58.000Z"
}
],
"page": 1
}

cron モニターのサマリーを取得する

エンドポイント:

GET /monitors/cron/:id/summary

リクエストの例

GET /monitors/cron/cron-abc123/summary

レスポンスの例

{
"summary": {
"totalLogs": 120,
"totalFailedLogs": 3,
"availability": 97.5,
"oneDayAvailability": 100,
"previousDayAvailability": 100,
"sevenDayAvailability": 98.2,
"previousSevenDayAvailability": 96.1,
"thirtyDayAvailability": 97.5,
"previousThirtyDayAvailability": 95.8,
"lastSuccess": "2024-01-16T06:00:00.000Z",
"lastFailure": "2024-01-10T06:00:00.000Z",
"lastStarted": null,
"upSince": "2024-01-10T07:00:00.000Z",
"downSince": null
}
}

ping のエンドポイント

これらのエンドポイントに認証は不要です。モニターの slug がシークレットの役割を果たします。

API のベース URL、または cron 専用のホストのどちらからでも ping できます。

  • 成功: https://cron.instatus.com/{slug} または GET / POST / HEAD /monitors/cron/{slug}
  • 失敗: https://cron.instatus.com/{slug}/fail または GET / POST / HEAD /monitors/cron/{slug}/fail
  • 開始: https://cron.instatus.com/{slug}/start または GET / POST / HEAD /monitors/cron/{slug}/start

ジョブが予定どおり完了するたびに、成功の ping を送ります。実行時間を記録したい場合は、ジョブの実行前に開始の ping を送り、終了時に成功または失敗の ping を送ります。

成功の ping の例

curl https://cron.instatus.com/my-page-x7k2m9n4p1q8w3e5

レスポンスの例

{
"id": "log-xyz789",
"monitorId": "cron-abc123",
"status": "SUCCESS",
"requestType": "GET",
"agent": "curl/8.4.0",
"ipAddress": "203.0.113.10",
"createdAt": "2024-01-16T06:00:00.000Z"
}

slug が正しくない場合、レスポンスは次のようになります。

{
"message": "Monitor not found"
}