githubEdit

Notifications

DNSControl's "notifications" feature will log push changes to other services in real time. Typically this is used to automatically announce DNS changes in a team chatroom. The functionality is implemented using the open source Shoutrrrarrow-up-right library, which knows how to communicate to many different systems. Some additional services are provided natively, see the notifications packagearrow-up-right.

Configuration

Notifications are configured in the creds.json file, since they often contain API keys or other secrets. The notifications key lists the notification service and options.

creds.json
{
  "r53": {},
  "gcloud": {},
  "notifications": {
    "notify_on_push": false,
    "notify_on_preview": false,
    "slack_url": "https://api.slack.com/apps/0XXX0X0XX0/incoming-webhooks",
    "teams_url": "https://outlook.office.com/webhook/00000000-0000-0000-0000-000000000000@00000000-0000-0000-0000-000000000000/IncomingWebhook/00000000000000000000000000000000/00000000-0000-0000-0000-000000000000",
    "shoutrrr_url": "discover://token@id"
  }
}

Usage

There are two ways to enable notifications:

  1. On-demand: Add the --notify flag to dnscontrol preview or dnscontrol push commands

  2. Automatic: Enable notify_on_push or notify_on_preview in your creds.json

Automatic notifications

To automatically send notifications without using the --notify flag, configure these options in your creds.json:

  • notify_on_push: Set to true to send notifications during dnscontrol push (when changes are applied)

  • notify_on_preview: Set to true to send notifications during dnscontrol preview (dry-run mode)

Example: Notifications only for actual changes (push)

Example: Notifications for both preview and push

With automatic notifications enabled, you don't need to use the --notify flag. The --notify flag will still work to send notifications on-demand regardless of these settings.

Example DNS change

Below is an example where we add the A record foo and display the notification output.

Preview example

Preview notifications show what changes would be made without applying them:

The notification output

Push example

Push notifications show the actual changes being applied:

The notification output

Notification services

Shoutrrr

DNSControl supports various notification methods via Shoutrrr, including email (SMTP), Discord, Pushover, and many others. For detailed setup instructions, click on the desired service:

Chat and Messaging Platforms

Push Notification Services

Incident and Alert Management

Email Services

Specialized Services

Configure shoutrrr_url with the Shoutrrr URL to be notified.

Slack/Mattermost

To use the Slack integration, you need to create a webhook in Slack. Please see the Slack documentationarrow-up-right or the Mattermost documentationarrow-up-right

Configure slack_url to this webhook. Mattermost works as well, as they share the same api,

Microsoft Teams

To use the Teams integration, you need to create a webhook in Teams. Please see the Teams documentationarrow-up-right

Configure teams_url to this webhook.

Telegram

To use the Telegramarrow-up-right integration, you need to create a Telegram bot and obtain a Bot Token, as well as a Chat ID. Get a Bot Token by contacting @BotFatherarrow-up-right, and a Chat ID by contacting @myidbotarrow-up-right.

Configure telegram_bot_token and telegram_chat_id to these values.

Bonfire

This is Stack Overflow's built in chat system. This is probably not useful for most people.

Configure bonfire_url to be the full url including room and api key.

Last updated