$ pmm-admin list Service type Service name Address and port Service ID
Agent type Status Agent ID Service ID pmm_agent Connected /agent_id/4e8b2fc2-63f7-4b16-a916-5aa2ec05f641 node_exporter Running /agent_id/09382ac0-756a-4397-8d6b-ef944b339e34
添加MySQL监控
创建pmm用户
mysql> Grant SELECT, PROCESS, SUPER, REPLICATION CLIENT, RELOAD on *.* to 'pmm'@'localhost' identified by 'Abcd123#' with grant option; mysql> flush privileges;
注册MySQL监控
$ pmm-admin add mysql --username=pmm --password=Abcd123# --query-source=perfschema test-mysql 127.0.0.1:3306
MySQL提供了两个查询指标来源:slowlog和perfschema
查看客户端服务
$ pmm-admin list Service type Service name Address and port Service ID MySQL t-luhx02-v-szzb-mysql 127.0.0.1:33006 /service_id/1dc85561-e23e-46a1-8f24-056ffa51137e
Agent type Status Agent ID Service ID pmm_agent Connected /agent_id/4e8b2fc2-63f7-4b16-a916-5aa2ec05f641 node_exporter Running /agent_id/09382ac0-756a-4397-8d6b-ef944b339e34 mysqld_exporter Running /agent_id/efc4b59f-4136-4526-9b6e-b253c88b1116 /service_id/1dc85561-e23e-46a1-8f24-056ffa51137e mysql_perfschema_agent Running /agent_id/ede09a9a-d68c-4b98-b461-0e5bd70608b9 /service_id/1dc85561-e23e-46a1-8f24-056ffa51137e
Flags: -h, --help Show context-sensitive help (also try --help-long and --help-man) --version Show application version --server-url=SERVER-URL PMM Server URL in `https://username:password@pmm-server-host/` format --server-insecure-tls Skip PMM Server TLS certificate validation --debug Enable debug logging --trace Enable trace logging (implies debug) --json Enable JSON output --node-id=NODE-ID Node ID (default is autodetected) --pmm-agent-id=PMM-AGENT-ID The pmm-agent identifier which runs this instance (default is autodetected) --username=USERNAME MongoDB username --password=PASSWORD MongoDB password --query-source=profiler Source of queries, one of: profiler, none (default: profiler) --environment=ENVIRONMENT Environment name --cluster=CLUSTER Cluster name --replication-set=REPLICATION-SET Replication set name --custom-labels=CUSTOM-LABELS Custom user-assigned labels --skip-connection-check Skip connection check --tls Use TLS to connect to the database --tls-skip-verify Skip TLS certificates validation --service-name=NAME Service name (overrides positional argument) --host=HOST Service hostname or IP address (overrides positional argument) --port=PORT Service port number (overrides positional argument) --socket=SOCKET Path to socket
Positional arguments: [<name>] Service name (autodetected default: t-luhx02-v-szzb-mongodb) [<address>] MongoDB address and port (default: 127.0.0.1:27017)