Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b6c55f503 | |||
| 12601754d9 | |||
| 8ec74206db | |||
| dba4dab203 | |||
| fbd74104bd | |||
| f81dd88ca7 | |||
| d4d2cc8d59 | |||
| 9c7e48997a | |||
| 801bd30272 | |||
| c6b07f1ab9 | |||
| 34ea402456 |
@@ -23,6 +23,8 @@ The `export` endpoints allow you to export alerting resources in a JSON format s
|
||||
|
||||
### Alert rules
|
||||
|
||||
The following endpoints can be used to manage both alert rules and recording rules. To create a recording rule, include a `record` block in your request instead of a `condition` field.
|
||||
|
||||
| Method | URI | Name | Summary |
|
||||
| ------ | ---------------------------------------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------- |
|
||||
| DELETE | /api/v1/provisioning/alert-rules/:uid | [route delete alert rule](#route-delete-alert-rule) | Delete a specific alert rule by UID. |
|
||||
@@ -51,6 +53,7 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
"noDataState": "OK",
|
||||
"execErrState": "OK",
|
||||
"for": "5m",
|
||||
"keepFiringFor": "2m",
|
||||
"orgId": 1,
|
||||
"uid": "",
|
||||
"condition": "B",
|
||||
@@ -200,6 +203,7 @@ Content-Type: application/json
|
||||
}
|
||||
],
|
||||
"datasource": {
|
||||
"type": "__expr__",
|
||||
"uid": "__expr__"
|
||||
},
|
||||
"expression": "A",
|
||||
@@ -213,6 +217,103 @@ Content-Type: application/json
|
||||
],
|
||||
"noDataState": "",
|
||||
"execErrState": "",
|
||||
"for": "0s",
|
||||
"keep_firing_for": "0s",
|
||||
"isPaused": false,
|
||||
"notification_settings": null,
|
||||
"record": {
|
||||
"metric": "grafana_recording_rule_test_2",
|
||||
"from": "B",
|
||||
"target_datasource_uid": "grafanacloud-prom"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Contact points
|
||||
|
||||
| Method | URI | Name | Summary |
|
||||
| ------ | ------------------------------------------ | ----------------------------------------------------------------- | ------------------------------------------------------ |
|
||||
| DELETE | /api/v1/provisioning/contact-points/:uid | [route delete contactpoints](#route-delete-contactpoints) | Delete a contact point. |
|
||||
| GET | /api/v1/provisioning/contact-points | [route get contactpoints](#route-get-contactpoints) | Get all the contact points. |
|
||||
| POST | /api/v1/provisioning/contact-points | [route post contactpoints](#route-post-contactpoints) | Create a contact point. |
|
||||
| PUT | /api/v1/provisioning/contact-points/:uid | [route put contactpoint](#route-put-contactpoint) | Update an existing contact point. |
|
||||
| GET | /api/v1/provisioning/contact-points/export | [route get contactpoints export](#route-get-contactpoints-export) | Export all contact points in provisioning file format. |
|
||||
|
||||
**Example Request for all the contact points:**
|
||||
|
||||
```http
|
||||
GET /api/v1/provisioning/contact-points
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response:**
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
### Notification policies
|
||||
|
||||
| Method | URI | Name | Summary |
|
||||
| ------ | ------------------------------------ | ------------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| DELETE | /api/v1/provisioning/policies | [route reset policy tree](#route-reset-policy-tree) | Clears the notification policy tree. |
|
||||
| GET | /api/v1/provisioning/policies | [route get policy tree](#route-get-policy-tree) | Get the notification policy tree. |
|
||||
| PUT | /api/v1/provisioning/policies | [route put policy tree](#route-put-policy-tree) | Sets the notification policy tree. |
|
||||
| GET | /api/v1/provisioning/policies/export | [route get policy tree export](#route-get-policy-tree-export) | Export the notification policy tree in provisioning file format. |
|
||||
|
||||
**Example Request for exporting the notification policy tree in YAML format:**
|
||||
|
||||
```http
|
||||
GET /api/v1/provisioning/policies/export?format=yaml
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response:**
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: text/yaml
|
||||
|
||||
apiVersion: 1
|
||||
policies:
|
||||
- orgId: 1
|
||||
receiver: My Contact Email Point
|
||||
group_by:
|
||||
- grafana_folder
|
||||
- alertname
|
||||
routes:
|
||||
- receiver: My Contact Email Point
|
||||
object_matchers:
|
||||
- - monitor
|
||||
- =
|
||||
- testdata
|
||||
mute_time_intervals:
|
||||
- weekends
|
||||
```
|
||||
|
||||
### Notification template groups
|
||||
|
||||
Template groups enable you to define multiple notification templates (`{{ define "" }}`) within a single group. They can be managed from the Grafana Alerting UI.
|
||||
|
||||
| Method | URI | Name | Summary |
|
||||
| ------ | ------------------------------------ | ----------------------------------------------- | ----------------------------------------------- |
|
||||
| DELETE | /api/v1/provisioning/templates/:name | [route delete template](#route-delete-template) | Delete a notification template group. |
|
||||
| GET | /api/v1/provisioning/templates/:name | [route get template](#route-get-template) | Get a notification template group. |
|
||||
| GET | /api/v1/provisioning/templates | [route get template](#route-get-templates) | Get all notification template groups. |
|
||||
| PUT | /api/v1/provisioning/templates/:name | [route put template](#route-put-template) | Create or update a notification template group. |
|
||||
|
||||
**Example Request for all notification template groups:**
|
||||
|
||||
```http
|
||||
GET /api/v1/provisioning/templates
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
@@ -1551,20 +1652,21 @@ Status: Accepted
|
||||
|
||||
**Properties**
|
||||
|
||||
{{% responsive-table %}}
|
||||
|
||||
| Name | Type | Go type | Required | Default | Description | Example |
|
||||
| ------- | ------------------------ | --------- | :------: | ------- | ----------- | ------- |
|
||||
| `Name` | string | string | | | | |
|
||||
| `Type` | [MatchType](#match-type) | MatchType | | | | |
|
||||
| `Value` | string | string | | | | |
|
||||
|
||||
{{% /responsive-table %}}
|
||||
|
||||
### <span id="matchers"></span> Matchers
|
||||
|
||||
> Matchers is a slice of Matchers that is sortable, implements Stringer, and
|
||||
> provides a Matches method to match a LabelSet against all Matchers in the
|
||||
{{% responsive-table %}}
|
||||
|
||||
| Name | Type | Go type | Required | Default | Description | Example |
|
||||
| ------- | ------------------------ | --------- | :------: | ------- | ----------- | ------- |
|
||||
| `Name` | string | string | | | | |
|
||||
| `Type` | [MatchType](#match-type) | MatchType | | | | |
|
||||
| `Value` | string | string | | | | |
|
||||
|
||||
{{% /responsive-table %}}
|
||||
|
||||
### <span id="matchers"></span> Matchers
|
||||
|
||||
> Matchers is a slice of Matchers that is sortable, implements Stringer, and
|
||||
> provides a Matches method to match a LabelSet against all Matchers in the
|
||||
> slice. Note that some users of Matchers might require it to be sorted.
|
||||
|
||||
[][Matcher](#matcher)
|
||||
|
||||
@@ -1784,24 +1886,25 @@ When creating a contact point, the `EmbeddedContactPoint.name` property determin
|
||||
{{% responsive-table %}}
|
||||
|
||||
| Name | Type | Go type | Required | Default | Description | Example |
|
||||
| --------------- | -------------------------- | -------------- | :------: | ------- | ----------- | ------- |
|
||||
| `days_of_month` | []string | []string | | | | |
|
||||
| `location` | string | string | | | | |
|
||||
| `months` | []string | []string | | | | |
|
||||
| `times` | [][TimeRange](#time-range) | `[]*TimeRange` | | | | |
|
||||
| `weekdays` | []string | []string | | | | |
|
||||
| `years` | []string | []string | | | | |
|
||||
|
||||
{{% /responsive-table %}}
|
||||
|
||||
### <span id="time-range"></span> TimeRange
|
||||
|
||||
> For example, 4:00PM to End of the day would Begin at 1020 and End at 1440.
|
||||
|
||||
**Properties**
|
||||
|
||||
{{% responsive-table %}}
|
||||
|
||||
| --------------- | -------------------------- | -------------- | :------: | ------- | ----------- | ------- |
|
||||
| `days_of_month` | []string | []string | | | | |
|
||||
| `location` | string | string | | | | |
|
||||
| `months` | []string | []string | | | | |
|
||||
| `times` | [][TimeRange](#time-range) | `[]*TimeRange` | | | | |
|
||||
| `weekdays` | []string | []string | | | | |
|
||||
| `years` | []string | []string | | | | |
|
||||
|
||||
{{% /responsive-table %}}
|
||||
|
||||
### <span id="time-range"></span> TimeRange
|
||||
|
||||
> For example, 4:00PM to End of the day would Begin at 1020 and End at 1440.
|
||||
|
||||
**Properties**
|
||||
|
||||
{{% responsive-table %}}
|
||||
|
||||
| Name | Type | Go type | Required | Default | Description | Example |
|
||||
| ------------ | ------ | ------- | :------: | ------- | ----------- | ----------------------- |
|
||||
| `end_time` | string | string | | | | `"end_time": "24:00"` |
|
||||
| `start_time` | string | string | | | | `"start_time": "18:00"` |
|
||||
|
||||
Reference in New Issue
Block a user