Destination resources
A destination specifies the target of an action, the receiving application of a one-way message (a notification). Virtana Service Observability supports the following destinations:
Email addresses
Virtana Service Observability event service
Microsoft Teams channels
PagerDuty Alert Events
Public channels in Slack workspaces
Any application that supports webhooks
Destinations cannot initiate actions. Only rules can initiate actions. A destination may be used in any number of rules.
Resource list
Create a destination (POST /v1/notification/destinations)
Get one destination (GET /v1/notification/destinations/{name})
Get all or multiple destinations (GET /v1/notification/destinations[?query])
Update a destination (PUT /v1/notification/destinations/{name})
Delete a destination (DELETE/v1/notification/destinations/{name})
Test a destination (POST /v1/notification/destinations:test)
Create one destination.
Note
When you create a destination for PagerDuty, ServiceNow, or Slack, the credentials are not stored in the Credentials management service. To ensure all credentials are maintained in the credentials service, use the browser interface to create the destinations.
You can test a destination before creating it with the test a destination resource.
Note
Slack and webhook destinations receive the customized message defined in a rule, while email destinations receive the message defined with the subject and body fields of the destination.
Request fields
The following fields apply to all destination types.
Field | Type | Required | Description |
|---|---|---|---|
| string | Yes | A unique, short identifier for the destination. Once created, this value cannot be changed. |
| string | No | Additional text to further describe the destination. |
| array | No | A list of arbitrary terms to associate with the destination. |
| object | Yes | An object that contains one destination type object. |
Field | Type | Required | Description |
|---|---|---|---|
| object | No | A destination type object that contains email destination properties. |
| string | Yes | One email address. |
| string | No | Text for the subject line of the email message. |
| string | No | Text for the body of the email message. |
Field | Type | Required | Description |
|---|---|---|---|
| object | No | A destination type object that contains Virtana event service destination properties. |
| string | Yes | A name for the event. |
| string | Yes | A context-free label to classify the event. |
| string | Yes | A brief description of the event. |
| string | Yes | The event severity. Accepted values:
|
| string | No | A longer description of the event. |
Field | Type | Required | Description |
|---|---|---|---|
| object | No | A destination type object that contains Microsoft Teams destination properties. |
| string | Yes | The URL of a Microsoft Teams incoming webhook for a target channel. |
| string | Yes | The text to send to the channel associated with the specified webhook URL. |
| array | No | A list of up to 20 custom key-value pairs to use in place of the default Office 365 connector card in notifications sent to a destination. |
| string | No | The key of a custom key-value pair. |
| string | No | The value of a custom key-value pair. |
Field | Type | Required | Description |
|---|---|---|---|
| object | No | A destination type object that contains PagerDuty destination properties. |
| string | Yes | A PagerDuty Integration Key used to send an Alert Event to PagerDuty. |
Field | Type | Required | Description |
|---|---|---|---|
| object | No | A destination type object that contains ServiceNow destination properties. |
| string | Yes | The URL of your ServiceNow IT Operations Management instance. |
| string | No | Text to include in all notifications sent to this destination. |
Field | Type | Required | Description |
|---|---|---|---|
| object | Yes | An object that contains username-password authorization properties. |
| string | Yes | The name of a user account in your ServiceNow IT Operations Management instance. |
| string | Yes | The password of a user account in your ServiceNow IT Operations Management instance. |
Field | Type | Required | Description |
|---|---|---|---|
| object | Yes | An object that contains OAuth authorization properties. |
| string | No | A ServiceNow account to authorize a refresh token request. |
| string | No | The password of a ServiceNow account to authorize a refresh token request. |
| string | Yes | The ServiceNow ID for your integration with Virtana Service Observability. |
| string | Yes | The ServiceNow secret for your integration with Virtana Service Observability. |
| string | Yes | The URL for updating a ServiceNow refresh token. |
| string | Yes | The URL for obtaining a ServiceNow refresh token. |
| string | Yes | A ServiceNow refresh token. |
Field | Type | Required | Description |
|---|---|---|---|
| object | No | A destination type object that contains Slack destination properties. |
| string | Yes | The name of a public channel in your Slack workspace. Channel names that start with the number sign character are not accepted. |
| string | Yes | A bot token provided by the Virtana Slack app. To use a Slack channel in a destination, first install the Virtana Slack app in your workspace. |
| string | No | The color to use in messages sent to a channel. The color is applied to a vertical bar accompanying the message block. Standard HTML color codes are supported. |
Field | Type | Required | Description |
|---|---|---|---|
| object | No | A destination type object that contains webhook destination properties. |
| string | Yes | The URL of a webhook receiver. Virtana Service Observability uses POST to send to the receiver. |
Request template
{
"name": "<name>",
"description": "<description>",
"tags": [ "<tag>" ],
"type": {
"<type>": {
"<key>": <value>,
"<key>": <value>
}
}
}
Get one destination.
Response fields
Responses may include the following fields.
Field | Description |
|---|---|
| The list of rules that use the destination. |
| The total number of notifications sent to this destination in the last 24 hours. |
For PagerDuty, ServiceNow, and Slack destinations, additional fields identify the Credentials service entry associated with the destination.
Status codes
Code | Description |
|---|---|
200 | Success. The request was processed. Check the response body for per-item results when processing multiple objects. |
404 | Not found. The specified resource does not exist. |
Example
Request example
curl https://YOUR-API-ENDPOINT/v1/notification/destinations/YOUR-DESTINATION-NAME \ -H "zenoss-api-key: YOUR-API-KEY" -X GET -s
Response example
{
"destination": {
"name": "YOUR-DESTINATION-NAME",
"description": "Slack destination.",
"type": {
"slack": {
"token": "YOUR-BOT-TOKEN",
"channel": "notification_sender",
"color": "#FFFFFF"
}
},
"tags": [
"test",
"slack"
]
}
}Get all destinations or destinations that match a query. Requests with no queries will return all destinations.
Queries may be appended to the base URL with standard query syntax. See the query string example.
Query fields
Field | Description |
|---|---|
| |
| |
| |
| |
|
For more information about query fields, see the create a destination resource.
Response fields
Responses may include the following fields.
Field | Description |
|---|---|
| The total number of notifications sent to this destination in the last 24 hours. |
| The total number of destinations returned. |
For PagerDuty, ServiceNow, and Slack destinations, additional fields identify the Credentials service entry associated with the destination.
Status codes
Code | Description |
|---|---|
200 | Success. The request was processed. Check the response body for per-item results when processing multiple objects. |
All destinations example
Request example
curl https://YOUR-API-ENDPOINT/v1/notification/destinations \ -H "zenoss-api-key: YOUR-API-KEY" -X GET -s
Response example
{
"destinations": [
{
"name": "Slack-Test",
"description": "Slack Test",
"type": {
"slack": {
"token": "YOUR-BOT-TOKEN",
"channel": "YOUR-SLACK-CHANNEL"
}
},
"ruleNames": [
"Test-Rule1",
"Test-Rule3"
]
},
{
"name": "Webhook.Site",
"type": {
"webhook": {
"url": "YOUR-WEBHOOK-URL"
}
},
"ruleNames": [
"TestingWebHook.Site"
],
"tags": [
"WebhookTag"
]
},
{
"name": "test-dest",
"description": "Test Destination",
"type": {
"email": {
"to": "test@example.com, test2@example.com",
"body": "Test destination body",
"subject": "Test destination subject"
}
}
}
],
"totalCount": "3"
}Query string example
Request example
curl https://YOUR-API-ENDPOINT/v1/notification/destinations?type=slack \ -H "zenoss-api-key: YOUR-API-KEY" -X GET -s
Response example
{
"destinations": [
{
"name": "Example1",
"description": "Example",
"type": {
"slack": {
"token": "YOUR-BOT-TOKEN",
"channel": "test_notifications"
}
},
"ruleNames": [
"My new Rule"
],
"tags": [
"Example "
]
},
{
"name": "eXAMPLE2",
"type": {
"slack": {
"token": "YOUR-BOT-TOKEN",
"channel": "okmet_test",
"color": "#000000"
}
},
"ruleNames": [
"event2_rule",
"event_rule "
],
"recentNotificationCount": "1"
}
],
"totalCount": "2"
}Update an existing destination.
Unspecified fields are deleted. Destination names cannot be changed.
Note
Slack and webhook destinations receive the customized message defined in a rule, while email destinations receive the message defined with the subject and body fields of the destination.
Request fields
Update requests use the same fields as create requests.
Status codes
Code | Description |
|---|---|
200 | Success. The request was processed. Check the response body for per-item results when processing multiple objects. |
400 | Bad request. The request body is missing, malformed, or contains invalid values. |
404 | Not found. The specified resource does not exist. |
Example
Request example
curl https://YOUR-API-ENDPOINT/v1/notification/destinations/YOUR-DESTINATION-NAME \
-H "zenoss-api-key: YOUR-API-KEY" \
-X PUT -s -S -d \
'{
"type": {
"webhook": {
"url": "https://webhook.example.com/etc/updated"
}
}
}'Response example
{
"destination": {
"name": "YOUR-DESTINATION-NAME",
"description": "Webhook URL",
"type": {
"webhook": {
"url": "https://webhook.example.com/etc/updated"
}
}
}
}Delete a destination.
Use the get multiple destinations resource to get destination names.
Status codes
Code | Description |
|---|---|
200 | Success. The request was processed. Check the response body for per-item results when processing multiple objects. |
404 | Not found. The specified resource does not exist. |
412 | Precondition failed. The destination is used in at least one rule. |
Example
Request example
curl https://YOUR-API-ENDPOINT/v1/notification/destinations/YOUR-DESTINATION-NAME \ -H "zenoss-api-key: YOUR-API-KEY" -X DELETE -s
Response example
{}Send a test notification to a destination.
The destination you specify is not saved and does not have to be an existing destination.
Status codes
Code | Description |
|---|---|
200 | Success. The request was processed. Check the response body for per-item results when processing multiple objects. |
400 | Bad request. The request body is missing, malformed, or contains invalid values. |
Example
Request example
curl https://YOUR-API-ENDPOINT/v1/notification/destinations:test \
-H "zenoss-api-key: YOUR-API-KEY" \
-X POST -s -S -d \
'{
"name": "destination-test",
"description": "Send test to example webhook URL",
"type": {
"webhook": {
"url": "https://webhook.example.com/test"
}
}
}'Response example
{
"destination": {
"name": "destination-test",
"description": "Send test to example webhook URL",
"type": {
"webhook": {
"url": "https://webhook.example.com/test"
}
}
}
}