# 监控 API 参考

Source: https://instatus.com/help/zh/api/monitors

- [Monitors](https://instatus.com/help/zh/api/monitors#get-monitors): Check the uptime of your websites, APIs, and services
- [Cron Monitors](https://instatus.com/help/zh/api/monitors#cron-monitors): Monitor your scheduled jobs via HTTP pings

## 字段的可能取值

**监控地区**

| 取值 | 说明 |
| ---------------- | ----------------- |
| `US_EAST_1`      | 北弗吉尼亚 |
| `CA_CENTRAL_1`   | 加拿大（蒙特利尔） |
| `EU_CENTRAL_1`   | 法兰克福 |
| `AP_NORTHEAST_1` | 东京 |

**监控告警类型**

| 取值 | 说明 |
| ----------------- | --------------------- |
| `INCIDENT`        | 事件告警 |
| `EMAIL`           | 邮件告警 |
| `SMS`             | 短信告警 |
| `SLACK`           | Slack 告警 |
| `DISCORD`         | Discord 告警 |
| `MICROSOFT_TEAMS` | Microsoft Teams 告警 |
| `PHONE_CALL`      | 电话呼叫告警 |
| `WEBHOOK`         | Webhook 告警 |
| `GOOGLE_CHAT`     | Google Chat 告警 |
| `WHATSAPP`        | WhatsApp 告警 |

**监控状态**

| 取值 | 说明 |
| ---------- | --------------------------------- |
| `UP`       | 监控运行正常 |
| `DOWN`     | 监控出现故障 |
| `DEGRADED` | 监控存在问题 |
| `UNKNOWN`  | 无法确定监控状态 |

## 获取监控列表

你可以用这个端点查找并翻阅所有已有监控的列表。

**端点：**

```bash
GET /:page_id/monitors
```

**查询参数**

| 参数 | 类型 | 默认值 | 说明 |
| --------- | -------- | ------------- | ------------------------------------------------------ |
| `page`    | `number` | `1`           | 要获取的页码。 |
| `limit`   | `number` | `100`         | 每页的监控数量。 |
| `search`  | `string` | `null`        | 用于筛选结果的搜索词。 |
| `status`  | `enum`   | `null`        | 状态筛选 _('UP'、'DOWN'、'UNKNOWN'、'DEGRADED')_。 |

**请求示例**

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

**响应示例**

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

## 创建监控

**端点：**

```bash
POST /monitors
```

**请求示例**

```json
{
  "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
  }
}
```

**响应示例**

```json
{
  "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"
}
```

## 更新监控

**端点：**

```bash
PUT /monitors/:id
```

**请求示例**

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

**响应示例**

```json
{
  "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"
}
```

## 删除监控

**端点：**

```bash
DELETE /monitors/:id
```

**请求示例**

```bash
DELETE /monitors/monitor-id-1
```

**响应示例**

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

## 获取监控日志

**端点：**

```bash
GET /monitors/:id/logs
```

# 查询参数

| 参数 | 类型 | 默认值 | 说明 |
| ---------------------- | --------------------------------------- | --------------- | --------------------------------------------------------------------------------------- |
| `limit`                | `number`                                | 100             | 每页的条目数。不能超过 1000。 |
| `page`                 | `number`                                | 1               | 要获取的页码。 |
| `monitorId`            | `string`                                | -               | 监控的 ID。 |
| `location`             | `string`                                | `null`          | 监控的地区。 |
| `createdAt`            | `string` \| `object` \| `number`        | `null`          | 创建日期。可以是字符串、数字，或带 `gte` 和 `lte` 字段的对象。 |
| `isSuccessful`         | `boolean`                               | `null`          | 该次检测是否成功。 |
| `isSSLCheck`           | `boolean`                               | `null`          | 该次检测是否为 SSL 检测。 |
| `httpStatusCode`       | `string`                                | `null`          | 响应的 HTTP 状态码。 |
| `status`               | `('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')` | `null`          | 监控的状态。 |
| `dnsTime`              | `string` \| `number` \| `object`        | `null`          | DNS 解析耗时。 |
| `tcpTime`              | `string` \| `number` \| `object`        | `null`          | TCP 连接耗时。 |
| `tlsTime`              | `string` \| `number` \| `object`        | `null`          | TLS 握手耗时。 |
| `firstByteTime`        | `string` \| `number` \| `object`        | `null`          | 收到首字节的耗时。 |
| `downloadTime`         | `string` \| `number` \| `object`        | `null`          | 下载耗时。 |
| `responseTime`         | `string` \| `number` \| `object`        | `null`          | 总响应时间。 |
| `performanceTime`      | `string` \| `number` \| `object`        | `null`          | 性能耗时。 |
| `accessabilityScore`   | `string` \| `number` \| `object`        | `null`          | 无障碍得分。 |
| `seoScore`             | `string` \| `number` \| `object`        | `null`          | SEO 得分。 |
| `bestPracticesScore`   | `string` \| `number` \| `object`        | `null`          | 最佳实践得分。 |
| `successfulAssertions` | `string` \| `number` \| `object`        | `null`          | 成功的断言数量。 |
| `sort`                 | `string`                                | 按时间顺序 | 用于排序的字段。 |

**请求示例**

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

**响应示例**

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

## 按 ID 运行监控检测

**端点：**

```bash
GET /monitors/:id/run
```

**查询参数**

| 参数 | 类型 | 默认值 | 说明 |
| -------------- | --------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------- |
| `location`     | `'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'` | -             | 监控的地区。必须是所列取值之一。 |
| `retry`        | `boolean`                                                                         | `false`       | 表示该操作是否需要重试。可选。 |
| `monitorLogId` | `string`                                                                          | `null`        | 监控日志的唯一标识。可选。 |

**请求示例**

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

**响应示例**

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

## 创建监控告警

**端点：**

```bash
POST /monitor-alerts
```

**请求示例**

```json
{
  "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"
}
```

**响应示例**

```json
{
  "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"
}
```

## 更新监控告警

**端点：**

```bash
PUT /monitor-alerts/:id
```

**请求示例**

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

**响应示例**

```json
{
  "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."
}
```

## 获取监控告警

**端点：**

```bash
GET /:page_id/monitor-alerts
```

**查询参数**

| 参数 | 类型 | 默认值 | 说明 |
| --------- | -------- | ------------- | ----------------------------- |
| `limit`   | `number` | 100           | 每页的条目数。 |
| `page`    | `number` | 1             | 要获取的页码。 |

**请求示例**

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

**响应示例**

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

## 删除监控告警

**端点：**

```bash
DELETE /monitor-alerts/:id
```

**请求示例**

```bash
DELETE /monitor-alerts/alert-id-1
```

**响应示例**

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

## 创建监控分组

**端点：**

```bash
POST /monitors-groups
```

**请求示例**

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

**响应示例**

```json
{
  "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."
}
```

## 更新监控分组

**端点：**

```bash
PUT /monitors-groups/:id
```

**请求示例**

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

**响应示例**

```json
{
  "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."
}
```

## 删除监控分组

**端点：**

```bash
DELETE /monitors-groups/:id
```

**请求示例**

```bash
DELETE /monitors-groups/group-id-1
```

**响应示例**

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

## 把监控添加到分组

**端点：**

```bash
POST /monitors-groups/:id/monitors
```

**请求示例**

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

**响应示例**

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

## 运行监控分组检测

**端点：**

```bash
GET /monitors-groups/:id/run
```

**查询参数**

| 参数 | 类型 | 默认值 | 说明 |
| -------------- | --------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------- |
| `location`     | `'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'` | -             | 监控的地区。必须是所列取值之一。 |
| `retry`        | `boolean`                                                                         | `false`       | 表示该操作是否需要重试。可选。 |
| `monitorLogId` | `string`                                                                          | `null`        | 监控日志的唯一标识。可选。 |

**请求示例**

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

**响应示例**

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

## Cron 监控

Cron 监控通过 HTTP ping 跟踪定时任务。产品配置和控制台用法见 [Cron 监控](https://instatus.com/help/zh/monitoring/cron)。

### 字段的可能取值

**Cron 监控状态**

| 取值 | 说明 |
| ---------- | --------------------------------- |
| `UP`       | 监控运行正常 |
| `DOWN`     | 监控出现故障 |
| `DEGRADED` | 监控存在问题 |
| `UNKNOWN`  | 无法确定监控状态 |

**Cron 监控运行状态**

| 取值 | 说明 |
| -------- | ------------------------------------ |
| `ACTIVE` | 监控正在正常检测 |
| `PAUSED` | 监控检测已暂停 |
| `MUTED`  | 监控已静音（不发送通知） |

**Cron 监控日志状态**

| 取值 | 说明 |
| --------- | ------------------------------------------------ |
| `SUCCESS` | 任务成功完成 |
| `FAILURE` | 任务显式上报了失败 |
| `MISSED`  | 任务未在预期时间窗口内 ping |
| `LATE`    | 任务在周期之后、宽限期之内 ping |
| `STARTED` | 任务上报了开始（用于统计执行时长） |

**周期与宽限期**

`period` 和 `grace` 都以**秒**为单位。`period` 是任务应该多久运行一次；`grace` 是在监控被标记为故障之前额外允许的时间。

### 获取 cron 监控列表

**端点：**

```bash
GET /:page_id/monitors/cron
```

**查询参数**

| 参数 | 类型 | 默认值 | 说明 |
| --------- | -------- | ------------- | ------------------------------------------------------ |
| `limit`   | `number` | `100`         | 每页的 cron 监控数量。最多 100。 |
| `page`    | `number` | `1`           | 页码。 |
| `search`  | `string` | `null`        | 用于按名称筛选结果的搜索词。 |
| `status`  | `enum`   | `null`        | 状态筛选 _('UP'、'DOWN'、'UNKNOWN'、'DEGRADED')_。 |

**请求示例**

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

**响应示例**

```json
{
  "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 监控

**端点：**

```bash
POST /monitors/cron
```

**请求示例**

```json
{
  "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
  }
}
```

**响应示例**

```json
{
  "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 监控

**端点：**

```bash
PUT /monitors/cron/:id
```

**请求示例**

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

**响应示例**

```json
{
  "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 监控

**端点：**

```bash
DELETE /monitors/cron/:id
```

**请求示例**

```bash
DELETE /monitors/cron/cron-abc123
```

**响应示例**

```json
{
  "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 监控日志

**端点：**

```bash
GET /monitors/cron/:id/logs
```

**查询参数**

| 参数 | 类型 | 默认值 | 说明 |
| ------------ | -------- | ------------- | -------------------------------------------------------- |
| `limit`      | `number` | `100`         | 每页的日志条数。最多 127。 |
| `page`       | `number` | `1`           | 页码。最大为 1000。 |
| `startDate`  | `string` | 一年前 | 日志范围的起始日期，ISO 8601 格式。 |
| `endDate`    | `string` | 现在 | 日志范围的结束日期，ISO 8601 格式。 |
| `importance` | `enum`   | `null`        | 按重要性筛选日志 _('all'、'important')_。 |

**请求示例**

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

**响应示例**

```json
{
  "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 监控概要

**端点：**

```bash
GET /monitors/cron/:id/summary
```

**请求示例**

```bash
GET /monitors/cron/cron-abc123/summary
```

**响应示例**

```json
{
  "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 示例**

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

**响应示例**

```json
{
  "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 无效，响应为：

```json
{
  "message": "Monitor not found"
}
```
