Configure the pmm-agent daemon¶
pmm-agent is the daemon process that runs on each monitored host. It manages exporters, collects metrics, and handles communication between your databases and PMM Server.
You typically don’t interact with pmm-agent directly, pmm-admin communicates with PMM Server, which then sends commands to pmm-agent.
NAME¶
pmm-agent: The PMM Client daemon program.
Syntax¶
pmm-agent [command] [options]
Description¶
pmm-agent, part of the PMM Client package, runs as a daemon process on all monitored hosts.
Commands¶
pmm-agent run- Run pmm-agent (default).
pmm-agent setup [node-address] [node-type] [node-name]-
Configure local pmm-agent (requires root permissions)
Running
setupagain for a registered pmm-agent keeps its registration, along with the Node and every Service on it:- The Node is registered again only when the PMM Server address changed, when PMM Server no longer knows the pmm-agent on that Node, or with
--force. - If PMM Server has the pmm-agent on a Node with another name,
setupstops. Re-run it with that name as thenode-nameargument to keep that Node together with its Services, or use--forceto register the name you gave as a new Node instead, which leaves the other Node and its Services on PMM Server with nothing monitoring them. - Settings which describe the Node, such as
--custom-labels,--disable-collectorsor thenode-typeargument, only take effect when the Node is registered.setuplists the ones it did not apply, and reports a registered Node address or type which differs from the one you gave. - The credentials given to
setuponly serve to register the Node. A registered pmm-agent keeps its service token, andsetupsays so when the credentials you gave were not the ones used. - Without
--config-file, as whenpmm-admin configrunssetup, the configuration file is left unchanged, so settings it holds beyond the flags given are kept. - If PMM Server cannot be reached, or answers something pmm-agent cannot interpret, the registration is kept, a warning is written to standard error and
setupstill succeeds, so that a Client can be set up while PMM Server is unavailable. - If the configuration file is encrypted, pass
--config-file-key-file. Without the keysetupcannot tell whether the pmm-agent is registered, and stops instead of guessing. --skip-registrationneeds an Agent ID already in hand, from--id,PMM_AGENT_ID, or a configuration file given with--config-file. It stops when nothing supplied one, rather than adopting the ID of a configuration file it only located through the running pmm-agent.
- The Node is registered again only when the PMM Server address changed, when PMM Server no longer knows the pmm-agent on that Node, or with
pmm-agent help [command]- Show help (for command) and exit.
Options and environment¶
Most options can be set via environment variables (shown in parentheses).
| Option | Environment variable | Description |
|---|---|---|
--server-password=SERVER-PASSWORD |
PMM_AGENT_SERVER_PASSWORD |
Password to connect to PMM Server. |
--server-username=SERVER-USERNAME |
PMM_AGENT_SERVER_USERNAME |
Username to connect to PMM Server. |
--server-address=host:port |
PMM_AGENT_SERVER_ADDRESS |
PMM Server address and port number. |
--server-insecure-tls |
PMM_AGENT_SERVER_INSECURE_TLS |
Skip PMM Server TLS certificate validation. |
--az=AZ |
PMM_AGENT_SETUP_AZ |
Node availability zone. |
--config-file=path_to/pmm-agent.yaml |
PMM_AGENT_CONFIG_FILE |
Configuration file path and name. |
--config-file-key-file |
PMM_AGENT_CONFIG_FILE_KEY_FILE |
Path to RSA private key for config file encryption. See Encrypt the PMM Client configuration file. |
--config-file-key-password |
PMM_AGENT_CONFIG_FILE_KEY_PASSWORD |
Password for the RSA private key (if password-protected). |
--container-id=CONTAINER-ID |
PMM_AGENT_SETUP_CONTAINER_ID |
Container ID. |
--container-name=CONTAINER-NAME |
PMM_AGENT_SETUP_CONTAINER_NAME |
Container name. |
--debug |
PMM_AGENT_DEBUG |
Enable debug output. |
--distro=distro |
PMM_AGENT_SETUP_DISTRO |
Node OS distribution (default is auto-detected). |
--force |
PMM_AGENT_SETUP_FORCE |
Register the Node even if this pmm-agent is registered, removing any existing Node with that name and its Services and Agents. |
--id=... |
PMM_AGENT_ID |
ID of this pmm-agent. |
--listen-address=LISTEN-ADDRESS |
PMM_AGENT_LISTEN_ADDRESS |
Agent local API address. |
--listen-port=LISTEN-PORT |
PMM_AGENT_LISTEN_PORT |
Agent local API port. |
--machine-id=machine-id |
PMM_AGENT_SETUP_MACHINE_ID |
Node machine ID (default is auto-detected). |
--metrics-mode=auto |
PMM_AGENT_SETUP_METRICS_MODE |
Metrics flow mode for agents node-exporter. Can be push (agent will push metrics), pull (server scrapes metrics from agent) or auto (chosen by server). |
--node-model=NODE-MODEL |
PMM_AGENT_SETUP_NODE_MODEL |
Node model. |
--proc-mounts-path=PATH |
PMM_AGENT_SETUP_PROC_MOUNTS_PATH |
Path to the proc/mounts file used by the node_exporter. |
--expose-exporter |
If you enable this flag, any IP address on the local network and anywhere on the internet can access node exporter endpoints. If the flag is disabled, node exporter endpoints can be accessed only locally. | |
--paths-base=PATH |
PMM_AGENT_PATHS_BASE |
Base path for PMM client, where all binaries, tools and collectors are located. If not set, default is /usr/local/percona/pmm. |
--paths-exporters_base=PATH |
PMM_AGENT_PATHS_EXPORTERS_BASE |
Base path for exporters to use. If not set, or set to a relative path, uses value of --paths-base prepended to it. |
--paths-mongodb_exporter=PATH |
PMM_AGENT_PATHS_MONGODB_EXPORTER |
Path to mongodb_exporter. |
--paths-mysqld_exporter=PATH |
PMM_AGENT_PATHS_MYSQLD_EXPORTER |
Path to mysqld_exporter. |
--paths-node_exporter=PATH |
PMM_AGENT_PATHS_NODE_EXPORTER |
Path to node_exporter. |
--paths-postgres_exporter=PATH |
PMM_AGENT_PATHS_POSTGRES_EXPORTER |
Path to postgres_exporter. |
--paths-proxysql_exporter=PATH |
PMM_AGENT_PATHS_PROXYSQL_EXPORTER |
Path to proxysql_exporter. |
--paths-pt-summary=PATH |
PMM_AGENT_PATHS_PT_SUMMARY |
Path to pt-summary. |
--paths-pt-mysql-summary=PATH |
PMM_AGENT_PATHS_PT_MYSQL_SUMMARY |
Path to pt-mysql-summary. |
--paths-pt-pg-summary=PATH |
PMM_AGENT_PATHS_PT_PG_SUMMARY |
Path to pt-pg-summary. |
--paths-tempdir=PATH |
PMM_AGENT_PATHS_TEMPDIR |
Temporary directory for exporters. |
--ports-max=PORTS-MAX |
PMM_AGENT_PORTS_MAX |
Highest allowed port number for listening sockets. |
--ports-min=PORTS-MIN |
PMM_AGENT_PORTS_MIN |
Lowest allowed port number for listening sockets. |
--region=REGION |
PMM_AGENT_SETUP_REGION |
Node region. |
--skip-registration |
PMM_AGENT_SETUP_SKIP_REGISTRATION |
Skip registration on PMM Server. |
--trace |
PMM_AGENT_TRACE |
Enable trace output (implies --debug). |
--version |
Show application version, PMM version, time-stamp, git commit hash and branch. | |
-h, --help |
Show help (synonym for pmm-agent help). |
Config file¶
PMM manages the configuration file, and it’s not recommended to modify it manually. However, if necessary, you can make adjustments to specific properties in the config file, such as the username or password used for authorization through service accounts.
To do this, set the username to service_token and add your service token as the password. For more information about service account authorization, see Service accounts authentication.
To protect the credentials stored in this file, you can optionally encrypt the PMM Client configuration file. See Encrypt the PMM Client configuration file.
Usage and examples of paths-base flag¶
Since 2.23.0 this flag could be used for easier setup of PMM agent. With this flag the root permissions for PMM client aren’t needed anymore and it will be fully working.
Examples:
-
Case 1: There are no root permissions for
/usr/local/percona/pmmfolder or there is a need to change default folder for PMM files. Command:Config output:pmm-agent setup --paths-base=/home/user/custom/pmm --config-file=pmm-agent.yaml --server-insecure-tls --server-address=127.0.0.1:443 --server-username=admin --server-password=adminAs could be seen above, base for all exporters and tools was changed only by setting# Updated by `pmm-agent setup`. --- id: be568008-b1b4-4bd9-98c7-392d1f4b724e listen-address: 127.0.0.1 listen-port: 7777 server: address: 127.0.0.1:443 username: admin password: admin insecure-tls: true paths: paths_base: /home/user/custom/pmm exporters_base: /home/user/custom/pmm/exporters node_exporter: /home/user/custom/pmm/exporters/node_exporter mysqld_exporter: /home/user/custom/pmm/exporters/mysqld_exporter mongodb_exporter: /home/user/custom/pmm/exporters/mongodb_exporter postgres_exporter: /home/user/custom/pmm/exporters/postgres_exporter proxysql_exporter: /home/user/custom/pmm/exporters/proxysql_exporter rds_exporter: /home/user/custom/pmm/exporters/rds_exporter azure_exporter: /home/user/custom/pmm/exporters/azure_exporter vmagent: /home/user/custom/pmm/exporters/vmagent tempdir: /tmp pt_summary: /home/user/custom/pmm/tools/pt-summary pt_pg_summary: /home/user/custom/pmm/tools/pt-pg-summary pt_mysql_summary: /home/user/custom/pmm/tools/pt-mysql-summary pt_mongodb_summary: /home/user/custom/pmm/tools/pt-mongodb-summary ports: min: 42000 max: 51999 debug: false trace: false--paths-base. With this tag the folder for PMM that doesn’t require root access could be specified. -
Case 2: The older
--paths-exporters_baseflag could be passed along with the--paths-baseCommand:Config output:pmm-agent setup --paths-base=/home/user/custom/pmm --paths-exporters_base=/home/user/exporters --config-file=pmm-agent.yaml --server-insecure-tls --server-address=127.0.0.1:443 --server-username=admin --server-password=adminAs could be seen above the behavior for the# Updated by `pmm-agent setup`. --- id: afce1917-8836-4857-b3e5-ad372c2ddbe5 listen-address: 127.0.0.1 listen-port: 7777 server: address: 127.0.0.1:443 username: admin password: admin insecure-tls: true paths: paths_base: /home/user/custom/pmm exporters_base: /home/user/exporters node_exporter: /home/user/exporters/node_exporter mysqld_exporter: /home/user/exporters/mysqld_exporter mongodb_exporter: /home/user/exporters/mongodb_exporter postgres_exporter: /home/user/exporters/postgres_exporter proxysql_exporter: /home/user/exporters/proxysql_exporter rds_exporter: /home/user/exporters/rds_exporter azure_exporter: /home/user/exporters/azure_exporter vmagent: /home/user/exporters/vmagent tempdir: /tmp pt_summary: /home/user/custom/pmm/tools/pt-summary pt_pg_summary: /home/user/custom/pmm/tools/pt-pg-summary pt_mysql_summary: /home/user/custom/pmm/tools/pt-mysql-summary pt_mongodb_summary: /home/user/custom/pmm/tools/pt-mongodb-summary ports: min: 42000 max: 51999 debug: false trace: false--paths-basewas the same, but paths for all exporters were overwritten by the--paths-exporter_baseflag.
Summary:
Flag --paths-base will set path for all exporters and tools, but each one could be overridden by specific flag (like --paths-mongodb_exporter, --paths-pt-mysql-summary and etc).
LOGGING¶
By default, pmm-agent sends messages to stderr and to the system log (syslogd or journald on Linux).
To get a separate log file, edit the pmm-agent start-up script.
systemd-based systems
- Script file:
/usr/lib/systemd/system/pmm-agent.service - Parameter:
StandardError - Default value:
file:/var/log/pmm-agent.log
Example:
StandardError=file:/var/log/pmm-agent.log
initd-based systems
- Script file:
/etc/init.d/pmm-agent - Parameter:
pmm_log - Default value:
/var/log/pmm-agent.log
Example:
pmm_log="/var/log/pmm-agent.log"