influxdb-csharp icon indicating copy to clipboard operation
influxdb-csharp copied to clipboard

How to pass Auth Details?

Open juliopereirab opened this issue 5 years ago • 1 comments

I have just started working with the library passing points to a local instance. If I switch to an influx instance that requires auth, I simply don't find in the README file how to pass those details to a collector instance. Here's a sample of my code:

        Metrics.Collector = new CollectorConfiguration()
            .Tag.With("host", Environment.MachineName)
            .Batch.AtInterval(TimeSpan.FromSeconds(5))
            .WriteTo.InfluxDB(
                Environment.GetEnvironmentVariable("InfluxDBServer"),
                Environment.GetEnvironmentVariable("InfluxDBDatabase")
            )
            .CreateCollector();

Any suggestions on how to pass auth bearer and password?.

Many thanks,

juliopereirab avatar Feb 14 '20 16:02 juliopereirab

@juliopereirab thanks for the issue. Here's the definition of InfluxDB which shows how to pass username and password: https://github.com/influxdata/influxdb-csharp/blob/master/src/InfluxDB.Collector/Configuration/CollectorEmitConfiguration.cs#L8

russorat avatar Feb 14 '20 21:02 russorat