Skip to:
PMM won't be able to detect version of MySQL (or any other software) if it's not located in the same $PATH as agent is started with.
Steps to reproduce:
01) Set up MySQL outside of $PATH (sandbox, for instance).
02) Check what binaries pmm-agent is looking for when executing:
https://github.com/percona/pmm/blob/main/agent/versioner/versioner.go#L87-L152
"strace output"
[pid 169396] newfstatat(AT_FDCWD, "/usr/local/sbin/mysqld", <unfinished ...> [pid 169396] newfstatat(AT_FDCWD, "/usr/local/bin/mysqld", 0xc00012afa8, 0) = -1 ENOENT (Nie ma takiego pliku ani katalogu) [pid 169396] newfstatat(AT_FDCWD, "/usr/sbin/mysqld", 0xc00012b078, 0) = -1 ENOENT (Nie ma takiego pliku ani katalogu) [pid 169396] newfstatat(AT_FDCWD, "/usr/bin/mysqld", <unfinished ...> [pid 169396] newfstatat(AT_FDCWD, "/sbin/mysqld", <unfinished ...> [pid 169396] newfstatat(AT_FDCWD, "/bin/mysqld", <unfinished ...> [pid 169396] newfstatat(AT_FDCWD, "/snap/bin/mysqld", 0xc00012b3b8, 0) = -1 ENOENT (Nie ma takiego pliku ani katalogu)
The main reason for that is that under the hood the below is used:
https://github.com/golang/go/blob/master/src/os/exec/lp_unix.go#L64-L81
PMM won't be able to detect version of MySQL (or any other software) if it's not located in the same $PATH as agent is started with.
Steps to reproduce:
01) Set up MySQL outside of $PATH (sandbox, for instance).
02) Check what binaries pmm-agent is looking for when executing:
https://github.com/percona/pmm/blob/main/agent/versioner/versioner.go#L87-L152
"strace output"
[pid 169396] newfstatat(AT_FDCWD, "/usr/local/sbin/mysqld", <unfinished ...> [pid 169396] newfstatat(AT_FDCWD, "/usr/local/bin/mysqld", 0xc00012afa8, 0) = -1 ENOENT (Nie ma takiego pliku ani katalogu) [pid 169396] newfstatat(AT_FDCWD, "/usr/sbin/mysqld", 0xc00012b078, 0) = -1 ENOENT (Nie ma takiego pliku ani katalogu) [pid 169396] newfstatat(AT_FDCWD, "/usr/bin/mysqld", <unfinished ...> [pid 169396] newfstatat(AT_FDCWD, "/sbin/mysqld", <unfinished ...> [pid 169396] newfstatat(AT_FDCWD, "/bin/mysqld", <unfinished ...> [pid 169396] newfstatat(AT_FDCWD, "/snap/bin/mysqld", 0xc00012b3b8, 0) = -1 ENOENT (Nie ma takiego pliku ani katalogu)
The main reason for that is that under the hood the below is used:
https://github.com/golang/go/blob/master/src/os/exec/lp_unix.go#L64-L81