IBM Cloud Docs
Sending email notifications to IBM Cloud Event Notifications

Sending email notifications to IBM Cloud Event Notifications

In this tutorial, you learn how to set up IBM Cloud® Monitoring to send alert notifications to IBM Cloud Event Notifications. For this tutorial IBM Cloud Event Notifications is configured to send email notifications to subscribers.

Data flow
Figure 1. Data flow for this tutorial

In this tutorial you will configure the following flow:

  1. An alert is raised in IBM Cloud Monitoring.
  2. IBM Cloud Monitoring sends a notification to IBM Cloud Event Notifications.
  3. IBM Cloud Event Notifications creates an email and sends the email to the subscribed user.

Before you begin

Your IBM Cloud Monitoring instances can send events to IBM Cloud Event Notifications instances in the same account and in other accounts. IBM Cloud Event Notifications is available in a limited number of regions.

For this tutorial, make sure you have an IBM Cloud Monitoring instance configured and collecting logs in a region where IBM Cloud Event Notifications is supported such as us-south.

Log in to IBM Cloud

Log in to your IBM Cloud account.

  1. Click IBM Cloud dashboard to launch the IBM Cloud dashboard.

  2. Log in with your user ID and password. The IBM Cloud Dashboard opens.

Create an IBM Cloud Event Notifications service instance

First, create an IBM Cloud Event Notifications service instance by doing the following:

  1. Click Catalog.

  2. In Search the catalog enter Event Notifications.

  3. In the Create tab enter:

    • For Select a location select Dallas (us-south).
    • For Select a pricing plan select Lite.
    • For Service name enter a name of your choice. For example: my_event_notifications.
    • For Select a resource group enter your resource group.
  4. Read and agree to the license agreements.

  5. Click Create

Your IBM Cloud Event Notifications instance is created and is displayed.

Configure permissions

To grant an instance of the IBM Cloud Monitoring service access to an instance of the IBM Cloud Event Notifications service, you must define an authorization where the source service is set to IBM Cloud Monitoring and Resources based on selected attributes; the target service is set to IBM Cloud Event Notifications and Resources based on selected attributes; and the service access includes both Reader and Event Source Manager access.

  1. Click Manage > Access (IAM).
  2. Click Authorizations.
  3. Click Create.
  4. For Source service select IBM Cloud Monitoring.
  5. For How do you want to scope the access? select All resources.
  6. For Target service select Event Notifications.
  7. For How do you want to scope the access? select All resources.
  8. For Service access make sure Reader and Event Source Manager are selected.
  9. Click Authorize.

For more information on how to define authorizations, see Using authorizations to grant access between services.

Configure a notification source in IBM Cloud Event Notifications

To create a notification source in IBM Cloud Event Notifications you will make the configuration change in IBM Cloud Monitoring. When you create the notification channel in IBM Cloud Monitoring it will be available automatically in IBM Cloud Event Notifications.

  1. Click the menu icon Menu icon

  2. In the navigation menu, select Observability.

  3. Select Monitoring.

    The list of instances that are available on IBM Cloud is displayed.

  4. Select an instance in the us-south region. Then, click Open dashboard.

    The Web UI opens.

  5. In the navigation click the circle icon with your initials.

  6. Click Settings.

  7. Click Notification Channels.

  8. Click Add Notification Channel.

  9. Select IBM Event Notifications.

  10. For Event Notifications Instance select the IBM Cloud Event Notifications you created.

  11. For Channel Name give your channge a unique name. For example, my_event_notification_channel.

  12. For this tutorial leave all options enabled and the Shared With team as the default value.

    New IBM Event Notification Channel
    Figure 2. New IBM Event Notification Channel

  13. Click Save.

  14. Click the menu icon Menu icon > Resource list.

  15. Open Services and software.

  16. Open the IBM Cloud Event Notifications instance you created. For example, my_event_notifications.

  17. Click Sources.

    When you configure the channel in Monitoring, a source, with the same name as your Monitoring instance name, is automatically added to your IBM Cloud Event Notifications Sources list.

Create an IBM Cloud Event Notifications topic

Next you will define an IBM Cloud Event Notifications topic that will receive the notification from IBM Cloud Monitoring.

  1. Click Topics.

  2. Click Create. The Topic details panel opens.

  3. In the Topic details enter the following:

    • Enter the Name for your topic. For example, MyMonitoringTopic.
    • For Source select the IBM Cloud Event Notifications source, which is named the same as your IBM Cloud Monitoring instance.
    • Select an Event Type. For this tutorial select Alert.
    • Select an Event subtype. For this tutorial select Metric.
    • Select a Severity. For this tutorial select Info Severity.

    Topic details
    Figure 3. Topic details

  4. Click Add a condition.

    If you do not click Add a condition before you click Create, the topic will be created with no conditions associated with it.

  5. Click Create. Your topic will be displayed in the Topics list.

    Topics list
    Figure 4. Topics list

Create an IBM Cloud Event Notifications destination

In this step you will make sure that an email destination exists where notifications will be forwarded.

  1. Click Destinations.

  2. Notice in the Destinations list that, by default, there is an IBM Cloud Email service defined. You do not need to do anything else to configure an email destination.

    If you wanted to add a webhook as a destination, you would click Add and provide the appropriate information in the Add a destination panel.

Create an IBM Cloud Event Notifications email subscription

In this step you will configure who will receive an email when a notification is processed.

  1. Click Subscriptions.

  2. Click Create. The Create a subscription panel opens.

  3. In the Create a subscription panel enter the following:

    • Enter the Name for your subscription. For example, MyMonitoringSubscription.
    • For Topic select the topic you created. For example, MyMonitoringTopic.
    • For Destination select IBM Cloud Email service.
    • For Recipients enter a valid email address, for example, MyEmail@MyCompany.com

    Create subscription
    Figure 5. Create subscription

  4. Click Create. Your subscription will be added to the Subscriptions list.

    Subscriptions list
    Figure 5. Subscriptions list

Create an IBM Cloud Monitoring alert notification

Now, create an IBM Cloud Monitoring alert that will trigger the IBM Cloud Event Notifications notification.

  1. Click the menu icon Menu icon.

  2. In the navigation menu, select Observability.

  3. Select Monitoring.

    The list of instances that are available on IBM Cloud is displayed.

  4. Select the IBM Cloud Monitoring instance that you configured to send notifications to IBM Cloud Event Notifications.. Click Open Dashboard.

  5. Click Alerts.

  6. Click Add Alert.

  7. Create an alert that meets the criteria of the IBM Cloud Event Notifications topic that you created.

    1. Click Metric.

    2. For the new alert specify the following:

      • For Name specify MyEventNotificationAlert.
      • For Severity specify Info.
      • Define a metric for you system that you know will trigger an alert.
      • Enable the myEventNotificationChannel for the alert.
    3. Click Create.

Next steps

You should start receiving email notifications at the email address that you configured whenever the criteria defined in both IBM Cloud Monitoring and IBM Cloud Event Notifications match.