From 4f5ad22113fcba7a3a1dc085e8823766fcc9b8ed Mon Sep 17 00:00:00 2001 From: arthtux Date: Thu, 23 Jun 2016 15:47:18 -0400 Subject: [PATCH] remove create database --- plugins/outputs/influxdb/influxdb.go | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/plugins/outputs/influxdb/influxdb.go b/plugins/outputs/influxdb/influxdb.go index 2b9fd101c..2545613e5 100644 --- a/plugins/outputs/influxdb/influxdb.go +++ b/plugins/outputs/influxdb/influxdb.go @@ -127,13 +127,6 @@ func (i *InfluxDB) Connect() error { if err != nil { return err } - - err = createDatabase(c, i.Database) - if err != nil { - log.Println("Database creation failed: " + err.Error()) - continue - } - conns = append(conns, c) } } @@ -143,14 +136,6 @@ func (i *InfluxDB) Connect() error { return nil } -func createDatabase(c client.Client, database string) error { - // Create Database if it doesn't exist - _, err := c.Query(client.Query{ - Command: fmt.Sprintf("CREATE DATABASE IF NOT EXISTS \"%s\"", database), - }) - return err -} - func (i *InfluxDB) Close() error { var errS string for j, _ := range i.conns { @@ -202,13 +187,6 @@ func (i *InfluxDB) Write(metrics []telegraf.Metric) error { if e := i.conns[n].Write(bp); e != nil { // Log write failure log.Printf("ERROR: %s", e) - // If the database was not found, try to recreate it - if strings.Contains(e.Error(), "database not found") { - if errc := createDatabase(i.conns[n], i.Database); errc != nil { - log.Printf("ERROR: Database %s not found and failed to recreate\n", - i.Database) - } - } } else { err = nil break