最近要對數(shù)據(jù)庫的監(jiān)控體系進(jìn)行改進(jìn),發(fā)現(xiàn)Percona 公司的一款開源的監(jiān)控工具Percona Monitoring and Management(PMM) 對于MySQL的監(jiān)控指標(biāo)各項(xiàng)值比較全面準(zhǔn)確,現(xiàn)在公司內(nèi)部的開發(fā)測試環(huán)境進(jìn)行了部署體驗(yàn)。

主要的架構(gòu)圖如下:源于官方

可以看到主要是由客戶端的代理程序node_export\mysqld_export\mongodb_export等和客戶端管理工具pmm-admin做為數(shù)據(jù)的收集方式并發(fā)送到服務(wù)端的QAN API\Consul API\Prometheus等各個(gè)API然后通過Grafana來展示數(shù)據(jù)指標(biāo),界面非常靚麗
Pmm 的server端的運(yùn)行方式主要有官方提供的以下三種方式:
1.已經(jīng)集成好的Docker方式
2.集成好的VirtualBox方式
3. Amazon Machine Image (AMI)
在這里我用的是Docker方式,輕量部署、升級很方便
PMM的client安裝比較方便,直接安裝官方的yum安裝就OK了
#詳細(xì)的請參考官方文檔
https://www.percona.com/doc/percona-monitoring-and-management/index.html
#Dokcer方式部署
提前準(zhǔn)備好系統(tǒng)和Docker服務(wù),安裝不在這里展示
1-創(chuàng)建容器的數(shù)據(jù)磁盤
docker create \ -v /opt/prometheus/data \ -v /opt/consul-data \ -v /var/lib/mysql \ -v /var/lib/grafana \ --name pmm-data \ percona/pmm-server:1.1.1 /bin/true
2-創(chuàng)建容器的運(yùn)行實(shí)例
docker run -d \ -p 80:80 \ --volumes-from pmm-data \ --name pmm-server \ --restart always \ percona/pmm-server:1.1.1
#客戶端安裝
[root@master ~]# yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm
[root@master ~]# yum install -y pmm-client
#增加客戶端mysql監(jiān)控
[root@master ~]# pmm-admin config --server 192.168.100.171
OK, PMM server is alive.
PMM Server | 192.168.100.171
Client Name | master.wboy.com
Client Address | 192.168.100.41
[root@master ~]# pmm-admin list
pmm-admin 1.1.1
PMM Server | 192.168.100.171
Client Name | master.wboy.com
Client Address | 192.168.100.41
Service Manager | unix-systemv
No monitoring registered for this node identified as 'master.wboy.com'.
#命令幫助
[root@master ~]# pmm-admin add --help
This command is used to add a monitoring service.
Usage:
pmm-admin add [command]
Available Commands:
mysql Add complete monitoring for MySQL instance (linux and mysql metrics, queries).
linux:metrics Add this system to metrics monitoring.
mysql:metrics Add MySQL instance to metrics monitoring.
mysql:queries Add MySQL instance to Query Analytics.
mongodb Add complete monitoring for MongoDB instance (linux and mongodb metrics).
mongodb:metrics Add MongoDB instance to metrics monitoring.
proxysql:metrics Add ProxySQL instance to metrics monitoring.
Flags:
--service-port uint16 service port
Global Flags:
-c, --config-file string PMM config file (default "/usr/local/percona/pmm-client/pmm.yml")
Use "pmm-admin add [command] --help" for more information about a command.
[root@master ~]# pmm-admin add mysql --help
This command adds the given MySQL instance to system, metrics and queries monitoring.
When adding a MySQL instance, this tool tries to auto-detect the DSN and credentials.
If you want to create a new user to be used for metrics collecting, provide --create-user option. pmm-admin will create
a new user 'pmm@' automatically using the given (auto-detected) MySQL credentials for granting purpose.
Table statistics is automatically disabled when there are more than 10000 tables on MySQL.
[name] is an optional argument, by default it is set to the client name of this PMM client.
Usage:
pmm-admin add mysql [name] [flags]
Examples:
pmm-admin add mysql --password abc123
pmm-admin add mysql --password abc123 --create-user
pmm-admin add mysql --password abc123 --port 3307 instance3307
Flags:
--create-user create a new MySQL user
--create-user-maxconn uint16 max user connections for a new user (default 10)
--create-user-password string optional password for a new MySQL user
--defaults-file string path to my.cnf
--disable-binlogstats disable binlog statistics
--disable-processlist disable process state metrics
--disable-tablestats disable table statistics
--disable-tablestats-limit uint16 number of tables after which table stats are disabled automatically (default 1000)
--disable-userstats disable user statistics
--force force to create/update MySQL user
--host string MySQL host
--password string MySQL password
--port string MySQL port
--query-source string source of SQL queries: auto, slowlog, perfschema (default "auto")
--socket string MySQL socket
--user string MySQL username
Global Flags:
-c, --config-file string PMM config file (default "/usr/local/percona/pmm-client/pmm.yml")
--service-port uint16 service port
#增加本地mysql實(shí)例
[root@master ~]# pmm-admin add mysql --user root --password root
[linux:metrics] OK, now monitoring this system.
[mysql:metrics] OK, now monitoring MySQL metrics using DSN root:***@unix(/var/lib/mysql/mysql.sock)
[mysql:queries] OK, now monitoring MySQL queries from slowlog using DSN root:***@unix(/var/lib/mysql/mysql.sock)
安裝完成后的訪問地址列表:其實(shí)在 landing page包含了下面三個(gè)功能的頁面
| 各個(gè)組件 | 功能訪問地址 |
|---|---|
| PMM landing page | http://192.168.100.1 |
| Query Analytics (QAN web app) | http://192.168.100.1/qan/ |
| Metrics Monitor (Grafana) | http://192.168.100.1/graph/ User name: admin Password: admin |
| Orchestrator | http://192.168.100.1/orchestrator |
##
下面是一些截圖界面





另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
網(wǎng)站欄目:MySQL-MongoDB開源監(jiān)控利器之PMM-創(chuàng)新互聯(lián)
文章源于:http://chinadenli.net/article38/edopp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管、移動網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)公司、定制網(wǎng)站、搜索引擎優(yōu)化、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容