Our goal in this lab is to make real-time email and Webex alerts when a data parameter we are monitoring exceeds a certain level. This help us so that we don't have to monitor the dashboard all of the time.
These instructions will take you through setting up a Node-RED flow for alerts.
You will need:
- Node.js
- Node-RED
- Webex
- An email
- Install the latest LTS version of Node.js
- To verify whether this was installed properly run
node -v
andnpm -v
(the system should display what node and npm version is installed on your system)
- To verify whether this was installed properly run
- Install Node-RED locally with npm
- Check whether you installed it correctly by running
node-red
in your terminal - Navigate to http://localhost:1880/ which should automatically direct you to your flow (unless you changed the port number in configuration)
Install Webex for your operating system
- Sign up for a developer account here
- Create a bot here and fill out the fields
- Write down your bot's access token
- Open Webex and add your bot to your alerts space using its username
- Get the room ID for that space by here and pressing run.
Set up an SMTP relay service for the email you would like to send alerts from. If you are using gmail, follow this documentation.
- Navigate to http://localhost:1880/ (or you
[host]:1880
if you are not using Node-RED locally) - Make a flow in Node-RED that looks like the example below
- Make a second flow in Node-RED that looks like the example below
- Configure the Webex function node. Remember to replace the placeholders with your room ID and bot's access token.
- Configure the http request node
- Configure the email function node
- Configure the email node
Every thing should be set up so if you press the inject nodes, if the inject node's value is greater than or equal to 25, your Webex bot should send you a message and your SMTP email should send you an email.
In this tutorial, you learned how to set up Webex and email alerts to monitor your data.