Running PMM1 and PMM2 Clients on the Same Host

Running PMM1 and PMM2 ClientsWant to try out Percona Monitoring and Management 2 (PMM 2) but you’re not ready to turn off your PMM 1 environment?  This blog is for you! Keep in mind that the methods described are not intended to be a long-term migration strategy, but rather, simply a way to deploy a few clients in order to sample PMM 2 before you commit to the upgrade. 🙂

Here are step-by-step instructions for deploying PMM 1 & 2 client functionality i.e. pmm-client and pmm2-client, on the same host.

  1. Deploy PMM 1 on Server1 (you’ve probably already done this)
  2. Install and setup pmm-client for connectivity to Server1
  3. Deploy PMM 2 on Server2
  4. Install and setup pmm2-client for connectivity to Server2
  5. Remove pmm-client and switched completely to pmm2-client

The first few steps are already described in our PMM1 documentation so we are simply providing links to those documents.  Here we’ll focus on steps 4 and 5.

Install and Setup pmm2-client Connectivity to Server2

It’s not possible to install both clients from a repository at the same time. So you’ll need to download a tarball of pmm2-client. Here’s a link to the latest version directly from our site.

Download pmm2-client Tarball

* Note that depending on when you’re seeing this, the commands below may not be for the latest version, so the commands may need to be updated for the version you downloaded.

Extract Files From pmm2-client Tarball

Register and Generate Configuration File

Now it’s time to set up a PMM 2 client. In our example, the PMM2 server IP is 172.17.0.2 and the monitored host IP is 172.17.0.1.

Start pmm-agent

Let’s run the pmm-agent using a screen.  There’s no service manager integration when deploying alongside pmm-client, so if your server restarts, pmm-agent won’t automatically resume.

Check the Current State of the Agent

Add MySQL Service

Detach the screen, then add the mysql service:

Here is the state of pmm-agent:

Confirm you can see activity in each of the two PMM Servers:

PMM 1PMM 2

Remove pmm-client and Switch Completely to pmm2-client

Once you’ve decided to move over completely to PMM2, it’s better to make a switch from the tarball version to installation from the repository. It will allow you to perform client updates much easier as well as register the new agent as a service for automatically starting with the server. Also, we will show you how to make a switch without re-adding monitored instances.

Configure Percona Repositories

Here is a link to the apt variant.

Remove pmm-client

Install pmm2-client

Configure pmm2-client

Let’s copy the currently used pmm2-client configuration file in order to omit re-adding monitored instances.

It’s required to set the new location of exporters (/usr/local/percona/pmm2/exporters/) in the file.

The default configuration file has to be replaced by our file and the service pmm-agent has to be restarted.

Check Monitored Services

So now we can verify the current state of monitored instances.

Also, it can be checked on PMM server-side.

Share this post

Comments (8)

  • Kirill Reply

    Hi
    I installed PMM2

    But i can’t add mysql agent, have error:

    DEBUG 2019-12-16 16:15:23.107100383Z: HTTP/1.1 400 Bad Request
    Transfer-Encoding: chunked
    Trailer: Grpc-Trailer-Content-Type
    Connection: keep-alive
    Content-Type: application/json
    Date: Mon, 16 Dec 2019 16:15:23 GMT
    Server: nginx

    be
    {“error”:”Connection check failed: dial tcp 127.0.0.1:3306: connect: connection refused.”,”code”:9,”message”:”Connection check failed: dial tcp 127.0.0.1:3306: connect: connection refused.”}
    0

    DEBUG 2019-12-16 16:15:23.107172147Z: Result:
    DEBUG 2019-12-16 16:15:23.107186033Z: Error: &my_sql.AddMySQLDefault{_statusCode:400, Payload:(*my_sql.AddMySQLDefaultBody)(0xc0005d9440)}
    Connection check failed: dial tcp 127.0.0.1:3306: connect: connection refused.

    December 16, 2019 at 11:32 am
    • Vadim Yalovets Reply

      Hi Kirill,

      It looks like your server doesn’t allow access through the default mysql port 3306 or mysql service is configured on a different port. Could you check it and try with a different port?

      e.g.
      $ ./bin/pmm-admin add mysql myMySQLService 127.0.0.1:3307

      Please notice that a service name has to be specify before an address

      December 17, 2019 at 10:28 am
      • Kirill Reply

        ok, i found trouble, thanks

        and have small question
        why pmm2 don’t have option for connections on socket ?

        December 18, 2019 at 5:45 am
        • Vadim Yalovets Reply

          It will be add in some later releases.

          December 18, 2019 at 6:09 am
  • Daniel Guzmán Burgos Reply

    Hi Vadim, thanks for the info! couple of comments:

    1. The section “Register and Generate Configuration File” have a problem: you are repeating the directory name in the path. For example, instead of “$PWD/pmm2-client-2.1.0/bin/node_exporter” it should be “$PWD/bin/node_exporter”. Full command fixed:

    ./bin/pmm-agent setup –config-file=config/pmm-agent.yaml \
    –paths-node_exporter=”$PWD/bin/node_exporter” \
    –paths-mysqld_exporter=”$PWD/bin/mysqld_exporter” \
    –paths-mongodb_exporter=”$PWD/bin/mongodb_exporter” \
    –paths-postgres_exporter=”$PWD/bin/postgres_exporter” \
    –paths-proxysql_exporter=”$PWD/bin/proxysql_exporter” \
    –server-insecure-tls –server-address=172.17.0.2:443 \
    –server-username=admin –server-password=”admin” 172.17.0.1 generic node8.ca

    2. And the other is that, if pmm-client (for PMM 1) is already running, the 42000 port is already in use and the PMM2 client will keep trying to connect to it but it won’t. The fix is to edit the config/pmm-agent.yaml and change the starting port. It will look like this:

    ports:
    min: 42005
    max: 51999

    December 17, 2019 at 10:59 am
    • Vadim Yalovets Reply

      Thank you for your comments. You are right.

      December 17, 2019 at 3:31 pm
  • smit Reply

    Hi, I always got waiting state no values are fetched to grafana
    node_exporter waiting /agent_id/a7130b1a-cb43-499a-a0a3-e6d9840566dd
    mysqld_exporter waiting /agent_id/5fcdf261-3e74-47ad-8196-76de02f7a63f /service_id/81584871-9ea0-4844-a414-2d989884986b

    January 21, 2020 at 2:26 am
    • Vadim Yalovets Reply

      Hello Smit,

      Could you make sure that exporters have the correct path in the configuration file pmm-agent.yaml?
      It looks like pmm-agent can’t start exporters.

      January 22, 2020 at 4:05 pm

Leave a Reply