Create an Email-Alert Trigger for DeviceHub Device Data Quality
In this guide, you will set up an alert and a trigger for a Litmus Edge device that is generating invalid/corrupted data. Then you will simulate an error output so that an alert is triggered. When the alert is triggered, the email addresses specified in the trigger will receive an email with information about the alert.
- If you haven't yet connected your Litmus Edge instance to Litmus Edge Manager, see Activate an Edge Device.
Follow the steps to Connect a Device. Select the Device Type Simulator and Driver Name Generator.
After connecting the device, you can Add a Tag to the device.
Configure the following for the tag:
- Name: S - Random value generator
- Value Type: string
You will next import the tag you've created as a topic into the generic MQTT SSL connector that connects Litmus Edge to Litmus Edge Manager.
In this step you will create an email notification alert. Next, you will create a trigger that will use the email notification alert. See Alerts for additional details.
From Litmus Edge Manager, navigate to Alerts and follow the steps below.
To set up an email alert:
From the Alerts pane, click the Add new Action icon. The Add new Action dialog box appears.
- From the Add new Action dialog box, enter the following details:
- Action Template: Select EMAIL.
- Action Name: Enter an action name.
- Enter email: Enter an email address that will receive the alert.
- Notifications Limit: Enter 1.
- Interval: Select minute.
- Click Add. The newly created action appears in the Action List.
To set up a trigger:
From the Alerts pane, click the Add new Trigger icon. The New Trigger pane appears.
- From the New Trigger pane, configure the following sections.
- Name: Enter a name for the trigger.
- Active: Select the checkbox.
- Dashboard: Select the checkbox.
- Description: Enter a description for the trigger.
Select Edge Device and select the appropriate Litmus Edge instance.
- Select Metrics as the source of the trigger.
- Click Add new rule.
- Select Alert template: Select DH device data quality.
- For Target Value, msgs/minute, enter 1 minute.
- For Alert Delay, seconds, enter 60 seconds.
- Action List: Select the action you previously created.
- Continuously: Select the checkbox to send notifications continuously.
- Notification Period, minutes: Enter 1.
When done, click Save. The alert trigger appears in the Trigger List.
From Litmus Edge, you will simulate the DeviceHub driver sending invalid/corrupted data.
To simulate a disconnection:
- Log in to Litmus Edge.
- From the navigation panel, navigate to DeviceHub > Tags. The Tags pane appears.
Click the Action menu for the tag you created and select Edit.
- For the Value Type field, select float64.
- For the Formula field, corrupt the Formula field by replacing the s in sin with 1 so that the final formula starts with 1in. Then, click Update Tag.
From Litmus Edge Manager, you will verify the simulated error rate.
To verify the successful trigger and alert:
- Log in to Litmus Edge Manager.
- Select the appropriate company and project. The Dashboard pane appears for the project.
- From the navigation panel, select Incidents. The Incidents pane appears.
The email address that was entered from Step 4a: Set up an Email Alert will also receive the respective alert email.