Code Monkey home page Code Monkey logo

c8y_microservice-nodejs's Introduction

Cumulocity IoT Microservice

Codacy Badge

Cumulocity IoT microservice developed using Node.js and Docker. It notifies a Slack channel when there are alarms in the subscribed tenants.

Prerequisites

  • Local Docker installation.
  • A Cumulocity IoT account. Create a free trial to test this example.
  • Slack channel to post messages to, Slack app and OAuth token.
  • A .env file in the root directory with the following content:
PORT=80
SLACK_OAUTH_TOKEN=<YOUR-TOKEN-GOES-HERE>
SLACK_CHANNEL_ID=<YOUR-CHANNEL_ID-GOES-HERE>

Build

Execute the following commands to build the Docker image and save it as image.tar:

$ docker build -t mynode-microservice .
$ docker save mynode-microservice > "image.tar"

Then pack image.tar together with the manifest cumulocity.json into a ZIP file.

$ zip mynode-microservice cumulocity.json image.tar

The resulting mynode-microservice.zip file contains the microservice and it is ready to be uploaded to the Cumulocity IoT platform.

Deployment

Deploy the microservice application (refer to Adding own applications in the Cumulocity IoT's User guide) and subscribe it afterwards. It may take some minutes for the ZIP file to be uploaded.

Execution

Use a web browser or a terminal command (e.g. cURL) to make a GET request to the microservice endpoints.

GET <tenant-domain>.cumulocity.com/service/mynode-microservice/environment

The Slack channel will get the posted messages every time a new alarm is raised on the subscribed tenants.

Slack app posting alarms


These tools are provided as-is and without warranty or support. They do not constitute part of the Software AG product suite. Users are free to use, fork and modify them, subject to the license agreement. While Software AG welcomes contributions, we cannot guarantee to include every contribution in the master project.

c8y_microservice-nodejs's People

Contributors

manasesjesus avatar techcommunity avatar codacy-badger avatar dependabot[bot] avatar

Stargazers

MichaelGesmann avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.