GuidesAPI ReferenceDiscussions
GuidesBlogPlatform

Alert Configuration for Self-Hosting

How alerts work in a self-hosted Databand instance.

This is a continuation of the Alerting page, relevant for self-hosted Databand.

You can use our UI configuration to define standard receivers. See more information at Alerting .
For Email Notification

E mail Notification via Receiver configured at Databand UI

You need to set up SMTP default params. You can provide default SMTP parameters to use for sending out email alerts. In order to do that please set following environment variables for the dbnd-web webserver service:

  • DBND__ALERT__SMTP_EMAIL_FROM
  • DBND__ALERT__SMTP_HOSTNAME
  • DBND__ALERT__SMTP_APIKEY_OR_USERNAME
  • DBND__ALERT__SMTP_TOKEN_OR_PASSWORD

For instance:

export [email protected]
export DBND__ALERT__SMTP_HOSTNAME=sendgrid.com:12345
export DBND__ALERT__SMTP_APIKEY_OR_USERNAME=sample-api-key
export DBND__ALERT__SMTP_TOKEN_OR_PASSWORD=sample-api-token 

Advanced Alerts Routing Configuration

Databand uses Prometheus Alertsmanager to dispatch alerts. If you are looking for advanced routes for your alerts You can have the manual configuration. In the configuration of the Alertsmanager web service, specify where the alert needs to be sent (Databand application, Slack, email, etc.) and the users who will receive them.

Here is an example of a configuration specified in the Alertsmanager web service:

route:
  receiver: 'databand'
  routes:
    - receiver: 'databand'
      group_wait: 1s
      group_interval: 5s
      repeat_interval: 30s
      match:
        is_dbnd_internal: 'true'
      continue: false  # skip next receivers
    # - receiver: 'email'
    #   group_wait: 30s
    #   group_interval: 5m
    #   repeat_interval: 1h
    #   continue: true
receivers:
  - name: 'databand'
    webhook_configs:
      - url: 'http://webserver:8080/api/v1/webhooks/alertmanager'
        send_resolved: false
  - name: 'slack'
    slack_configs:
      - api_url: '<API URL>'
        username: 'DBND Alertmanager'
        channel: '#dbnd-alerts-testing'
        icon_url: https://avatars3.githubusercontent.com/u/3380462
        send_resolved: false
        title: '{{ template "dbnd_title" . }}'
        title_link: '{{ template "dbnd_titlelink" . }}'
        text: '{{ template "dbnd_slack_message" . }}'
  - name: 'email'
    email_configs:
      - to: '[email protected]'  # set receiver email
        from: '[email protected]'  # set verified Sender Identity
        smarthost: 'smtp.sendgrid.net:587'
        auth_username: 'apikey'
        auth_password: '<< API Token >>'
        send_resolved: false
        html: '{{ template "dbnd_email_message" . }}'
        headers:
          subject: '{{ template "dbnd_email_subject" . }}'
templates:
  - /etc/alertmanager/notifications.tmpl
  - /etc/alertmanager/email.tmpl

As you can see from the configuration example, in Alerts, you can also specify the conditions for sending alerts to the next alerts cycle. See Alert Manager online documentation for information about how to customize it.


What’s Next
Did this page help you?