### Install PMM Server (Quick Start) Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/HA-kubernetes-single-instance.md Deploy PMM Server using Helm with default settings. This method is suitable for a quick setup. ```bash helm install pmm percona/pmm \ --namespace monitoring \ --set service.type=LoadBalancer ``` -------------------------------- ### Get Specific Command Help Example Source: https://github.com/percona/pmm/blob/main/documentation/docs/use/commands/pmm-admin/pmm-admin.md Example of how to get help for a specific command, such as `pmm-admin add mysql`. ```bash pmm-admin add mysql --help ``` -------------------------------- ### PMM App Development Commands Source: https://github.com/percona/pmm/blob/main/dashboards/pmm-app/AGENTS.md Install dependencies, start the development server, build for production, run tests, and perform linting/type checking. ```bash cd dashboards/pmm-app # Install dependencies yarn install --frozen-lockfile # Start webpack in watch mode (development) yarn dev # Production build yarn build # Run tests (CI mode) yarn test:ci # Lint and typecheck yarn lint && yarn typecheck ``` -------------------------------- ### Get Specific Subcommand Help Example Source: https://github.com/percona/pmm/blob/main/documentation/docs/use/commands/pmm-admin/pmm-admin.md Example of how to get help for a specific subcommand, such as `pmm-admin inventory change agent`. ```bash pmm-admin inventory change agent --help ``` -------------------------------- ### Run Installer (with root) Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-client/binary_package.md Execute the installer script with root privileges to install the PMM client to the specified directory. ```sh sudo ./install_tarball ``` -------------------------------- ### Quick Start PMM Server Docker Deployment Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/HA-docker.md Launches PMM Server with minimal configuration for a quick setup. Use this for initial testing or simple deployments. ```sh docker run -d \ --name pmm-server \ --restart=always \ -p 443:8443 \ -v pmm-data:/srv \ percona/pmm-server:3 ``` -------------------------------- ### Get Query Examples Source: https://github.com/percona/pmm/blob/main/qan-api2/README.md Retrieve example queries based on specified filters and time ranges. This can help in understanding query patterns. ```bash curl 'http://localhost:9922/v1/qan/query:getExample ' -X POST -d '{"filter_by":"1D410B4BE5060972","group_by":"queryid","limit":5,"period_start_from":"2018-12-31T22:00:00+00:00","period_start_to":"2019-01-01T06:00:00+00:00"}' -s | jq ``` -------------------------------- ### Run Installer (without root) Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-client/binary_package.md Execute the installer script without root privileges to install the PMM client to the specified directory. ```sh ./install_tarball ``` -------------------------------- ### Start PMM Server with Docker Compose Source: https://github.com/percona/pmm/blob/main/dashboards/CONTRIBUTING.md This command starts only the PMM server using Docker Compose within the `pmm-app` directory. This is a simpler setup if only the server is needed, with front-end artifacts mapped from the local `./pmm-app/dist` folder. ```bash docker compose up -d pmm-server ``` -------------------------------- ### Starting PMM Server with Docker Source: https://github.com/percona/pmm/blob/main/build/docker/server/README.md Use these commands to pull the PMM Server image, create a persistent volume for data, and run the PMM Server container. Ensure to map the host's port 443 to the container's port 8443. Point your browser to https://hostname:443 after setup. ```bash docker pull percona/pmm-server:3 ``` ```bash docker volume create pmm-data ``` ```bash docker run --detach --restart always --publish 443:8443 -v pmm-data:/srv --name pmm-server percona/pmm-server:3 ``` -------------------------------- ### Run QAN UI Development Server in Devcontainer Source: https://github.com/percona/pmm/blob/main/dashboards/CONTRIBUTING.md Execute this command inside the PMM devcontainer to start the QAN UI development server. This process includes installing dependencies, symlinking the build output, and setting up livereload. ```bash make run-qan-ui ``` -------------------------------- ### Successful Output Example Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-client/connect-database/haproxy.md This is an example of the output you can expect after successfully adding an HAProxy service. ```txt HAProxy Service added. Service ID : c481183f-70a2-443f-91e5-cae5cecd06a2 Service name: Ubuntu-haproxy ``` -------------------------------- ### Run a new PMM Server container with the latest image Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-server/deployment-options/docker/upgrade_container.md Start a new PMM Server container using the latest image, connecting it to your existing data. Adjust the volume parameter based on your setup. ```bash docker run \ --detach \ --restart always \ --publish 443:8443 \ --volumes-from pmm-data \ --name pmm-server \ percona/pmm-server:3 ``` -------------------------------- ### MkDocs Hint/Tip Admonition Examples Source: https://github.com/percona/pmm/blob/main/documentation/WRITERS-NOTES.md Provides examples for using 'hint' admonitions, which are recommended over 'tip' for better rendering, to offer useful advice. ```txt !!! hint alert alert-success "Tip" Tip !!! hint alert alert-success "Tips" - One - Two !!! hint alert alert-success "" Tip ``` -------------------------------- ### Install PMM Server with Easy-install Script Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-server/deployment-options/docker/index.md Installs PMM Server and Watchtower using a simplified script. This is the recommended method for ease of use. ```bash curl -fsSL https://www.percona.com/get/pmm | /bin/bash ``` -------------------------------- ### Install PMM Client from Repository on Red Hat-based Systems Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-client/package_manager.md Installs the PMM Client package from the configured repository on Red Hat-based systems. ```bash yum install -y pmm-client ``` -------------------------------- ### Enable and Start PMM and Watchtower Services Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-server/deployment-options/podman/index.md Enables the PMM Server and Watchtower systemd user services to start automatically on login and starts them immediately. This command should be run after configuring the respective service and environment files. ```sh systemctl --user enable --now pmm-server systemctl --user enable --now watchtower ``` -------------------------------- ### Migrate POST /v1/inventory/Services/List to GET /v1/inventory/services Source: https://github.com/percona/pmm/blob/main/api/MIGRATION_EXAMPLES.md Shows how to list all services using a GET request, migrating from the older POST endpoint. ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/services ``` -------------------------------- ### Full Example: Register PMM Client with Node Details (Service Account) Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-client/binary_package.md This example demonstrates a complete registration command using a service account token, including specific node address, type, and name. ```bash pmm-admin config --server-insecure-tls \ --server-url=https://service_token:glsa_aBc123XyZ456...@192.168.33.14:443 \ 192.168.33.23 generic prod-db01 ``` -------------------------------- ### Get Query Examples Source: https://github.com/percona/pmm/blob/main/qan-api2/README.md Retrieves example queries based on specific filters and time ranges. ```APIDOC ## POST /v1/qan/query:getExample ### Description Retrieves example queries, potentially for debugging or understanding query patterns, based on provided filters and time ranges. ### Method POST ### Endpoint /v1/qan/query:getExample ### Parameters #### Request Body - **filter_by** (string) - Optional - A filter to narrow down the query examples. - **group_by** (string) - Optional - Field to group the examples by. - **limit** (integer) - Optional - The maximum number of examples to retrieve. - **period_start_from** (string) - Required - The start of the time period. - **period_start_to** (string) - Required - The end of the time period. ### Request Example ```json { "filter_by": "1D410B4BE5060972", "group_by": "queryid", "limit": 5, "period_start_from": "2018-12-31T22:00:00+00:00", "period_start_to": "2019-01-01T06:00:00+00:00" } ``` ### Response #### Success Response (200) - **query_examples** (array) - A list of query examples. - Each object contains an "example" (the query string) and "example_type". #### Response Example ```json { "query_examples": [ { "example": "SELECT * FROM users WHERE id = 1;", "example_type": "RANDOM" } ] } ``` ``` -------------------------------- ### Serve API Docs Locally Source: https://github.com/percona/pmm/blob/main/api/AGENTS.md Navigate to the `api/` directory and run `make serve` to locally serve the API documentation. This is useful for previewing generated documentation. ```bash # Serve API docs locally cd api && make serve ``` -------------------------------- ### Start PMM Devcontainer and Shell In Source: https://github.com/percona/pmm/blob/main/dashboards/CONTRIBUTING.md Use these commands to initially set up the PMM devcontainer and then to access its shell. The `env-up` command is for the first run only. ```bash make env-up make env ``` -------------------------------- ### Install VictoriaMetrics Operator Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-HA-clustered.md Installs the VictoriaMetrics Operator separately, enabling admission webhooks for advanced configuration. Use this for custom setups where individual operator control is needed. ```sh helm repo add vm https://victoriametrics.github.io/helm-charts/ helm repo update helm install victoria-metrics-operator vm/victoria-metrics-operator \ --namespace pmm \ --set admissionWebhooks.enabled=true ``` -------------------------------- ### Migrate POST /v1/inventory/Agents/List to GET /v1/inventory/agents Source: https://github.com/percona/pmm/blob/main/api/MIGRATION_EXAMPLES.md Shows how to list agents using a GET request, with examples of filtering by agent type, PMM agent ID, and service ID. ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents ``` ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents?agent_type=AGENT_TYPE_POSTGRES_EXPORTER ``` ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents?agent_type=AGENT_TYPE_PMM_AGENT ``` ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents?pmm_agent_id=pmm-server ``` ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents?pmm_agent_id=/agent_id/02ecd9e3-d7b8-4d94-9c75-060b8e6e3e84 ``` ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents?pmm_agent_id=02ecd9e3-d7b8-4d94-9c75-060b8e6e3e84 ``` ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents?service_id=/service_id/6984244c-0a18-4508-a219-3977e8fb01d0 ``` ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents?service_id=6984244c-0a18-4508-a219-3977e8fb01d0 ``` -------------------------------- ### Initialize Project Tools Source: https://github.com/percona/pmm/blob/main/api/README.md Install required tools for the project once. This command sets up the necessary development environment. ```bash make init ``` -------------------------------- ### Setup PMM Client with Encrypted Configuration Source: https://github.com/percona/pmm/blob/main/documentation/docs/admin/security/client_config_encryption.md Run the PMM Client setup command, specifying the configuration file, server address, and the path to the RSA private key. Include the key password if the key is password-protected. ```bash pmm-agent setup \ --config-file=/usr/local/percona/pmm/config/pmm-agent.yaml \ --server-address=pmm-server.example.com:443 \ --server-insecure-tls \ --config-file-key-file=/etc/pmm-agent-key.pem \ --config-file-key-password="$OPENSSL_PASSWORD" \ --server-username=admin \ --server-password=admin ``` -------------------------------- ### Migrate POST /v1/inventory/Agents/GetLogs to GET /v1/inventory/agents/{agent_id}/logs Source: https://github.com/percona/pmm/blob/main/api/MIGRATION_EXAMPLES.md This example demonstrates migrating a request to retrieve agent logs from a POST to a GET request, including an optional limit parameter. ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents/49bef198-299c-41b3-ba05-578defe63678/logs ``` ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents/49bef198-299c-41b3-ba05-578defe63678/logs?limit=10 ``` -------------------------------- ### Install PMM HA Dependencies Operators Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-HA-clustered.md Installs all required PMM operators (VictoriaMetrics, Altinity ClickHouse, Percona PostgreSQL) using a single Helm command. This is the recommended method for a straightforward setup. ```sh helm install pmm-operators percona/pmm-ha-dependencies --namespace pmm ``` -------------------------------- ### Get Queries for a Specific Service Source: https://github.com/percona/pmm/blob/main/documentation/api/qan/search-rta-queries.md Example using curl to send a POST request to the search queries endpoint, filtering by a single service ID. ```bash curl -X POST "https://your-pmm-server/v1/realtimeanalytics/queries:search" \ -H "Authorization: Bearer glsa_xxxxx" \ -H "Content-Type: application/json" \ -d '{ "service_ids": ["7a3e9c44-12ab-4d3f-9e21-5c8d7b1a2e4f"] }' ``` -------------------------------- ### Configure and Setup PMM Agent Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-client/binary_package.md Use this command to set up the PMM agent with specified configuration. Ensure to replace placeholder values with your actual PMM server details and desired paths. ```bash pmm-agent setup --config-file=${PMM_DIR}/config/pmm-agent.yaml --server-address=192.168.1.123 --server-insecure-tls --server-username=admin --server-password=admin --paths-tempdir=${PMM_DIR}/tmp --paths-base=${PMM_DIR} ``` -------------------------------- ### Example: Register PMM Client with Node Details (Standard Auth) Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-client/binary_package.md This example shows how to register a PMM client using standard authentication, specifying the node's IP address, type, and name. ```bash pmm-admin config --server-insecure-tls \ --server-url=https://admin:admin@192.168.33.14:443 \ 192.168.33.23 generic mynode ``` -------------------------------- ### Get VM IP Address with VBoxManage CLI Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-server/deployment-options/virtual/virtualbox.md Retrieve the IP address of the PMM Server VM using the VBoxManage guestproperty command. This is typically used after starting the VM in headless mode. ```bash VBoxManage guestproperty get "PMM Server" "/VirtualBox/GuestInfo/Net/0/V4/IP" ``` -------------------------------- ### Mount Certificates for Container Installation Source: https://github.com/percona/pmm/blob/main/documentation/docs/admin/security/ssl_encryption.md Use this command to mount your certificate directory into the PMM Server container during initial setup. Ensure the host directory `/etc/pmm-certs` contains all required certificate files. ```sh docker run -d -p 443:8443 --volumes-from pmm-data \ --name pmm-server -v /etc/pmm-certs:/srv/nginx \ --restart always percona/pmm-server:3 ``` -------------------------------- ### Install PMM Client from Downloaded Package on Red Hat-based Systems Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-client/package_manager.md Installs the PMM Client from a downloaded .rpm package file on Red Hat-based systems. Ensure the package name matches your downloaded file. ```bash sudo dnf localinstall pmm-client-*.rpm ``` -------------------------------- ### Change Agent Attributes (Old API Call - Deprecated) Source: https://github.com/percona/pmm/blob/main/documentation/api/inventory/change-agent.md This example shows the older method of changing agent attributes, where a separate API endpoint was used for each agent type. This method is deprecated starting from PMM 3.0.0. ```APIDOC ## Change Agent Attributes (Old API Call - Deprecated) ### Description This is a deprecated method for changing agent attributes, where each agent type had its own specific API endpoint. Use the new unified endpoint for PMM 3.0.0 and later. ### Method POST ### Endpoint /v1/inventory/Agents/Change{AgentType} ### Parameters #### Path Parameters - **{AgentType}** (string) - Required - The type of the agent (e.g., `MySQLdExporter`). #### Request Body - **agent_id** (string) - Required - The unique identifier of the agent. - **common** (object) - Required - Common attributes for the agent. - **enable** (boolean) - Optional - Whether to enable the agent. - **custom_labels** (object) - Optional - A key-value map of custom labels. - **key** (string) - Description of the label key. - **value** (string) - Description of the label value. - **enable_push_metrics** (boolean) - Optional - Whether to enable push mode for metrics. ### Request Example ```json { "agent_id": "13519ec9-eedc-4d21-868c-582e146e1d0e", "common": { "enable": true, "custom_labels": { "department": "sales", "replication_set": "db-sales-prod-1-rs1" }, "enable_push_metrics": true } } ``` ### Response #### Success Response (200) - **message** (string) - Description of the success message. #### Response Example ```json { "message": "Agent attributes updated successfully." } ``` ``` -------------------------------- ### Display Migration Script Help Source: https://github.com/percona/pmm/blob/main/documentation/docs/pmm-upgrade/migrating_from_pmm_2.md View available options and usage instructions for the migration script. ```bash ./get-pmm.sh -h ``` -------------------------------- ### Install PMM Server using wget Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-server/deployment-options/docker/easy-install.md Use this command to download and execute the Easy-install script via wget for PMM Server installation on Linux or macOS. ```bash wget -O - https://www.percona.com/get/pmm | bash ``` -------------------------------- ### Verify PMM Client Installation Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-client/package_manager.md Checks the installed PMM Client version to confirm a successful installation. ```bash pmm-admin --version ``` -------------------------------- ### Serve API Documentation with Nginx Source: https://github.com/percona/pmm/blob/main/api/README.md Serve API documentation locally using nginx. This command initiates a local server for browsing the API documentation. ```bash make serve ``` -------------------------------- ### Install percona-release Tool Source: https://github.com/percona/pmm/blob/main/documentation/docs/quickstart/quickstart.md Install the percona-release tool to manage Percona software repositories. If already installed, update it to the latest version. ```sh yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm ``` -------------------------------- ### Install PMM Client on Red Hat-based Systems Source: https://github.com/percona/pmm/blob/main/documentation/docs/quickstart/quickstart.md Install the PMM client on Red Hat-based systems using the package manager. This involves installing the percona-release tool, enabling the PMM client repository, and then installing the pmm-client package. ```sh yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm ``` ```sh percona-release enable pmm3-client release ``` ```sh yum install -y pmm-client ``` -------------------------------- ### Install PMM Client on Debian-based Systems Source: https://github.com/percona/pmm/blob/main/documentation/docs/quickstart/quickstart.md Install the PMM client on Debian-based systems using the package manager. This involves downloading and installing the Percona Release Tool, enabling the PMM client repository, and then installing the pmm-client package. ```sh wget https://repo.percona.com/apt/percona-release_latest.generic_all.deb dpkg -i percona-release_latest.generic_all.deb ``` ```sh percona-release enable pmm3-client release ``` ```sh apt update apt install -y pmm-client ``` -------------------------------- ### Install PMM Server with Command-Line Arguments Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-server/deployment-options/helm/index.md Use this command to install PMM Server via Helm, specifying custom configurations like disabling secret creation and setting the service type to NodePort. ```sh helm install pmm \ --set secret.create=false \ --set secret.name=pmm-secret \ --set service.type="NodePort" \ percona/pmm ``` -------------------------------- ### Install PMM with wget Source: https://github.com/percona/pmm/blob/main/documentation/docs/quickstart/quickstart.md Use this command to download and execute the PMM Easy-install script via wget. Ensure you have sudo privileges or root access. ```bash wget -qO - https://raw.githubusercontent.com/percona/pmm/refs/heads/main/get-pmm.sh | /bin/bash ``` -------------------------------- ### Install PostgreSQL Operator Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-HA-clustered.md Installs the Percona PostgreSQL Operator separately. This is used in the advanced, manual installation of PMM HA to manage PostgreSQL instances. ```sh helm install postgres-operator percona/pg-operator --namespace pmm ``` -------------------------------- ### Install ClickHouse Operator Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-HA-clustered.md Installs the Altinity ClickHouse Operator separately. This is part of the manual installation process for PMM HA, allowing for specific ClickHouse configurations. ```sh helm repo add altinity https://helm.altinity.com helm repo update helm install clickhouse-operator altinity/altinity-clickhouse-operator \ --namespace pmm ``` -------------------------------- ### Build and Preview PMM Documentation Locally Source: https://github.com/percona/pmm/blob/main/documentation/docs-contributing.md Build and preview the PMM documentation locally to ensure it renders correctly before submitting changes. The preview server automatically reloads on file changes. ```shell # Build the documentation make doc-build # Preview the documentation with live reload (recommended) make doc-build-preview # Build the PDF (Percona staff only — update the version in mkdocs-base.yml first) make doc-build-pdf ``` -------------------------------- ### Set Installation Directory Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-client/binary_package.md Define the PMM_DIR environment variable to specify the installation path for the PMM client. For non-root installations, replace YOURPATH with a writable directory. ```sh export PMM_DIR=/usr/local/percona/pmm ``` ```sh export PMM_DIR=YOURPATH ``` -------------------------------- ### Start session Source: https://github.com/percona/pmm/blob/main/documentation/api/qan/manage-rta-sessions.md Starts a Real-time Analytics (RTA) session for a specified MongoDB service. Once started, the session will continuously collect data about currently executing queries. ```APIDOC ## POST /v1/realtimeanalytics/sessions:start ### Description Starts a Real-time Analytics (RTA) session for a specified MongoDB service. Once started, the session will continuously collect data about currently executing queries. ### Method POST ### Endpoint /v1/realtimeanalytics/sessions:start ### Parameters #### Request Body - **service_id** (string) - Required - Service identifier to start RTA session for ### Request Example ```json { "service_id": "7a3e9c44-12ab-4d3f-9e21-5c8d7b1a2e4f" } ``` ### Response #### Success Response (200) - **session** (object) - The started session details - **session.service_id** (string) - Service identifier - **session.service_name** (string) - Service name - **session.cluster_name** (string) - Cluster name the service belongs to - **session.start_time** (string (date-time)) - When the session started - **session.collect_interval** (string) - Query collection interval - **session.status** (string) - Session status (see status values below) #### Response Example ```json { "session": { "service_id": "7a3e9c44-12ab-4d3f-9e21-5c8d7b1a2e4f", "service_name": "mongodb-production-rs0", "cluster_name": "production-cluster", "start_time": "2024-03-06T15:20:00Z", "collect_interval": "2s", "status": "SESSION_STATUS_RUNNING" } } ``` ``` -------------------------------- ### Example Certificate Directory Structure Source: https://github.com/percona/pmm/blob/main/documentation/docs/reference/third-party/postgresql.md Illustrates the expected directory structure and file permissions for SSL certificates when configuring PostgreSQL for secure connections. ```sh # Example directory structure for certificates: /pmm-server-certificates# ls -la drwxr-xr-x 1 1000 1000 4096 Apr 5 12:43 . drwxr-xr-x 1 root root 4096 Apr 5 12:43 .. -rw------- 1 1000 1000 1391 Apr 5 12:38 certificate_authority.crt -rw------- 1 1000 1000 1257 Apr 5 12:38 pmm_server.crt -r-------- 1 1000 1000 1708 Apr 5 12:38 pmm_server.key ``` -------------------------------- ### PMM Build Pipeline Overview Source: https://github.com/percona/pmm/blob/main/build/AGENTS.md Illustrates the sequence of steps involved in building PMM artifacts, from source code compilation to machine image creation. ```text Source code (Go, TypeScript) → Binary compilation (make release) → RPM/DEB packaging (packages/) → Docker image build (docker/) → Machine image build (packer/) ``` -------------------------------- ### Start RTA Session Response Source: https://github.com/percona/pmm/blob/main/documentation/api/qan/manage-rta-sessions.md The response upon successfully starting an RTA session includes details about the session, such as service ID, name, start time, and status. ```json { "session": { "service_id": "7a3e9c44-12ab-4d3f-9e21-5c8d7b1a2e4f", "service_name": "mongodb-production-rs0", "cluster_name": "production-cluster", "start_time": "2024-03-06T15:20:00Z", "collect_interval": "2s", "status": "SESSION_STATUS_RUNNING" } } ``` -------------------------------- ### PostgreSQL Initialization SQL Template Source: https://github.com/percona/pmm/blob/main/documentation/docs/reference/third-party/postgresql.md Template for an init.sql file to create databases, users, and grant privileges for PMM and Grafana. Replace placeholders with your actual credentials. ```sql CREATE DATABASE "pmm-managed"; CREATE USER WITH ENCRYPTED PASSWORD ''; GRANT ALL PRIVILEGES ON DATABASE "pmm-managed" TO ; CREATE DATABASE grafana; CREATE USER WITH ENCRYPTED PASSWORD ''; GRANT ALL PRIVILEGES ON DATABASE grafana TO ; \c "pmm-managed" CREATE EXTENSION IF NOT EXISTS pg_stat_statements; ``` -------------------------------- ### Migrate POST /v1/inventory/Services/Get to GET /v1/inventory/services/{service_id} Source: https://github.com/percona/pmm/blob/main/api/MIGRATION_EXAMPLES.md Demonstrates migrating a request to get service details from a POST to a GET request, using the service's UUID. ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/services/d4dfdccf-c07c-48a6-a101-b119b04d880f ``` -------------------------------- ### Migrate POST /v1/backup/Artifacts/PITRTimeranges to GET /v1/backups/artifacts/{artifact_id}/pitr-timeranges Source: https://github.com/percona/pmm/blob/main/api/MIGRATION_EXAMPLES.md Demonstrates migrating a request to get PITR (Point-in-Time Recovery) timeranges for backup artifacts from a POST to a GET request. ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/backups/artifacts/bcc83096-b006-4d2e-ac17-365a57c3e37a/pitr-timeranges ``` -------------------------------- ### Migrate POST /v1/inventory/Agents/Get to GET /v1/inventory/agents/{agent_id} Source: https://github.com/percona/pmm/blob/main/api/MIGRATION_EXAMPLES.md Demonstrates migrating a request to get agent details from a POST to a GET request, using the agent's UUID in the URL. ```shell curl -X GET http://admin:admin@127.0.0.1:8080/v1/inventory/agents/02ecd9e3-d7b8-4d94-9c75-060b8e6e3e84 ``` -------------------------------- ### Environment Variable Migration Example Source: https://github.com/percona/pmm/blob/main/documentation/docs/pmm-upgrade/migrating_from_pmm_2.md Illustrates the transformation of PMM v2 environment variables to their PMM v3 equivalents, reflecting the new naming conventions and boolean flag reversals. ```bash # PMM v2 -e DISABLE_UPDATES=true -e DATA_RETENTION=720h # PMM v3 equivalent -e PMM_ENABLE_UPDATES=false -e PMM_DATA_RETENTION=720h ``` -------------------------------- ### Start Monitoring Session Source: https://github.com/percona/pmm/blob/main/documentation/api/qan/real-time-analytics.md Starts a real-time monitoring session for a specified service. ```APIDOC ## POST /v1/realtimeanalytics/sessions:start ### Description Starts a real-time monitoring session for a given service. ### Method POST ### Endpoint /v1/realtimeanalytics/sessions:start ### Request Body - **service_id** (string) - Required - The ID of the service to monitor. ### Request Example { "service_id": "your-service-id" } ### Response #### Success Response (200) (Response details not provided in source) ``` -------------------------------- ### Add MySQL Instance with Custom Labels Source: https://github.com/percona/pmm/blob/main/documentation/docs/install-pmm/install-pmm-client/connect-database/mysql/mysql.md Configure a MySQL instance with environment and custom labels for better organization and filtering within PMM. ```sh pmm-admin add mysql \ --username=pmm \ --password=StrongPassword \ --host=localhost \ --port=3306 \ --query-source=slowlog \ --environment=production \ --custom-labels="role=primary,datacenter=east" \ MySQL-Primary ``` -------------------------------- ### Apply Credentials to Initialization Script Source: https://github.com/percona/pmm/blob/main/documentation/docs/reference/third-party/postgresql.md Uses sed to replace placeholder values in init.sql.template with environment variables for PostgreSQL and Grafana credentials. ```sh sed -e 's//'"$PG_USERNAME"'/g' \ -e 's//'"$PG_PASSWORD"'/g' \ -e 's//'"$GF_USERNAME"'/g' \ -e 's//'"$GF_PASSWORD"'/g' \ init.sql.template > init.sql ```