Add HTTP authentification to influxdb metric backend
This commit is contained in:
parent
031451abab
commit
5ce4a2d05c
3 changed files with 20 additions and 2 deletions
|
@ -104,6 +104,20 @@
|
||||||
#
|
#
|
||||||
protocol = "udp"
|
protocol = "udp"
|
||||||
|
|
||||||
|
# InfluxDB's username
|
||||||
|
#
|
||||||
|
# Optional
|
||||||
|
# Default: "" (no username)
|
||||||
|
#
|
||||||
|
username = ""
|
||||||
|
|
||||||
|
# InfluxDB's password
|
||||||
|
#
|
||||||
|
# Optional
|
||||||
|
# Default: "" (no password)
|
||||||
|
#
|
||||||
|
password = ""
|
||||||
|
|
||||||
# InfluxDB push interval
|
# InfluxDB push interval
|
||||||
#
|
#
|
||||||
# Optional
|
# Optional
|
||||||
|
|
|
@ -157,7 +157,9 @@ func (w *influxDBWriter) Write(bp influxdb.BatchPoints) error {
|
||||||
func (w *influxDBWriter) initWriteClient() (influxdb.Client, error) {
|
func (w *influxDBWriter) initWriteClient() (influxdb.Client, error) {
|
||||||
if w.config.Protocol == "http" {
|
if w.config.Protocol == "http" {
|
||||||
return influxdb.NewHTTPClient(influxdb.HTTPConfig{
|
return influxdb.NewHTTPClient(influxdb.HTTPConfig{
|
||||||
Addr: w.config.Address,
|
Addr: w.config.Address,
|
||||||
|
Username: w.config.Username,
|
||||||
|
Password: w.config.Password,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -455,13 +455,15 @@ type Statsd struct {
|
||||||
PushInterval string `description:"StatsD push interval" export:"true"`
|
PushInterval string `description:"StatsD push interval" export:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfluxDB contains address and metrics pushing interval configuration
|
// InfluxDB contains address, login and metrics pushing interval configuration
|
||||||
type InfluxDB struct {
|
type InfluxDB struct {
|
||||||
Address string `description:"InfluxDB address"`
|
Address string `description:"InfluxDB address"`
|
||||||
Protocol string `description:"InfluxDB address protocol (udp or http)"`
|
Protocol string `description:"InfluxDB address protocol (udp or http)"`
|
||||||
PushInterval string `description:"InfluxDB push interval" export:"true"`
|
PushInterval string `description:"InfluxDB push interval" export:"true"`
|
||||||
Database string `description:"InfluxDB database used when protocol is http" export:"true"`
|
Database string `description:"InfluxDB database used when protocol is http" export:"true"`
|
||||||
RetentionPolicy string `description:"InfluxDB retention policy used when protocol is http" export:"true"`
|
RetentionPolicy string `description:"InfluxDB retention policy used when protocol is http" export:"true"`
|
||||||
|
Username string `description:"InfluxDB username (only with http)" export:"true"`
|
||||||
|
Password string `description:"InfluxDB password (only with http)" export:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Buckets holds Prometheus Buckets
|
// Buckets holds Prometheus Buckets
|
||||||
|
|
Loading…
Reference in a new issue