Skip to content

Commit

Permalink
verify exist aurora table to collect all data first
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicola Strappazzon C committed Jun 22, 2020
1 parent 69ba7ba commit 870aba3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/inputs/mysql/aurora/aurora.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,17 @@ func (l *MySQLAurora) Collect() {

m.Connect(config.File.Inputs.MySQL[host].DSN)

var c = m.Query("SELECT 1 FROM information_schema.TABLES WHERE (TABLE_SCHEMA = 'mysql') AND (TABLE_NAME = 'ro_replica_status')")
if len(c) == 0 {
continue
}

var r = m.Query(query)

if len(r) == 0 {
continue
}

for column := range r[0] {
if value, ok := mysql.ParseValue(r[0][column]); ok {
log.Debug("InputMySQLAurora", map[string]interface{}{"attribute": column, "value": value})
Expand Down

0 comments on commit 870aba3

Please sign in to comment.