DataDog/dd-agent — pull request #576 by LotharSee (2013-07-12 22:14:29+00:00)
Title: Mysql check improvements

I already did some changes in the code of MySQL check since 3.8.0 (bugfixes: https://github.com/DataDog/dd-agent/commit/68975c50405ce5c1a84e55b171d9fea891d6042e, https://github.com/DataDog/dd-agent/commit/ddc56aaf38c3b44b9c1126636b5468e8c01d2407, refactoring: https://github.com/DataDog/dd-agent/commit/5517c79c631d97d4b27090cf76ab7a8907e6a928), but this time I do a PR to discuss about it.

This PR closes #575, it adds port as an configuration parameter. It shouldn't be a problem.

It also provides a solution for #442 / # 448. It concerns system metrics for MySQL, the issue is well described in the previous 2 tickets.
Instead of adding a parameter in the configuration to collect these metrics, I collect them only if I am sure they will be right:
* Server connection on UNIX socket / localhost : be sure that the server is running locally
* Get pid from `ps` only if it returns only 1 result, avoid error in case of multiple server instances
* Get pid from `ps` only on linux: no way to filter precisely on FreeBSD and Darwin
* An exception during the opening of the `/proc/` file (no permission, file doesn't exist) isn't an error
* Don't display warning if system metrics aren't collected

That's a proposal. @clutchski, @remh, tell me what you think about it.