github.com/aristanetworks/goarista@v0.0.0-20240514173732-cca2755bbd44/influxlib/doc.go (about)

     1  // Copyright (c) 2018 Arista Networks, Inc.
     2  // Use of this source code is governed by the Apache License 2.0
     3  // that can be found in the COPYING file.
     4  
     5  /*
     6     Package: influxlib
     7     Title: Influx DB Library
     8     Authors: ssdaily, manojm321, senkrish, kthommandra
     9     Email: influxdb-dev@arista.com
    10  
    11     Description: The main purpose of influxlib is to provide users with a simple
    12     and easy interface through which to connect to influxdb. It removed a lot of
    13     the need to run the same setup and tear down code to connect the the service.
    14  
    15     Example Code:
    16  
    17     connection, err := influxlib.Connect(&influxlib.InfluxConfig {
    18        Hostname: conf.Host,
    19        Port: conf.Port,
    20        Protocol: influxlib.UDP,
    21        Database, conf.AlertDB,
    22     })
    23  
    24     tags := map[string]string {
    25        "tag1": someStruct.Tag["host"],
    26        "tag2": someStruct.Tag["tag2"],
    27     }
    28  
    29     fields := map[string]interface{} {
    30        "field1": someStruct.Somefield,
    31        "field2": someStruct.Somefield2,
    32     }
    33  
    34     connection.WritePoint("measurement", tags, fields)
    35  */
    36  
    37  package influxlib