'Monitoring connectivity for Slack and PagerDuty

We are using PRTG to monitor a number of internal resources, and we have set it up to alert us on a Slack channel and/or via PagerDuty (depending on severity) using their respective APIs. Considering that Slack and PagerDuty are external to us, we would also like to monitor whether our PRTG instance can access them -- basically, a form of self-monitoring or Who Watches the Watchmen?

So far the only reliable method we've found for Slack is to post an actual message to a private "testing" Slack channel, e.g. (Slack URL details redacted):

POST https://hooks.slack.com/services/XXX/YYY/ZZZ
Content-Type: application/json

{ "text": " ", "channel": "#prtg-webhook-test" }

Similarly, PagerDuty's Events API appears to be POST only, and the valid actions are limited to trigger, acknowledge, and resolve:

POST https://events.pagerduty.com/v2/enqueue
Content-Type: application/json

Is there a good way to test HTTPS connectivity without posting an actual Slack message / creating an actual PagerDuty alert? I couldn't find anything in documentation for either service, or a creative way to create an appropriate sensor in PRTG.



Solution 1:[1]

For Slack you might rather want to make an call to the API, not to a webhook.

I would recommend using auth.test, since its one of the few methods that has no rate limit.

Also, for the whole Slack service you can see the current status on this official webpage.

Solution 2:[2]

For pure connectivity, you can do a POST against the Events API with an empty payload, and you'll get an error message back:

curl --location --request POST 'https://events.pd-staging.com/v2/enqueue' \
--header 'Content-Type: application/json' \
--data-raw '{}'
{
    "status": "invalid event",
    "message": "Event object is invalid",
    "errors": [
        "'event_action' is missing or blank",
        "'routing_key' must be provided in the body, or provided in the headers using 'x-routing-key'"
    ]
}

If you'd also like to validate your routing key, you can send an acknowledge event with a dummy dedup_key:

curl --location --request POST 'https://events.pd-staging.com/v2/enqueue' \
--header 'Content-Type: application/json' \
--header 'Cookie: uid=rBGA1lymclmSzRCsAwO3Ag==' \
--data-raw '{
    "routing_key": "<your_routing_key>",
    "event_action": "acknowledge",
    "dedup_key": "something_that_will_never_match_an_open_incident"
}'
{
    "status": "success",
    "message": "Event processed",
    "dedup_key": "something_that_will_never_match_an_open_incident"
}

Note that this will not show up anywhere in the PagerDuty UI, but that could be what you'd want anyways.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Erik Kalkoken
Solution 2 Hannele