Skip to content

ciscops/node-red-alerts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Node-RED Alerts

Objective

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.

Getting Started

These instructions will take you through setting up a Node-RED flow for alerts.

You will need:

  • Node.js
  • Node-RED
  • Webex
  • An email

Node-RED Set Up

Installation

  1. Install the latest LTS version of Node.js
    1. To verify whether this was installed properly run node -v and npm -v (the system should display what node and npm version is installed on your system)
  2. Install Node-RED locally with npm

Check

  1. Check whether you installed it correctly by running node-red in your terminal
  2. Navigate to http://localhost:1880/ which should automatically direct you to your flow (unless you changed the port number in configuration)

Webex Bot Set Up

Installation

Install Webex for your operating system

Webex Developer

  1. Sign up for a developer account here
  2. Create a bot here and fill out the fields
  3. Write down your bot's access token
  4. Open Webex and add your bot to your alerts space using its username
  5. Get the room ID for that space by here and pressing run.
    1. The title should correspond with the name of your alerts space. alt text

Email Set Up

Set up an SMTP relay service for the email you would like to send alerts from. If you are using gmail, follow this documentation.

Create Node-RED Flow

  1. Navigate to http://localhost:1880/ (or you [host]:1880 if you are not using Node-RED locally)
  2. Make a flow in Node-RED that looks like the example below
    1. If you already have a data source, you can use that. For the sake of this tutorial, I will be using inject nodes.
    2. If you need an example of the function node, I provided one here. Please feel free to adjust the msg.payload as necessary for your use case. alt text alt text
  3. Make a second flow in Node-RED that looks like the example below alt text
  4. Configure the Webex function node. Remember to replace the placeholders with your room ID and bot's access token. alt text
  5. Configure the http request node alt text
  6. Configure the email function node alt text
  7. Configure the email node alt text

Testing

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.

Conclusion

In this tutorial, you learned how to set up Webex and email alerts to monitor your data.

About

Email and Webex alerts through Node-RED

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published