Skip to content

dejanfajfar/openTSDB.net

Repository files navigation

openTSDB.net


Notice: This is not the openTSD.net web page repository. If you are looking for this then try HERE


Build status

Introduction

openTSDB.net is a low weight, low impact implementation of a application to OpenTSDB bridge.

Scope

Although the openTSDB API is powerfull this library concentrates on one thing.

Getting data into the openTSDB

This is the only concern of this library. If you want a more complete interaction model then please contact me.

Installation

NuGet

PM> Install-Package openTSDB.net

Glossary

Term Definition
Named instance A instance of the manager that can be accessed using a globally unique name and the same instance shared by many
Anonymous instance A instance of the manager that can not be accessed using a name and therefore can not be retrieved multiple time from the factory
Manager The openTsdb factory is the entry point of the library, but the manager is the core implementation and object that the client is interacting with

Getting started

Hit the ground running

Working the factory

OpenTsdb.net uses a factory pattern to provide "unknown" and named instances of the manager.

Named instances

var tsdbManager = OpenTsdbFactory.Instance(TsdbOptions.New("http://localhost:4242"), "myInstance");

Where myInstance is the instance identifier.

If the instance was already initialized by someone else then the same instance will be returned.

Anonymous instance

var tsdbManager = OpenTsdbFactory.Instance(TsdbOptions.New("http://localhost:4242"));

Publishing data

The point of this all is to get data into the openTSDB database.

This can be done...

Quick and easy

If we want to publish only one data point then this can easily be achieved by

tsdbManager.PushAsync<int>("login", 1);

More control more code

There is also a longer way that provides more control over the data transmitted.

var dataPoint = new DataPoint<int>
{
    Value = 23,
    Metric = "user_age",
    Timestamp = DateTime.Now.ToEpoch(),
    Tags = new TagsCollection()
};

var result = tsdbManager.PushAsync<int>(dataPoint);

About

Simple openTSDB client for .net projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages