# Building pmm-client from source

**URL:** <https://forums.percona.com/t/building-pmm-client-from-source/7786>\
**Category:** PMM 1.x\
**Created:** [July 17, 2020, 6:08pm UTC](https://forums.percona.com/t/building-pmm-client-from-source/7786 "2020-07-17T18:08:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gordan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/gordan/32/3438_2.png) [@gordan](https://forums.percona.com/u/gordan)\
**Post date:** [July 17, 2020, 6:08pm UTC](https://forums.percona.com/t/building-pmm-client-from-source/7786/1 "2020-07-17T18:08:26Z")

</div>

I’m trying to build pmm-client from source, and I have managed to get it to build, but not work, at least not the way the binaries work. The key problem seems to be around building node exporter. The source tarball includes&nbsp;node\_exporter-fe47433, which seems to be the PMM-1.X branch of [GitHub - percona/node\_exporter: Exporter for machine metrics](http://github.com/percona/node_exporter). This won’t build on it’s own since it seems to have a dependency on prometheus/node\_exporter. I have managed to find versions that it will build with, but the resulting node\_exporter created with “make build” doesn’t understand the proprietary parameters such as&nbsp;–web.auth-file=/usr/local/percona/pmm-client/pmm.yml  
  
Is PMM-1.X branch node\_exporter the correct one? How do you build it in a way that makes it understand the additional command line parameters needed?  
  
I also tried building the 0.17.0+percona.1 tagged version of percona/node\_exporter, and this sort of almost works, but it isn’t collecting most of the metrics.  
  
All of this seems to imply that the supplied node\_exporter-fe47433 snapshot code isn’t the code that the binary package downloadable from the percona site was built from.

---

<div class="post-metadata">

**Author:** ![Mykyta.Solomko](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@Mykyta.Solomko](https://forums.percona.com/u/Mykyta.Solomko)\
**Post date:** [July 21, 2020, 8:50am UTC](https://forums.percona.com/t/building-pmm-client-from-source/7786/2 "2020-07-21T08:50:21Z")

</div>

Hi Gordan,  
I have some of questions:

- What exact version of PMM client you are trying to build?
- Where did you obtain sources, that you’re trying to build?
- Could you please provide steps for us to reproduce? (base OS, golang version and commands, etc.)

---

<div class="post-metadata">

**Author:** ![gordan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/gordan/32/3438_2.png) [@gordan](https://forums.percona.com/u/gordan)\
**Post date:** [July 21, 2020, 10:51am UTC](https://forums.percona.com/t/building-pmm-client-from-source/7786/3 "2020-07-21T10:51:11Z")

</div>

Hi @“Mykyta.Solomko”, thanks for responding.  
I’m trying to build pmm-client 1.17.4 from the sources provided in this tarball:  
[https://www.percona.com/downloads/pmm/1.17.4/source/tarball/pmm-client-1.17.4.tar.gz](https://www.percona.com/downloads/pmm/1.17.4/source/tarball/pmm-client-1.17.4.tar.gz)  
In that tarball there is another tarball:  
pmm-client-1.17.4/node\_exporter-fe47433.tar.gz  
which seems to contain the code that exactly corresponds to the tip of the PMM-1.X branch here:  
[https://github.com/percona/node\_exporter/tree/pmm-1.X](https://github.com/percona/node_exporter/tree/pmm-1.X)  
But building this doesn’t produce the binary of same functionality.  
  
Process I am using is:  
tar -zxvf pmm-client-1.17.4.tar.gz  
cd pmm-client-1.17.4  
export GOPATH=/home/mock/go/usr/bin/mkdir -p /home/mock/go/src/github.com/percona  
tar -C /home/mock/go/src/github.com/percona -zxf node\_exporter-fe47433.tar.gz  
tar -C /home/mock/go/src/github.com/percona -zxf mongodb\_exporter-9fd6f88.tar.gz  
tar -C /home/mock/go/src/github.com/percona -zxf postgres\_exporter-3017fce.tar.gz  
tar -C /home/mock/go/src/github.com/percona -zxf proxysql\_exporter-bbd1471.tar.gztar -C /home/mock/go/src/github.com/percona -zxf pmm-client-38b8313.tar.gztar -C /home/mock/go/src/github.com/percona -zxf mysqld\_exporter-491e5e4.tar.gztar -C /home/mock/go/src/github.com/percona -zxf percona-toolkit-a4db86e0.tar.gztar -C /home/mock/go/src/github.com/percona -zxf pid-watchdog-2a86cf7.tar.gztar -C /home/mock/go/src/github.com/percona -zxf qan-agent-9399e1f.tar.gzcd $GOPATH/src/github.com/percona/  
mv node\_exporter-fe47433 node\_exporter  
mv mongodb\_exporter-9fd6f88 mongodb\_exporter  
mv postgres\_exporter-3017fce postgres\_exporter  
mv proxysql\_exporter-bbd1471 proxysql\_exportermv pmm-client-38b8313 pmm-clientmv mysqld\_exporter-491e5e4 mysqld\_exportermv percona-toolkit-a4db86e0 percona-toolkitmv pid-watchdog-2a86cf7 pid-watchdogmv qan-agent-9399e1f qan-agent  
The prometheus/node\_exporter dependency is missing and it isn’t entirely clear which version should be used, The ones later than 0.17 seem to result in percona/node\_exporter not building, so I used this 0.17.0:  
[https://github.com/prometheus/node\_exporter/archive/v0.17.0.tar.gz](https://github.com/prometheus/node_exporter/archive/v0.17.0.tar.gz)  
and extracted it into $GOPATH/src/github.com/prometheus/node\_exporter  
  
And finally:  
cd $GOPATH/src/github.com/percona/node\_exporter  
make build  
  
This gets me a working node\_exporter binary, but it most obviously isn’t similar to the binary that ships in the binary pmm-client package.  
  
The binary I just built:  
$ ./node\_exporter --help 2\>&1 | grep web&nbsp; &nbsp; &nbsp; --web.listen-address=“:9100”&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Address on which to expose metrics and web&nbsp; &nbsp; &nbsp; --web.telemetry-path=“/metrics”&nbsp;&nbsp;The binary from the package:  
  
$ /usr/local/percona/pmm-client/node\_exporter --help 2\>&1 | grep web&nbsp; -web.auth-file string&nbsp; -web.listen-address string&nbsp; &nbsp; Address on which to expose metrics and web interface. (default “:9100”)&nbsp; -web.ssl-cert-file string&nbsp; -web.ssl-key-file string&nbsp; -web.telemetry-path string  
Clearly not the same.  
So - which sources do I need to produce the binary that percona ships?

---

<div class="post-metadata">

**Author:** ![Roma\_Novikov](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/roma_novikov/32/1161_2.png) [@Roma\_Novikov](https://forums.percona.com/u/Roma_Novikov)\
**Post date:** [July 22, 2020, 3:37am UTC](https://forums.percona.com/t/building-pmm-client-from-source/7786/4 "2020-07-22T03:37:19Z")

</div>

@gordan,&nbsp; pls see&nbsp;[https://github.com/percona-lab/pmm-submodules](https://github.com/percona-lab/pmm-submodules)&nbsp; this is repo where all pmm build scripts are.&nbsp; This is what we are using to build pmm.&nbsp;

---

<div class="post-metadata">

**Author:** ![gordan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/gordan/32/3438_2.png) [@gordan](https://forums.percona.com/u/gordan)\
**Post date:** [July 22, 2020, 4:39am UTC](https://forums.percona.com/t/building-pmm-client-from-source/7786/5 "2020-07-22T04:39:30Z")

</div>

Thanks @“roma.novikov”, that was most helpful indeed. 🙂  
For anyone who finds this page by googling it in the future, the clue was in here:  
[github.com/percona/pmm-submondules/build/bin/build-client-binary](http://github.com/percona/pmm-submondules/build/bin/build-client-binary)  
Specifically, the trick is to build [GitHub - percona/node\_exporter: Exporter for machine metrics](http://github.com/percona/node_exporter) against itself also copied/symlinked to [GitHub - prometheus/node\_exporter: Exporter for machine metrics](http://github.com/prometheus/node_exporter)  
  
@“roma.novikov”, @“Mykyta.Solomko”, is this not arguably a bug? That percona/node\_exporter has a spurious external dependency on prometheus/node\_exporter which it quite obviously brings everything it needs itself?

---

<div class="post-metadata">

**Author:** ![Mykyta.Solomko](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@Mykyta.Solomko](https://forums.percona.com/u/Mykyta.Solomko)\
**Post date:** [July 31, 2020, 3:15am UTC](https://forums.percona.com/t/building-pmm-client-from-source/7786/6 "2020-07-31T03:15:45Z")

</div>

@gordan [percona-node\_exporter](https://github.com/percona/node_exporter/tree/pmm-1.X) itself is just a fork of official node\_exporter but with PMM-related patches. Hence, some of deps are pointing to vanilla node\_exporter.

---

<div class="post-metadata">

**Author:** ![gordan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/gordan/32/3438_2.png) [@gordan](https://forums.percona.com/u/gordan)\
**Post date:** [July 31, 2020, 4:41am UTC](https://forums.percona.com/t/building-pmm-client-from-source/7786/7 "2020-07-31T04:41:06Z")

</div>

@“Mykyta.Solomko”&nbsp; I think you misunderstood what I meant. I mean if I build it against upstream node\_exporter, it doesn’t work. If I use the PMM node exporter as the dependency for itself it does work. It says it has an upstream dependency on node\_exporter, but unless you manually put a copy of itself in the upstream node\_exporter dependency path, the version that gets built doesn’t work. That’s what I meant when I said that you have to build it against itself as it’s own dependency, rather than against the upstream node\_exporter.
