8

Simplify the Use of ENV Variables in Percona Monitoring and Management AMI

 1 year ago
source link: https://www.percona.com/blog/simplify-use-of-env-variables-in-percona-monitoring-and-management-ami/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Simplify the Use of ENV Variables in Percona Monitoring and Management AMI

February 1, 2024

Nurlan Moldomurov

The Percona Monitoring and Management (PMM) Amazon Machine Image (AMI) currently lacks native support for ENV variables. In this guide, we’ll walk through a straightforward workaround that simplifies the process of using ENV variables in PMM AMI and reapplying them after an upgrade.

Step one: Adding ENV variables to /srv/.env

Begin by consolidating your ENV variables in the /srv/.env file. Edit the file and add your variables, like so:

Environment file (/srv.env)
Shell
PMM_DEBUG=1
DATA_RETENTION=2160h

Step two: Using systemctl edit for systemd service

To avoid directly modifying the /usr/lib/systemd/system/supervisord.service file, which could be overwritten during system upgrades, leverage systemctl edit for a more sustainable approach. Open a terminal and run:

Shell
sudo systemctl edit supervisord.service
This command opens an editor for creating an override file. Add the following lines to set the environment file:
[Service]
EnvironmentFile=/srv/.env
Save and exit the editor.

Step three: Restarting the supervisord service

After applying the changes, restart the supervisord service:

sudo systemctl daemon-reload
sudo systemctl restart supervisord
Post-upgrade consideration

While PMM currently rewrites /usr/lib/systemd/system/supervisord.service on each upgrade, the modifications made using systemctl edit remain safeguarded.

By adopting the systemctl edit approach, your ENV variable setup remains intact, offering a cleaner and more maintainable configuration for your PMM AMI.

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

Share This Post!

Subscribe
Connect with
guest
Label
0 Comments

</div


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK