Difference between revisions of "Sending data to Senfi"

From Senfi Docs
Jump to: navigation, search
Line 30: Line 30:
  
 
=== Publish to MQTT ===
 
=== Publish to MQTT ===
 +
 +
A typical integration follows this pattern:
 +
 +
  External system --> Your application --> Senfi MQTT endpoint
 +
 +
Either the external system you are monitoring pushes to your application, or your application polls the external system for its current values. Either way, once your application has those values, you can prepare to send it to Senfi's MQTT endpoint.
  
 
==== MQTT Endpoint ====
 
==== MQTT Endpoint ====
Line 40: Line 46:
 
You can take a look at [https://github.com/gelement-com/mqtt-ingestor-sample this GitHub repository] for a sample application to send data to Senfi's MQTT endpoint.
 
You can take a look at [https://github.com/gelement-com/mqtt-ingestor-sample this GitHub repository] for a sample application to send data to Senfi's MQTT endpoint.
  
Publishing strategy: regular, upon change,
+
==== Publishing Strategy ====
 +
You can either choose to publish data to Senfi regularly (eg. every second), or only do so upon data changes. In practice, it is recommended that you publish regularly, since there may be multiple metrics in a measurement.

Revision as of 16:29, 11 September 2019

Senfi monitors and stores time series data from your existing systems. At the moment, Senfi provides a MQTT interface for receiving data from your systems. To start sending data to Senfi, you need to do the following:

  1. Create an integration key in the CMS
  2. Design and create a measurement in the CMS
  3. Write a program to read from your system and send it to Senfi's MQTT endpoint

Create integration key

  1. Login to the CMS
  2. Go to the Integration tab
  3. Click the + button to add a new integration key/secret pair
  4. Note down the values of the Key (your integration key) and Secret (your integration secret)

Design/create measurement

The key to a successful integration is to have a well-designed measurement. So if you are not familiar with the concept of measurement/metric/tag, please read this section first.

  1. When you are designing a measurement to represent your system, note down the metrics you want to capture.
  2. Decide on a set of tags to use. Make sure that there is a combination of tags that will uniquely identify the unit/device/equipment that outputs those metrics.
  3. Login to the CMS
  4. Go to the Measurement tab
  5. Click the + button to add a new measurement
  6. Give the measurement a descriptive name. This will be shown to users of the dashboard.
  7. Specify a measurement code. A measurement code is a unique identifier of this measurement. You can use a combination of lowercase alphanumeric characters and underscore.
    • The naming convention of a measurement code is as follows: <vendor>_<system>_<version>
    • For example: nest_thermostat_v1. If you make changes to the measurement (eg. adding or removing metrics), you should increment the version, eg. nest_thermostat_v2.
  8. Add tags
  9. Add metrics and specify the type of each metric
  10. Save when done

Publish to MQTT

A typical integration follows this pattern:

 External system --> Your application --> Senfi MQTT endpoint

Either the external system you are monitoring pushes to your application, or your application polls the external system for its current values. Either way, once your application has those values, you can prepare to send it to Senfi's MQTT endpoint.

MQTT Endpoint

Host
mqtt.senfi.io
Port
1883
Username
<Your integration key>
Password
<Your integration secret>
MQTT topic
ingestor/1/0/live/text/array/ems/<your integration key>/<your measurement code>

You can take a look at this GitHub repository for a sample application to send data to Senfi's MQTT endpoint.

Publishing Strategy

You can either choose to publish data to Senfi regularly (eg. every second), or only do so upon data changes. In practice, it is recommended that you publish regularly, since there may be multiple metrics in a measurement.