Skip to content

Commit

Permalink
fix metrics proxysql global status
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicola Strappazzon C committed Jul 8, 2020
1 parent fc18345 commit 0d2c39c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion command/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

// Version is a const to have the latest version number for this code.
const Number string = "1.4.2"
const Number string = "1.4.3"

// Build date and time when building.
var BuildTime string
Expand Down
26 changes: 15 additions & 11 deletions plugins/inputs/proxysql/global/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,30 @@ func (l *InputProxySQLGlobal) Collect() {
p.Connect(config.File.Inputs.ProxySQL[host].DSN)

var r = p.Query(querySQLGlobal)
if len(r) == 0 {
continue
}

var v = []metrics.Value{}

for _, i := range r {
if value, ok := mysql.ParseValue(i["Variable_Value"]); ok {
log.Debug("InputProxySQLGlobal", map[string]interface{}{
"attribute": i["Variable_name"],
"value": value,
i["Variable_Name"]: value,
"hostname": config.File.Inputs.ProxySQL[host].Hostname,
})

a.Add(metrics.Metric{
Key: "proxysql_global",
Tags: []metrics.Tag{
{"hostname", config.File.Inputs.ProxySQL[host].Hostname},
},
Values: []metrics.Value{
{i["Variable_Name"], value},
},
})
v = append(v, metrics.Value{i["Variable_Name"], value})
}
}

a.Add(metrics.Metric{
Key: "proxysql_global",
Tags: []metrics.Tag{
{"hostname", config.File.Inputs.ProxySQL[host].Hostname},
},
Values: v,
})
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/outputs/influxdb/influxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (l *OutputIndluxDB) Collect() {
time.Now(),
)

log.Debug("OutputIndluxDB", m["fields"].(map[string]interface{}))
log.Debug(fmt.Sprintf("OutputIndluxDB\t%s", k), m["fields"].(map[string]interface{}))

if err != nil {
log.Error("OutputIndluxDB", map[string]interface{}{"step": "event", "error": err})
Expand Down

0 comments on commit 0d2c39c

Please sign in to comment.