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

Building pmm-client from source

gordangordan EntrantCurrent User Role Contributor
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 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 --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

Answers

  • Mykyta.SolomkoMykyta.Solomko Percona Staff Role Poster
    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 Contributor
    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:
    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
    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.gz
    tar -C /home/mock/go/src/github.com/percona -zxf pmm-client-38b8313.tar.gz
    tar -C /home/mock/go/src/github.com/percona -zxf mysqld_exporter-491e5e4.tar.gz
    tar -C /home/mock/go/src/github.com/percona -zxf percona-toolkit-a4db86e0.tar.gz
    tar -C /home/mock/go/src/github.com/percona -zxf pid-watchdog-2a86cf7.tar.gz
    tar -C /home/mock/go/src/github.com/percona -zxf qan-agent-9399e1f.tar.gz
    cd $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_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:
    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
          --web.listen-address=":9100"  
                                    Address on which to expose metrics and web
          --web.telemetry-path="/metrics"  
    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 Contributor
    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
    Specifically, the trick is to build github.com/percona/node_exporter against itself also copied/symlinked to 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?
  • Mykyta.SolomkoMykyta.Solomko Percona Staff Role Poster
    @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 Contributor
    @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.