How to make pmm agent binary file


[Detailed description of the issue or question]

I want to modify the mySQL directory path of the pmm agent.
So, I want to download the source code and re-create it as a binary file after modifying it.
The binary file of the pmm agent is statically link, and I want to know how you made the go language statically link.

Steps to Reproduce:

[Step-by-step instructions on how to reproduce the issue, including any specific settings or configurations]
i downloaded pmm agent source code
here : GitHub - percona/pmm-agent: pmm-agent for PMM 2.x.

go build -o /go/bin/myapp -a -ldflags '-extldflags "-static"'

i tried this, but got this fail log, but the library below already exists in OS

GitHub - percona/pmm-agent: pmm-agent for PMM 2.x.

/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lresolv
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status


[Insert the version number of the software]


[If applicable, include any relevant log files or error messages]

Expected Result:

[What the user expected to see or happen before the issue occurred]

Actual Result:

[What actually happened when the user encountered the issue]

Additional Information:

[Include any additional information that could be helpful to diagnose the issue, such as browser or device information]

화면 캡처 2023-09-25 115820

@pmmChobo, you should use the current repo GitHub - percona/pmm: Percona Monitoring and Management: an open source database monitoring, observability and management tool the mentioned one is archived a year ago, so it is not maintained.
Please see for instructions to build all components.

Did you check if there is not already a flag for this? I’ve installed PMM-Agent on many customer machines with different datadirs and I’ve never needed to custom-compile the agent. The pmm-agent for mysql should automatically pick up the changed datadir. ex: SELECT @@datadir

First of all, thank you for your reply.

It is correct that the pmm-agent recognizes the changed datadir is correct.
However, there is a problem that the xtrabackup does not recognize the changed datadir when restoring and does not recognize the default datadir, /var/lib/mysql.

It was difficult to change the command in the middle because it was a pmm server that gave the command to xtrabackup, so we decided to modify the binary file.

That’s a bug. You should file that at and provide our enginners with step-by-step of what you are doing so they can correct this in the next version of PMM.

but i cannot wait until next version…

I understand that you can’t wait, but letting our engineers know about this situation will help improve PMM for everyone in the future. For you, when the next version comes out, you won’t have to bother recompiling.

I registered the issue on jira on 10/4 with PMM-12559, but no representative has been assigned yet.
The version has also been upgraded by two levels, can you tell me when it will be patched?

thank you.