Bug #73642 The agent should search in the datadir for the pid-file
Submitted: 19 Aug 2014 12:07 Modified: 30 Dec 2014 15:02
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Enterprise Monitor: Agent Severity:S3 (Non-critical)
Version:3.0.13.3026 OS:Any
Assigned to: CPU Architecture:Any

[19 Aug 2014 12:07] Daniël van Eeden
Description:
The MEM agent connects to a monitored database instance and does something like "select @@pid_file" to find the pid-file.

This works if the pid_file is an absolute path (/path/to/mysqld.pid), but not if it is a relative path (mysqld.pid)

This is used if mysqld and/or mysqld_safe is not running with --datadir and other options required to match a monitored instance with an instance found in the processlist.

If running with an pid-file with a relative path:
WARN com.mysql.etools.agent.collection.mysql.MysqlProcessProvider: Unable to read PID file: mysqld.pid (No such file or directory) 

How to repeat:
Run /some/location/mysqld --defaults-file=/foo/my.cnf
The my.cnf must have "pid_file=mysqld.pid"
Then start an mem agent.

Suggested fix:
If the path is relative it should serch in @@datadir for the pid file.
[20 Aug 2014 8:07] MySQL Verification Team
Thank you for the bug report. Verified based on internal discussion with dev's.
[30 Dec 2014 15:02] Daniël van Eeden
With mcm (MySQL Cluster Manager) 1.3.3 mysqld is started as child of mcmd and not via mysqld_safe. Then mem can also have issues with finding the pid.

$ ptree $(pgrep -x mcmd)
24427 /foo/mcmd --pl
  24626 /bar/bin/ndbd --ndb-connectstring=mysql1:1186 --nd
  24675 /bar/bin/mysqld --defaults-file=/baz/