Welcome to our guide on keeping your Percona Monitoring and Management (PMM) Server and Client up-to-date. In this blog post, we’ll walk you through a method to ensure your PMM solution runs the latest and most secure versions. It’s important to note that this is just one option among many, and we’re eager to hear your feedback and alternative approaches.

Maintaining an up-to-date PMM environment is crucial for accessing the latest features and ensuring maximum security. However, the update process can be complex and time-consuming. To simplify it, we’ll introduce you to a method involving Watchtower and cron jobs. Watchtower automates PMM Server updates, while cron jobs handle PMM Client updates.

We value your input and want to know if this approach works for you. Share your thoughts, suggestions, and alternative methods on our forum. Your feedback will help us improve the update process and provide better solutions for the PMM community.

Let’s explore the steps to install, configure, and automate the update process for your PMM Server and Client. Together, we can keep your monitoring solution up-to-date effortlessly and enhance its effectiveness.

Please remember this is not official documentation but a cookbook about easier PMM management. This method may not work in later versions.

PMM Server installation

Installing PMM is a straightforward process. You can refer to the instructions provided for detailed guidance.

To install PMM, you can use the following command:

This command will install Docker and the PMM server for you. However, when updating PMM, there are a few considerations to remember.

The recommended approach for updating PMM is to replace the Docker image. This method offers greater stability and ensures a clean installation of the latest version. To update, you must stop the current PMM server, obtain the new Docker image, and start a new instance. PMM will handle any necessary migrations during the startup process. While this method provides a more stable update, it does require additional steps, such as accessing the terminal and executing specific commands. This can be cumbersome, especially if you rely on IT support for such tasks.

Alternatively, you can use the Update button within the PMM server itself, which offers a more convenient solution for updating. This method simplifies the process by automating the update within the PMM user interface. You can find more details on this approach in our documentation.

Considering the trade-off between stability and convenience, the Docker image replacement method is recommended for ensuring a reliable update. However, choosing the approach that best suits your requirements and operational considerations is important.

Now, let’s explore automation options for simplifying the update process of our PMM Server.

PMM Server update automation

To automate the update process for your PMM Server, we’ll utilize a tool called Watchtower. Watchtower is designed to monitor your Docker container and update it automatically whenever a new image becomes available.

To get started with Watchtower, you can follow these steps:

1. Run the following command to start Watchtower:

2. That’s it! Watchtower is now actively monitoring your PMM Server container. It will regularly check for new versions of the pmm-server:2 image (used in the quick install script by default) every 24 hours. Watchtower automatically updates your PMM instance when a new image is detected, ensuring you have the latest version.

Please note that you should wait for the next official PMM release to be published before Watchtower can perform an update.

Watchtower simplifies the update process by eliminating the need for manual intervention and monitoring. It provides a convenient way to keep your PMM Server up-to-date with the latest releases, ensuring you have access to new features and security enhancements.

Next, let’s explore the process of updating the PMM Client and establishing a connection with the PMM Server.

PMM Client Installation and Сonfiguration

In addition to the PMM Server, the PMM Client is another critical component of the distributed PMM system. The PMM Client is required unless you are solely adding remote instances via the PMM Server, in which case the Client embedded in the PMM server itself is used and is always in sync with the PMM Server version.

To install the PMM Client, you can follow the instructions provided. This method uses the package manager on your system, offering a straightforward installation process that supports seamless upgrades.

Once the PMM Client is installed, it needs to be connected to the PMM Server. Use the following command to configure the connection:

Replace X.X.X.X with the IP address or hostname of your PMM Server. This command establishes the necessary settings for communication between the Client and Server.

After PMM Client is configured, you probably will add some Database into PMM.

PMM Client update automation

Automating the PMM Client upgrade process can be a bit complex due to version compatibility requirements with the PMM Server. A typical PMM Client upgrade process involves executing the following commands when a new version is released:

However, it’s crucial to note that the PMM Server should be the same version as, or newer than, the PMM Client. Therefore, you must upgrade the PMM Server first before updating the clients. This condition adds complexity to automating upgrades because it requires checking the server version to ensure compatibility.

To address this challenge, we can leverage the pmm-admin status command, which provides information about the Server and Client versions. By running pmm-admin status, you can obtain details such as the Server URL and version, as well as the Client’s connection status, version, and other relevant data.

To simplify automation, the pmm-admin command can expose data in JSON format using the --JSON flag. This allows for easier integration with automation scripts.

To assist you further, I have created a simple script that performs the PMM Client update process. You can find the script at this URL: https://gist.github.com/rnovikovP/e6d7d1dcda7f5004ad186f6bc4de565a . I recommend placing this script in the /usr/local/percona/pmm2/cron/ directory, which serves as a centralized location for all PMM-related files.

Once you have downloaded the script, the next step is configuring it to run automatically using cron. Here’s a simple one-liner that creates the necessary directory, downloads the script, sets the appropriate permissions, and adds a cron job to execute it daily at 8 AM:

This one-liner creates the necessary directory structure, downloads the script using curl, sets the script’s executable permission, and adds a cron job to execute the script at 8 AM daily.

By implementing this automation, the script will handle the PMM Client updates, checking for the latest version and upgrading the Client as needed. This saves you from manually executing the upgrade commands and ensures that your PMM Client is always up to date.

Next, we’ll review what we need to confirm for the automated updates process.

Update configuration confirmation

To ensure that your PMM update automation is functioning correctly, there are a few steps you can take. Since the configuration relies on officially released images and binaries, you will need to wait until the new version of PMM is officially released. Rest assured, the release is just around the corner.

Here’s what you can check in the meantime:

On the PMM Server, verify the running containers by executing the following command:
docker ps

You should see output similar to this:

This confirms that the PMM Server container is running successfully.

On the PMM Client, verify the cron job configuration by executing the following command:

You should see the following line in the output:

This confirms that the cron job for the PMM Client updater script is set to run daily at 8 AM.

Additionally, you can manually execute the updater script to confirm that it is functioning correctly:
/usr/local/percona/pmm2/cron/pmm2-client-updater.sh

Running this command should display the PMM Server and Client versions, which should match the following:

Ensure that both versions are the same, indicating a successful update.

If all the checks above align with the presented information, it means your PMM update automation is on track. Now, all you need to do is wait for the new PMM release and observe your PMM system’s updated state.

Closing

In conclusion, this blog post has provided a comprehensive guide on keeping your PMM Server and Client updated. While the methods discussed here are effective, we acknowledge that alternative approaches or better options may be available. We value your input and encourage you to share any additional techniques or ideas that could improve the update process for PMM.

One topic worth exploring is automating the update process for PMM and its components. Are you interested in auto-updates for PMM? We would love to hear your thoughts on this matter. Share your experiences, suggestions, or concerns on the forum.

Remember, staying up-to-date with the latest versions of PMM is crucial for maintaining maximum security and accessing the latest features. Your feedback and contributions are invaluable as we strive to provide the best solutions for the PMM community.

Thank you for reading, and we appreciate your engagement in improving the PMM update process. Together, we can make monitoring with PMM even more efficient and user-friendly.

If you want to share your experience using PMM  – please don’t hesitate to schedule a call with me using this link; I’m always open to hearing users’ pains to drive the product in the right direction.

Percona Monitoring and Management is a best-of-breed open source database monitoring solution. It helps you reduce complexity, optimize performance, and improve the security of your business-critical database environments, no matter where they are located or deployed.

 

Download Percona Monitoring and Management Today

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments