Send Alert SMS using Lenze integration in PagerDuty

With Cloud Notify you receive real-time notifications from your machine(s) in a robust and safe way. By connecting an external application via a webhook, you can expand your options even further. Using the webhook PagerDuty, you can further customize alarm messages and determine specific roles for the alarm messages of Cloud Notify.

PagerDuty is an industrial incident response platform and can notify via phone, SMS, e-mail and push messages. Furthermore, you can also provide “On-call schedules” to specify shifts or timetables, so you will only receive notifications during your shift.

The use of webhooks in X4 Remote is free. However, keep in mind that applications such as PagerDuty may charge a fee for using their services.

This article explains how you can connect X4 Remote to PagerDuty via a webhook.

How it works

Based on the alerts in X4 Remote, PagerDuty notifies the right recipients by sending enriched event data, including an alarm description. X4 Remote uses webhooks to send HTTP POST message events to an endpoint in PagerDuty. When PagerDuty receives a message event, it will trigger an incident to notify users on-call, based on your configuration.

Integration walkthrough

The integration is configured in both X4 Remote and on the PagerDuty website. First we will add a service in Pagerduty:

Required permission

In PagerDuty you require a Manager role or higher for the service your X4 Remote is integrated with. If you do not have this role, please contact an administrator or Account Owner within your organization to configure the integration.

  • From the [Configuration] menu, select [Services].
  • On your Services page: click [+Add New Service].
1_Add_a_new_service.png
  • Give the Service a [Name], select [Customer Event Transformer] from the [Integration type] menu and enter an [Integration name].
2_Add_a_new_service.png

Make sure to set How should responders be notified under Incident Settings to Use alert severity to determine how responders are notified for each incident. This enables you to specify the Pagerduty urgency of a Cloud Notify alarm. You can customize these settings to meet your requirements.

Incident_settings.png

After adding the Service, use the [Event Rules] tab to create these event rules. If you follow these settings, only alarms with systemLabel alarm-high and alarm-medium will generate a High Urgency incident. Alarms with systemLabel alarm-low will generate a Low Urgency incident. Each user can specify for themselves how they should be notified for each urgency level. By default, a High Urgency Incident triggers an email, a call and an SMS. A Low Urgency Incident will only trigger an email. You can customize these settings to your liking.

Event_rules.png

We need to add some custom code so PagerDuty can understand the data it receives from X4 Remote.

  • Use the [Edit] action on your Custom Event Transformer.
3_Edit_service.png
  • Copy and paste the code below.
var input = PD.inputRequest.body;

var normalized_event = { 
  event_type: PD.Trigger, 
  description: input.shortContent, 
  client: "X4 Remote", 
  client_url: "https://iot.lenze.digital/messages/", 
  details: input 
};

PD.emitGenericEvents([normalized_event]);
5_Edit_integration.png
  • After saving the changes, copy the Integration URL.
6_Integration_URL.png

Now that the PagerDuty setup is complete, we can proceed with configuring the IXON Cloud:

  • Go to [Messages] in the main menu and open the Message Center settings by pressing the settings icon  in the top right corner.
12_Messages_settings.png
  • Add a new Webhook.
7_Add_new_webhook.png
  • Add your Integration URL.
8_Add_integration_URL.png
9_Add_new_webhook.png
  • Create a message, e.g. “trigger an alarm”.
11_Create_a_message_or_trigger_an_alarm.png

The message will be sent to PagerDuty and a new incident will be created.

13_Trigger_PagerDuty.png

PagerDuty and X4 Remote are now integrated

New alarm messages in X4 Remote will now be sent to and handled by PagerDuty.

Please refer to PagerDuty’s documentation on how to best utilise their wide range of functions.