gosdk/metric/config.go

32 lines
388 B
Go

package metric
var (
serv *service
)
type Config struct {
Address string
Username string
Password string
Database string
Interval int
}
func NewConfg() *Config {
return &Config{
Address: "http://10.0.0.131:8086",
Interval: 10,
Database: "telegraf",
}
}
func Init(c *Config) error {
if serv != nil {
return nil
}
serv = NewService(c)
go serv.run()
return nil
}