Quantcast
Channel: Percona Database Performance Blog
Viewing all articles
Browse latest Browse all 1785

Update Percona Monitoring and Management Agent Settings for Already-Added Instances

$
0
0
alternative approach to re-adding a MySQL instance

When adding a remote MySQL instance to Percona Monitoring and Management (PMM), there are a few options you can specify during the setup, but they are not editable once added. For example, a table statistics limit is introduced to avoid querying information_schema.tables that may impact DB performance, especially with a high number of DBs / tables present in an instance.

table statistics limit

What if you want to change the value later on? One way to do this is to remove the instance and add it back, but you’ll lose some stats/historical data.

It is nice to have the ability to change settings from GUI, but when you don’t have it, a little hack here and there can save the day. Also, it might give a bit of that excitement when you wonder: “What’s inside that toy?” Let’s roll up our sleeves and do it safely without breaking the toy.

Below is an example of an alternative approach to re-adding the instance. In the example, we run PMM server in a docker container.

1. Let’s get inside the container first:

sudo docker exec -it [container_id] /bin/bash

 

If you don’t know the container id, run the following:

sudo docker ps

 

2. Once inside, login to the PostgreSQL database (that’s where PMM keeps some of the settings):

psql -U pmm-managed

Switch to vertical output for the sake of readability, analog to using \G in MySQL at the end of the query or running mysql with -E key, but in PostgreSQL, it is a setting:

pmm-managed=> \x
Expanded display is on.

 

3. Check what agents you want to update:

pmm-managed=> select agent_id, agent_type, runs_on_node_id, table_count_tablestats_group_limit from agents where agent_type = 'mysqld_exporter';
-[ RECORD 1 ]----------------------+-----------------------------------------------
agent_id                           | /agent_id/cb7c37c2-e45f-4fc5-b466-e08925ebbd4c
agent_type                         | mysqld_exporter
runs_on_node_id                    | 
table_count_tablestats_group_limit | 1000
-[ RECORD 2 ]----------------------+-----------------------------------------------
agent_id                           | /agent_id/90f617f7-e9c9-4e21-b226-c4290bf7fa2d
agent_type                         | mysqld_exporter
runs_on_node_id                    | 
table_count_tablestats_group_limit | 1000

 

4. Update settings for the required agent(s):

pmm-managed=> update agents set table_count_tablestats_group_limit = 2000 where agent_id = '/agent_id/cb7c37c2-e45f-4fc5-b466-e08925ebbd4c';
UPDATE 1

 

Check:

pmm-managed=> select agent_id, agent_type, runs_on_node_id, table_count_tablestats_group_limit from agents where agent_id = '/agent_id/cb7c37c2-e45f-4fc5-b466-e08925ebbd4c';
-[ RECORD 1 ]----------------------+-----------------------------------------------
agent_id                           | /agent_id/cb7c37c2-e45f-4fc5-b466-e08925ebbd4c
agent_type                         | mysqld_exporter
runs_on_node_id                    | 
table_count_tablestats_group_limit | 2000

 

5. Restart the PMM agent in the PMM server container:

supervisorctl restart pmm-agent

 

Conclusion

So, we can see it is possible to fine-tune some hidden settings of Percona Monitoring and Management by getting into its internals, including editing some options after adding a remote MySQL instance without having to remove and re-add the instance.

I hope you find the article useful and somewhat entertaining. Also, if you feel a PMM feature is missing, you can file an enhancement request in our bugtracker.

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


Viewing all articles
Browse latest Browse all 1785

Trending Articles