How to Add 150 of RDS Instances in PMM

I need to add 150 RDS instances. Is there a way to add this directly to the underlying Postgres database? Thanks.

Hi @brianestrada658

Welcome to the forum!

I would strongly discourage trying to bypass supported methods, but instead use the PMM API.
Here is an example of an Ansible task that could be modified to suit your requirements:

   - name: Add RDS server (PMMv2)                                                                                                                                                                                       
     uri:                                                                                                                                                                                                          
       url: "{{ pmm_server_management }}/RDS/Add"                                                                                                                                                                         method: POST                                                                                                                                                                                                
       user: "{{ pmm_username }}"                                                                                                                                                                                  password: "{{ pmm_password }}"                                                                                                                                                                       
       body: |                                                                                                                                                                                                                  {                                                                                                                                                                                                     
               "add_node": {                                                                                                                                                                                                          
                   "node_name": {{ inventory_hostname | to_json }},                                                                                                                                                
                   "node_type": "REMOTE_NODE"                                                                                                                                                                                     
               },                                                                                                                                                                                                  
               "address": {{ ansible_host | to_json }},                                                                                                                                                                       
               "aws_access_key": {{ pmm_aws_access_key_id | to_json }},                                                                                                                                            
               "aws_secret_key": {{ pmm_aws_secret_access_key | to_json }},                                                                                                                                                       
               "disable_basic_metrics": {{ pmm_rds_disable_basic_metrics | bool | to_json }},                                                                                                                      
               "disable_enhanced_metrics": {{ pmm_rds_disable_enhanced_metrics | bool | to_json }},                                                                                                                               
               "disable_query_examples": {{ pmm_rds_disable_query_examples | bool | to_json }},                                                                                                                                                                      
               "engine": "{{ 'DISCOVER_RDS_POSTGRESQL' if 'postgresql' in group_names else 'DISCOVER_RDS_MYSQL' }}",                                                                                                              
               "instance_id": {{ pmm_rds_host_name | to_json }},                                                                                                                                                   
               "metrics_mode": "PULL",                                                                                                                                                                                            
               "node_name": {{ inventory_hostname | to_json }},                                                                                                                                                    
               "password": {{ pmm_managed_password | to_json }},                                                                                                                                                              
               "port": {{ db_port | int | to_json }},                                                                                                                                                           
               "qan_mysql_perfschema": true,                                                                                                                                                                                      
               "qan_postgresql_pgstatements": true,                                                                                                                                                                
               "rds_exporter": true,                                                                                                                                                                                              
               "region": {{ pmm_rds_host_region | to_json }},                                                                                                                                                      
               "service_name": "{{ inventory_hostname }}-rds",                                                                                                                                                                    
               "skip_connection_check": {{ pmm_client_skip_connection_check | bool | to_json }},                                                                                                                   
               "tablestats_group_table_limit": {{ -1 if pmm_client_disable_tablestats else 
pmm_client_disable_tablestats_limit | to_json }},                                                                                      
               "tls": {{ pmm_client_use_tls | bool | to_json }},                                                                                                                                                   
               "tls_skip_verify": {{ pmm_client_skip_tls_verify | bool | to_json }},                                                                                                                                              
               "username": {{ pmm_managed_username | to_json }}                                                                                                                                                
             }                                                                                                                                                                                                            force_basic_auth: yes                                                                                                                                                                                       
       status_code:                                                                                                                                                                                                         
         - 200                                                                                                                                                                                                     
         - 409                                                                                                                                                                                                            body_format: json                                                                                                                                                                                           
       validate_certs: '{{ pmm_validate_certs }}'                                                                                                                                                                       register: pmm_managed                                                                                                                                                                                         
     connection: local                                                                                                                                                                                                  no_log: yes                                                                                                                                                                                                   
 when: ('rds' in group_names)

That should give you an idea of where to start.

Cheers,

Ceri

2 Likes

Thanks! This is what I was looking for.

1 Like