Configuring alarms for email notification

To configure Blue Planet to send specific alarms to an administrator you can set up templates and rules:

  1. To get email notifications from Blue Planet, set up a configuration file to allow it access to your corporate mail server or a third-party mail service. Perform this step on each host where Blue Planet resides.

    On the Blue Planet host, create the /etc/bp2/dispatcher/smtp.conf file. Structure the contents as a JSON payload that contains the following:

     {
          "username": "USERNAME",
          "password": "PASSWORD",
          "staticPath": "/bp2/src/static",
          "requireAuthentication": true,
          "requireTransportSecurity": true,
          "host": "MAILSERVER.COM",
          "defaultFromName": "MAILER_NAME",
          "port": 25,
          "defaultFromEmail": "[email protected]"
    }
  2. Ensure you restart the dispatcher-email container for all hosts after creating or updating the smtp.conf file. For example, enter:

    sudo solman

  3. Enter one of the following commands based on your solution:

    • For single host, : solution_app_restart bpdr.io.blueplanet.orchestrate:17.02.1-25 dispatcher-email

      — or —

    • For a multiple host configuration enter from only one host’s command line, for example: solution_app_restart bpdr.io.blueplanet.orchestrate:ha-17.02.1-25 dispatcher-email

      This command restarts the dispatcher-email container on all hosts.

  4. To configure an email notification is a two- step process; first you must specify an output template (step 3), then create a rule using this template (step 4).

    To create the template, you can send either a JSON payload to the ntfconfig API endpoint for templates programmatically or use the command line.

    The following is an example of a JSON payload that creates an email template programmatically:

    {
      "name": "Example Template",
      "template_text": "At {{ get(\"message.header.timestamp\") }}, a message with ID {{ get(\"message.header.envelopeId\") }} triggered your rule {{ get(\"rule.name\") }}. This message was found on {{ get(\"rule.topic\") }} and has the type {{ get(\"message.event._type\") }}. \n\n The message contained the following data: \n\n{{ get(\"message.event.object_data\") }}\n\nFor more information, contact your Blue Planet site administrator."
    }

    The {{ get("FIELD") }} structures are a special case of Jinja2 placeholders. When a rule gets triggered, the dispatcher tries to fill the placeholders in with available data.

    For example, the field "message.header.envelopeId" displays the identifier associated with the message when it publishes. You can use additional advanced Jinja template syntax in your templates.

    When you submit a new or modified template, Blue Planet checks the syntax and rejects any templates with invalid syntax.

    To post this rule using Curl:

    curl -X POST \http://HAPROXY_IP/ntfconfig/api/v1/templates -- header 'content-type: application/json'; -d '{"name": "Example Template", "template_text": "At {{ get(\"message.header.timestamp\") }}, a message with ID {{ get(\"message.header.envelopeId\") }} triggered your rule {{ get(\"rule.name\") }}. This message was found on {{ get(\"rule.topic\") }} and has the type {{ get(\"message.event._type\") }}. \n\n The message contained the following data: \n\n{{ get(\"message.event.object_data\") }}\n\nFor more information, contact your Blue Planet site administrator."}'
  5. After you complete the template creation, create the rules. Rules decide what messages require a notification to be sent and to where to send them. As with template creation, you can send either a JSON payload to the ntfconfig API programmatically or use the command line.

    A JSON payload that creates an email rule programmatically follows:

    {
        "name": "Email Example Rule",
        "notification_type": "email",
        "topic": "bp.aeprocessor.v1.alarms",
        "trigger_type": "bp.v1.alarmRaised",
        "template": 1,
        "notification_params": "{\"to\": \"[email protected]\", \"subject\": \"BP Orchestrate Alarm was triggered\"}",
        "extra_compare":
    "{\"alarm.resource\": \"SPECIFIC_RESOURCE\"}"
    }

    This rule listens on the alarm processor output topic and triggers on alarm-raised events on a specific resource. When the rule sends an email to the target email address, with the subject "BP Orchestrate Alarm was triggered", the email contents includes information from the template associated with this rule (in this case, template #1). (NOTE: Not all Blue Planet deployments contain the alarm processor feature.)

    To post this rule using Curl:

    curl -X POST http://HAPROXY_IP/ntfconfig/api/v1/rules -- header 'content-type: application/json' -d '{"name": "Email Example Rule", notification_type": "email", "topic": "bp.aeprocessor.v1.alarms", "trigger_type": "bp.v1.alarmRaised", "template": 1, "notification_params": "{\"to\": \"[email protected]\", \"subject\": \"BP Orchestrate Alarm was triggered\"}", "extra_compare": "{\"alarm.resource\": \"SPECIFIC_RESOURCE\"}"}

results matching ""

    No results matching ""