Golang sensu/graphite plugin to get all metrics from mysql 'show global status'
I'm sick of ruby plugins that require a lot of dependiences, so I made my script in goLang to get all variables from mysql show global status to sensu (and then to graphite).
Yep, It's my first Go program, so it's not the nicest - but it works
Compile is simple:
go build sensu-mysql-metrics.go
Usage is even simpler:
./sensu-mysql-metrics -username="monitoring" -password="some_password"
For more options just use
./sensu-mysql-metrics --help
Example sensu file:
{
"checks": {
"mysql_graphite_metrics": {
"type": "metric",
"command": "sensu-mysql-metrics -host=':::mysql.host:::' -port=':::mysql.port:::' -username=':::mysql.user:::' -password=':::mysql.password:::'",
"interval": 60,
"subscribers": ["mysql"],
"handlers": ["relay"]
}
}
}
and just add the config variables on client:
"mysql": {
"host": "localhost",
"port": 3306,
"user": "monitoring",
"password": "some_password"
}
If the mysql parameters are wrong there is an error:
panic: runtime error: invalid memory address or nil pointer dereference
Will fix it in my free time