Skip to content

Notifier#

Description Notifier creates and delivers custom notifications from a variety of sources to multiple destinations.
Author Nokia
Supported OS SR Linux, SR OS
Catalog nokia-eda/catalog
Language Go
Source Code coming soon

Installation#

Notifier app can be installed using EDA App Store or by running the app-installer workflow with kubectl:

apiVersion: core.eda.nokia.com/v1
kind: Workflow
metadata:
  name: notifier-install
  namespace: eda-system
spec:
  type: app-installer
  input:
    app: notifier
    catalog: eda-catalog-builtin-apps
    operation: install
    vendor: nokia
    version:
      type: semver
      value: v2.0.0
cat << 'EOF' | kubectl apply -f -
apiVersion: core.eda.nokia.com/v1
kind: Workflow
metadata:
  name: notifier-install
  namespace: eda-system
spec:
  type: app-installer
  input:
    app: notifier
    catalog: eda-catalog-builtin-apps
    operation: install
    vendor: nokia
    version:
      type: semver
      value: v2.0.0
EOF

Configuration#

After installing the app, you can configure your notification sources and destinations. You have the option to choose between two sources - Alarm or Query - and can send notifications to multiple destinations.

Sources are defined using the Notifier Custom Resource (CR), while destinations1 (referred to as Providers) are set up using the Provider CR. You can mix and match sources, as well as send notifications to multiple destinations.

Notification source#

To configure the source of the notifications, you need to create a Notifier CR. The example below shows a configuration for the notification source that will:

  • use all Alarms as notification source
  • send notifications to the discord provider.
apiVersion: notifiers.eda.nokia.com/v1
kind: Notifier
metadata:
  name: alarms-to-discord
  namespace: eda-system
spec:
  description: "Notifier for all alarms to Discord"
  enabled: true
  sources:
    alarms:
      include:
        - "*"
  providers:
    - discord
cat << 'EOF' | kubectl apply -f -
apiVersion: notifiers.eda.nokia.com/v1
kind: Notifier
metadata:
  name: alarms-to-discord
  namespace: eda-system
spec:
  description: "Notifier for all alarms to Discord"
  enabled: true
  sources:
    alarms:
      include:
        - "*"
  providers:
    - discord
EOF

Provider reference#

The Notification Source references the Notification Destination by its name. In the example above, the discord provider referenced in the Notifier CR is the name of the Provider CR that should exist in the same namespace as the Notifier CR.

Notification destination#

The Provider CR defines the destination for the notifications produced by the Notification Source (aka Notifier CR). The below example shows a configuration for the notification destination that sends notification to the Discord webhook:

apiVersion: notifiers.eda.nokia.com/v1
kind: Provider
metadata:
  name: discord
  namespace: eda-system
spec:
  enabled: true
  uri: discord://${TOKEN}@${WEBHOOKID}
cat << 'EOF' | kubectl apply -f -
apiVersion: notifiers.eda.nokia.com/v1
kind: Provider
metadata:
  name: discord
  namespace: eda-system
spec:
  enabled: true
  uri: discord://${TOKEN}@${WEBHOOKID}
EOF

Note, that the Provider name in the .metadata.name field should match the provider name referenced in the Notifier CR.

Providers#

Notifier supports multiple notification destinations (aka providers), and leverages the shoutrrr package to send notifications to the supported providers. The full list of supported providers is available at the shouterrr docs.

Notifier app knows which provider to use based on the uri field in the Provider CR.

Discord#

shoutrrr/services/discord/

To send notifications to Discord a user needs to create a Discord webhook2. The webhook URL should look like this:

https://discord.com/api/webhooks/webhookid/token
                                 ^^^^^^^^^ ^^^^^

Transform the original webhook URL into the format expected by the Notifier app:

discord://token@webhookid #(1)!
  1. Pay attention to the order of the webhookid and token in the URL. The original webhook URL has the token after the webhookid, and the Notifier app expects the token to be before the webhookid.

Now everything is ready for the Provider CR creation with the following configuration:

apiVersion: notifiers.eda.nokia.com/v1
kind: Provider
metadata:
  name: discord
  namespace: eda-system
spec:
  enabled: true
  uri: discord://${TOKEN}@${WEBHOOKID}
cat << 'EOF' | kubectl apply -f -
apiVersion: notifiers.eda.nokia.com/v1
kind: Provider
metadata:
  name: discord
  namespace: eda-system
spec:
  enabled: true
  uri: discord://${TOKEN}@${WEBHOOKID}
EOF

discord

Discord notification

Slack#

shoutrrr/services/slack/

To send notifications to Slack a user may create a Slack application. Refer to Slack's API documentation to create an app.

Once the app is created, and the right scope is given to it, extract the Bot User OAuth Token as explain in the shouterrr docs. The token should look similar to this:

slack://xoxb-1122233344442-7670709334839-abcdefnY03YbI4HCDUh0bHa7@C07LTT12345
apiVersion: notifiers.eda.nokia.com/v1
kind: Provider
metadata:
  name: slack
  namespace: eda-system
spec:
  enabled: true
  uri: slack://xoxb-1122233344442-7670709334839-abcdefnY03YbI4HCDUh0bHa7@C07LTT12345
cat << 'EOF' | kubectl apply -f -
apiVersion: notifiers.eda.nokia.com/v1
kind: Provider
metadata:
  name: slack
  namespace: eda-system
spec:
  enabled: true
  uri: slack://xoxb-1122233344442-7670709334839-abcdefnY03YbI4HCDUh0bHa7@C07LTT12345
EOF

  1. The full list of supported destinations/providers is available here

  2. Refer to the Discord docs for more information on how to create a Discord webhook.