Minor usability fixes to config

This commit is contained in:
Evan Phoenix
2015-05-18 15:22:04 -07:00
parent 82cbc4daa2
commit 13e6018eb0
4 changed files with 103 additions and 38 deletions

View File

@@ -9,12 +9,8 @@ import (
"github.com/influxdb/tivan/plugins"
)
type Server struct {
Address string
}
type Mysql struct {
Servers []*Server
Servers []string
}
var sampleConfig = `
@@ -32,7 +28,7 @@ func (m *Mysql) Description() string {
return "Read metrics from one or many mysql servers"
}
var localhost = &Server{}
var localhost = ""
func (m *Mysql) Gather(acc plugins.Accumulator) error {
if len(m.Servers) == 0 {
@@ -80,8 +76,8 @@ var mappings = []*mapping{
},
}
func (m *Mysql) gatherServer(serv *Server, acc plugins.Accumulator) error {
db, err := sql.Open("mysql", serv.Address)
func (m *Mysql) gatherServer(serv string, acc plugins.Accumulator) error {
db, err := sql.Open("mysql", serv)
if err != nil {
return err
}