Partager via


C# Tool to Simulate IOT Sensor Telemetry for OpenTSDB

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 (https://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.