Over a million developers have joined DZone.

C# Tool to Simulate IoT Sensor Telemetry for OpenTSDB

TSDBWriter is a simpel .NET solution that writes a single metric in a given time range at a configurable sample rate to OpenTSDB. Here is some sample code.

· IoT Zone

tsdbwriter is a simple .NET solution that writes a single metric (e.g. LivingRoom.Temperature, FlowSensor.FlowRate) in a given time range at a configurable sampling rate to OpenTSDB (http://opentsdb.net/). The generated metric value is random within the given range that is specified in the configuration file. For now only analog metrics like temperature, pressure, flow, wind speed, etc. are supported.  Discrete sensors like on/off will be added soon.

For generating a metric stream, simply execute MetricWriter.exe after changing Config.json, a sample of which is below:

{
    "TsdbHostName": "localhost", //the DNS name of the TSDB HOST
    "TsdbPortNumber": "4242",    //TSDB port number; the default is 4242;
    "MetricName": "LivingRoom.Temperature", //any meaningful name
    "StartDate": "01/01/2013", //mandatory
    "EndDate": "01/2/2013",    //if missing, current date will be used
    "SamplingIntervalMinutes": "5", //minutes
    "MetricLow": "65",              //low end of the metric
    "MetricHigh": "85",             //high end of the metric
    "Tags": { "app": "test" }  //comma separated list of name:value pairs
}

The project is located at: https://github.com/hanuk/tsdbwriter.


Topics:
iot ,c# ,opentsdb

Published at DZone with permission of Hanu Kommalapati, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}