Updated Notify_pagertree (markdown)

master
Chris Caron 2023-02-16 18:59:57 -05:00
parent c59589d66a
commit 5bba8f4531
1 changed files with 56 additions and 44 deletions

@ -1,7 +1,7 @@
## Pagertree Notifications
* **Source**: https://www.pagerduty.com
## PagerTree Notifications
* **Source**: https://pagertree.com
* **Icon Support**: No
* **Attachment Support**: Yes
* **Attachment Support**: No
* **Message Format**: Text
* **Message Limit**: 32768 Characters per message
@ -10,61 +10,73 @@
3. From the integration page, copy the integration Prefix ID (used for the apprise url)
![image](https://user-images.githubusercontent.com/9020194/217587441-cfbf0f43-f736-4b9d-85dc-18acc6cc418c.png)
4. Use the Prefix ID for the apprise URL `./bin/apprise -t test -b message "pagertree://int_xxxxxxxxxx"`
You need to have an account with [PagerTree](https://pagertree.com) and create a [webhook integration](https://pagertree.com/docs/integration-guides/webhook).
### Syntax
Valid syntax is as follows:
* `pagerduty://{integration}@{api_key}`
* `pagerduty://{integration}@{api_key}/{source}`
* `pagerduty://{integration}@{api_key}/{source}/{component}`
* `pagertree://{integration_id}`
* `pagertree://{integration_id}?action=resolve&thirdparty_id=abc123`
* `pagertree://{integration_id}?+pagertree-token=123&:env=prod&-incident=true&-incident_severity=SEV-1&-incident-message=Please join the bridge&tags=prod,server,outage`
### Parameter Breakdown
| Variable | Required | Description
| ----------- | -------- | -----------
| integration | Yes | This is provided to you on the Events API V2 integration's detail page. This can also be referred to as a Routing Key.
| api_key | Yes | The API Key associated with your setup
| group | No | Provide a group (string) as part of the payload
| class | No | Provide a class (string) as part of the payload
| region | No | By default this takes on the value of **us**. But you can optionally set it to **eu** as well.
| source | No | Provide a source (string) as part of the payload; the default is **Apprise** if one isn't specified.
| component | No | Provide a component (string) as part of the payload; the default is **Notification** if one isn't specified.
| click | No | Provide a clickable URL to associate with the notice.
| image | No | Associate the notification status via a represented icon. You can set this value to `no` if you do not want this to occur.
| severity | No | The notification severity is otherwise detected on it's own, however if you wish to force a specific mode always, you can do so by providing this as part of the URL. Possible values are: `info`, `warning`, `critical`, and `error`.
| integration_id | Yes | This is the Prefix ID of your webhook integration. Found at the top of the integration page.
| action | No | The action for the webhook. Possible values are `create`, `acknowledge`, and `resolve`. When using acknowledge or resolve, please use the `thirdparty_id` parameter to indicate to PagerTree which alert should be actioned.
| thirdparty_id | No | An Id PagerTree uses to map thirdparty applications to alerts. You can specify your own, or if not, a random UUID will be generated for you. |
| urgency | No | Urgency of the alert to be generated. Possible values `silent`, `low`, `medium`, `high`, or `critical`. If not provided, PagerTree will use the integration's default. |
| tags | No | Comma seperated list of tags. (ex: "prod,server,outage") |
#### Example
Send a Pager Duty trigger to our **source** `node01.local` and the **component** `drive_sda`
Send a PagerTree create command.
```bash
# Assuming our {integration_key} is A1BRTD4JD
# Assuming our {api_key} is TIiajkdnlazkcOXrIdevi7F
# Assuming our {source} is node01.local
# Assuming our {component} is drive_sda
# Assuming our {integration_id} is int_0123456789
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"pagerduty://A1BRTD4JD@TIiajkdnlazkcOXrIdevi7F/node01.local/drive_sda/"
"pagertree://int_0123456789"
```
### Custom Details
You can provide custom details as part of the payload as well. This can be accomplished by just sticking a plus symbol (**+**) in front of any parameter you specify on your URL string.
```bash
# Below would pass along in the `custom_details` payload of the API
# "disk_space_left": "145GB"
#
# Assuming our {integration_key} is abc123
# Assuming our {api_key} is 98754
# Assuming our {source} is node01.local
# Assuming our {component} is drive_sda
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"pagerduty://abc123@98754/node01.local/drive_sda/?+disk_space_left=145GB"
### Payload Manipulation
Making use of the `:` on the Apprise URL allows you to alter and add to the body content posted upstream to PagerTree. This is useful when using the [Capture Additional Data feature](https://pagertree.com/docs/integration-guides/webhook#integration-options).
# Multiple details just require more entries defined:
# Below would set the custom details to:
# "disk_space_left": "145GB"
# "disk_space_total": "500GB"
```bash
# Add to the payload delivered to PagerTree
#
# Assuming our {integration_key} is abc123
# Assuming our {api_key} is 98754
# Assuming our {source} is node01.local
# Assuming our {component} is drive_sda
# Assuming our {integration_id} is int_xxxxxxxxxx
# Assuming we want to include "server": "blue-ranger-2" as part of the existing payload:
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"pagerduty://abc123@98754/node01.local/drive_sda/?+disk_space_left=145GB&"+disk_space_total=500GB"
```
"pagertree://int_xxxxxxxxxx/?:server=blue-ranger-2"
```
The above would post a message such as:
```json
{
"id": "0f85aa1c-711e-4873-95b6-e441c291537d",
"action": "create",
"title": "Test Message Title",
"message": "Test Message Body",
"server": "blue-ranger-2"
}
```
### Header Manipulation
Some users may require special HTTP headers to be present when they post their data to PagerTree. This can be accomplished by just sticking a plus symbol (**+**) in front of any parameter you specify on your URL string. This is useful when making use of the [PagerTree Token feature](https://pagertree.com/docs/integration-guides/webhook#integration-options).
```bash
# Below would set the header:
# pagertree-token: abcdefg
#
# Assuming our {integration_id} is int_xxxxxxxxxx
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"pagertree://int_xxxxxxxxxx?+pagertree-token=abcdefg"
```
### Meta Manipulation
Some PagerTree functionality (like incidents) lives in the `meta` property of the payload. To add to the meta property you just need to prefix your entries with a minus (`-`) symbol. [See example.](https://pagertree.com/docs/integration-guides/webhook#example-request-2)
```bash
# Indicate to PagerTree this alert should be marked as an incident
# The `-` symbol will get stripped off when the upstream post takes place
# Apprise knows not to do anything with the argument at all and pass it along as is.
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"pagertree://int_xxxxxxxxxx?-incident=true&-incident_severity=SEV-1&-incident_message=Join the war room"
```