Not the answer you need?
Register and ask your own question!

Building pmm-client from source

gordangordan EntrantCurrent User Role Supporter
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 node_exporter-fe47433, which seems to be the PMM-1.X branch of 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 --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.

Best Answer


  • Mykyta.SolomkoMykyta.Solomko Inactive User Role
    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.)
  • gordangordan Entrant Current User Role Supporter
    edited July 21
    Hi @Mykyta.Solomko, thanks for responding.
    I'm trying to build pmm-client 1.17.4 from the sources provided in this tarball:
    In that tarball there is another tarball:
    which seems to contain the code that exactly corresponds to the tip of the PMM-1.X branch here:
    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/
    tar -C /home/mock/go/src/ -zxf node_exporter-fe47433.tar.gz
    tar -C /home/mock/go/src/ -zxf mongodb_exporter-9fd6f88.tar.gz
    tar -C /home/mock/go/src/ -zxf postgres_exporter-3017fce.tar.gz
    tar -C /home/mock/go/src/ -zxf proxysql_exporter-bbd1471.tar.gz
    tar -C /home/mock/go/src/ -zxf pmm-client-38b8313.tar.gz
    tar -C /home/mock/go/src/ -zxf mysqld_exporter-491e5e4.tar.gz
    tar -C /home/mock/go/src/ -zxf percona-toolkit-a4db86e0.tar.gz
    tar -C /home/mock/go/src/ -zxf pid-watchdog-2a86cf7.tar.gz
    tar -C /home/mock/go/src/ -zxf qan-agent-9399e1f.tar.gz
    cd $GOPATH/src/
    mv node_exporter-fe47433 node_exporter
    mv mongodb_exporter-9fd6f88 mongodb_exporter
    mv postgres_exporter-3017fce postgres_exporter
    mv proxysql_exporter-bbd1471 proxysql_exporter
    mv pmm-client-38b8313 pmm-client
    mv mysqld_exporter-491e5e4 mysqld_exporter
    mv percona-toolkit-a4db86e0 percona-toolkit
    mv pid-watchdog-2a86cf7 pid-watchdog
    mv 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:
    and extracted it into $GOPATH/src/

    And finally:
    cd $GOPATH/src/
    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
                                    Address on which to expose metrics and web
    The binary from the package:

    $ /usr/local/percona/pmm-client/node_exporter --help 2>&1 | grep web
      -web.auth-file string
      -web.listen-address string
        Address on which to expose metrics and web interface. (default ":9100")
      -web.ssl-cert-file string
      -web.ssl-key-file string
      -web.telemetry-path string

    Clearly not the same.
    So - which sources do I need to produce the binary that percona ships?
  • gordangordan Entrant Current User Role Supporter
    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:
    Specifically, the trick is to build against itself also copied/symlinked to

    @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?
  • Mykyta.SolomkoMykyta.Solomko Inactive User Role
    @gordan percona-node_exporter itself is just a fork of official node_exporter but with PMM-related patches. Hence, some of deps are pointing to vanilla node_exporter.
  • gordangordan Entrant Current User Role Supporter
    @Mykyta.Solomko  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.

Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.