设为首页 收藏本站
查看: 2790|回复: 0

[经验分享] MySQL-MongoDB开源监控利器之PMM

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2017-3-3 13:25:16 | 显示全部楼层 |阅读模式
  最近要对数据库的监控体系进行改进,发现Percona 公司的一款开源的监控工具Percona Monitoring and Management(PMM) 对于MySQL的监控指标各项值比较全面准确,现在公司内部的开发测试环境进行了部署体验。    主要的架构图如下:源于官方
pmm-diagram.png
    可以看到主要是由客户端的代理程序node_export\mysqld_export\mongodb_export等和客户端管理工具pmm-admin做为数据的收集方式并发送到服务端的QAN API\Consul API\Prometheus等各个API然后通过Grafana来展示数据指标,界面非常靓丽

    Pmm 的server端的运行方式主要有官方提供的以下三种方式:
      1.已经集成好的Docker方式
      2.集成好的VirtualBox方式
      3. Amazon Machine Image (AMI)
     在这里我用的是Docker方式,轻量部署、升级很方便
    PMM的client安装比较方便,直接安装官方的yum安装就OK了

#详细的请参考官方文档
https://www.percona.com/doc/perc ... nagement/index.html

#Dokcer方式部署
提前准备好系统和Docker服务,安装不在这里展示
1-创建容器的数据磁盘
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/true2-创建容器的运行实例
docker run -d \   -p 80:80 \   --volumes-from pmm-data \   --name pmm-server \   --restart always \   percona/pmm-server:1.1.1

#客户端安装
[iyunv@master ~]# yum install http://www.percona.com/downloads ... se-0.1-4.noarch.rpm
[iyunv@master ~]# yum install -y pmm-client

#增加客户端mysql监控

[iyunv@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

[iyunv@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'.

#命令帮助
[iyunv@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.
[iyunv@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实例
[iyunv@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)

安装完成后的访问地址列表:其实在 landing page包含了下面三个功能的页面

[td]
各个组件
功能访问地址
PMM landing pagehttp://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
Orchestratorhttp://192.168.100.1/orchestrator
##

下面是一些截图界面

QQ截图20170303132410.jpg
QQ截图20170303132417.jpg
QQ截图20170303132424.jpg
QQ截图20170303132428.jpg
QQ截图20170303132434.jpg


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-349832-1-1.html 上篇帖子: 构建高性能MYSQL集群系统总结 下篇帖子: Mariadb初始登陆报错 ERROR 1045 (28000) 的解决办法 监控
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表