【MySQL】MySQL監(jiān)控利器PMM

前言:MySQL監(jiān)控也用過好多產(chǎn)品岩馍,包括zabbix、Lepus抖韩、PMM蛀恩,想比較而言,PMM監(jiān)控更加全面帽蝶,安裝配置也更加簡(jiǎn)單赦肋。

一块攒、Server端安裝

server端安裝非常簡(jiǎn)單励稳,我們采用docker的方式來部署。
1.拉取鏡像

docker pull percona/pmm-server:latest

2.創(chuàng)建PMM數(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:latest /bin/true

3.創(chuàng)建PMM服務(wù)器容器

docker run -d -p 80:80 \
  --volumes-from pmm-data \
  --name pmm-server \
  -e SERVER_USER=test \
  -e SERVER_PASSWORD=test \
  -e ORCHESTRATOR_ENABLED=true \
  --restart always \
  percona/pmm-server:latest

4.查看服務(wù)啟動(dòng)

[root@db-monitor-01 tmp]# ps -ef|grep docker
root      8531     1  0 10:38 ?        00:00:05 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --seccomp-profile=/etc/docker/seccomp.json --selinux-enabled --log-driver=journald --signature-verification=false --storage-driver overlay2
root      8538  8531  0 10:38 ?        00:00:03 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc --runtime-args --systemd-cgroup=true
root      9095  8531  0 10:56 ?        00:00:00 /usr/libexec/docker/docker-proxy-current -proto tcp -host-ip 0.0.0.0 -host-port 80 -container-ip 172.17.0.2 -container-port 80
root      9100  8538  0 10:56 ?        00:00:00 /usr/bin/docker-containerd-shim-current 7c5656534fed82420cba57ec9ab3f929b242802dae2dcf3fbb400859d2517b6d /var/run/docker/libcontainerd/7c5656534fed82420cba57ec9ab3f929b242802dae2dcf3fbb400859d2517b6d /usr/libexec/docker/docker-runc-current
root      9660  2640  0 11:25 pts/1    00:00:00 grep --color=auto docker

二囱井、Client安裝

1.安裝rpm包

rpm -ivh pmm-client-1.9.1-1.el7.x86_64.rpm

2.連接server

pmm-admin config --server server_ip --bind-address=client_ip --client-address=client_ip --server-user=admin --server-password=xxx --client-name=xxx

3.收集數(shù)據(jù)

pmm-admin add mysql --user=pmm --password=xxxx --port=3306

三驹尼、常用操作命令

PMM Client相關(guān)

[root@Mariadb-04 tmp]# pmm-admin --help
Usage:
  pmm-admin [flags]
  pmm-admin [command]

Available Commands:
  config         Configure PMM Client. 配置PMM客戶端
  add            Add service to monitoring. 增加監(jiān)控
  remove         Remove service from monitoring. 刪除監(jiān)控服務(wù)
  list           List monitoring services for this system. 列出監(jiān)控服務(wù)
  info           Display PMM Client information (works offline). 打印PMM客戶端信息
  check-network  Check network connectivity between client and server. 檢查網(wǎng)絡(luò)
  ping           Check if PMM server is alive. ping server端
  start          Start monitoring service.開啟服務(wù)
  stop           Stop monitoring service.停止服務(wù)
  restart        Restart monitoring service.重啟服務(wù)
  show-passwords Show PMM Client password information (works offline).顯示客戶端密碼
  purge          Purge metrics data on PMM server.刪除PMM server端監(jiān)控信息
  repair         Repair installation.重新安裝
  uninstall      Removes all monitoring services with the best effort.刪除所有服務(wù)
  help           Help about any command

Flags:
  -c, --config-file string   PMM config file (default "/usr/local/percona/pmm-client/pmm.yml")
  -h, --help                 help for pmm-admin
      --verbose              verbose output
  -v, --version              show version

Use "pmm-admin [command] --help" for more information about a command.

Docker相關(guān)

[root@db-monitor-01 tmp]# docker --help

Usage:  docker COMMAND

A self-sufficient runtime for containers

Options:
      --config string      Location of client config files (default "/root/.docker")
  -D, --debug              Enable debug mode
      --help               Print usage
  -H, --host list          Daemon socket(s) to connect to (default [])
  -l, --log-level string   Set the logging level ("debug", "info", "warn", "error", "fatal") (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default "/root/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default "/root/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default "/root/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit

Management Commands:
  container   Manage containers
  image       Manage images
  network     Manage networks
  node        Manage Swarm nodes
  plugin      Manage plugins
  secret      Manage Docker secrets
  service     Manage services
  stack       Manage Docker stacks
  swarm       Manage Swarm
  system      Manage Docker
  volume      Manage volumes

Commands:
  attach      Attach to a running container
  build       Build an image from a Dockerfile
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  diff        Inspect changes on a container's filesystem
  events      Get real time events from the server
  exec        Run a command in a running container
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  images      List images
  import      Import the contents from a tarball to create a filesystem image
  info        Display system-wide information
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  login       Log in to a Docker registry
  logout      Log out from a Docker registry
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  ps          List containers
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  run         Run a command in a new container
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  search      Search the Docker Hub for images
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  version     Show the Docker version information
  wait        Block until one or more containers stop, then print their exit codes

Run 'docker COMMAND --help' for more information on a command.

四、監(jiān)控界面

MySQL總覽
MySQL innodb監(jiān)控
MySQL 復(fù)制監(jiān)控
OS CPU監(jiān)控
OS disk監(jiān)控

五庞呕、排錯(cuò)

Aug 17 21:07:24 localhost dockerd: time="2016-08-17T21:07:24.864612251+08:00" level=error msg="Attempting next endpoint for push after error: Get https://192.168.41.80:5001/v2/: dial tcp 192.168.41.80:5001: getsockopt: connection refused"
Aug 17 21:07:24 localhost dockerd: time="2016-08-17T21:07:24.864884008+08:00" level=error msg="Attempting next endpoint for push after error: Get https://192.168.41.80:5001/v1/_ping: dial tcp 192.168.41.80:5001: getsockopt: connection refused"

類似于如上錯(cuò)誤解決方法:

vim /etc/docker/daemon.json

{ "insecure-registries":["myregistry.example.com:5000"] }
Restart docker daemon

   systemctl restart docker.service
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末新翎,一起剝皮案震驚了整個(gè)濱河市程帕,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌地啰,老刑警劉巖愁拭,帶你破解...
    沈念sama閱讀 211,348評(píng)論 6 491
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異亏吝,居然都是意外死亡岭埠,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,122評(píng)論 2 385
  • 文/潘曉璐 我一進(jìn)店門蔚鸥,熙熙樓的掌柜王于貴愁眉苦臉地迎上來惜论,“玉大人,你說我怎么就攤上這事止喷」堇啵” “怎么了?”我有些...
    開封第一講書人閱讀 156,936評(píng)論 0 347
  • 文/不壞的土叔 我叫張陵弹谁,是天一觀的道長(zhǎng)乾巧。 經(jīng)常有香客問我,道長(zhǎng)僵闯,這世上最難降的妖魔是什么卧抗? 我笑而不...
    開封第一講書人閱讀 56,427評(píng)論 1 283
  • 正文 為了忘掉前任,我火速辦了婚禮鳖粟,結(jié)果婚禮上社裆,老公的妹妹穿的比我還像新娘。我一直安慰自己向图,他們只是感情好泳秀,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,467評(píng)論 6 385
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著榄攀,像睡著了一般嗜傅。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上檩赢,一...
    開封第一講書人閱讀 49,785評(píng)論 1 290
  • 那天吕嘀,我揣著相機(jī)與錄音,去河邊找鬼贞瞒。 笑死偶房,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的军浆。 我是一名探鬼主播棕洋,決...
    沈念sama閱讀 38,931評(píng)論 3 406
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼乒融!你這毒婦竟也來了掰盘?” 一聲冷哼從身側(cè)響起摄悯,我...
    開封第一講書人閱讀 37,696評(píng)論 0 266
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎愧捕,沒想到半個(gè)月后奢驯,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,141評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡次绘,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,483評(píng)論 2 327
  • 正文 我和宋清朗相戀三年叨橱,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片断盛。...
    茶點(diǎn)故事閱讀 38,625評(píng)論 1 340
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡罗洗,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出钢猛,到底是詐尸還是另有隱情伙菜,我是刑警寧澤,帶...
    沈念sama閱讀 34,291評(píng)論 4 329
  • 正文 年R本政府宣布命迈,位于F島的核電站贩绕,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏壶愤。R本人自食惡果不足惜淑倾,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,892評(píng)論 3 312
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望征椒。 院中可真熱鬧娇哆,春花似錦、人聲如沸勃救。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,741評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)蒙秒。三九已至勃黍,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間晕讲,已是汗流浹背覆获。 一陣腳步聲響...
    開封第一講書人閱讀 31,977評(píng)論 1 265
  • 我被黑心中介騙來泰國(guó)打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留瓢省,地道東北人弄息。 一個(gè)月前我還...
    沈念sama閱讀 46,324評(píng)論 2 360
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像净捅,于是被迫代替她去往敵國(guó)和親疑枯。 傳聞我的和親對(duì)象是個(gè)殘疾皇子辩块,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,492評(píng)論 2 348

推薦閱讀更多精彩內(nèi)容

  • Zabbix簡(jiǎn)介 Zabbix官方網(wǎng)站Zabbix中文文檔 本文系統(tǒng)環(huán)境是CentOS7x86_64, Zabbi...
    Zhang21閱讀 7,968評(píng)論 0 37
  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理蛔六,服務(wù)發(fā)現(xiàn)荆永,斷路器,智...
    卡卡羅2017閱讀 134,629評(píng)論 18 139
  • 一国章、PMM介紹 Percona Monitoring and Management (PMM)是一款開源的用于管理...
    張偉科閱讀 11,693評(píng)論 2 12
  • zabbix是什么在此就不多作介紹了具钥,可以參考之前的文章零代碼如何打造自己的實(shí)時(shí)監(jiān)控預(yù)警系統(tǒng),這篇主要介紹安裝及注...
    歡醉閱讀 1,432評(píng)論 0 2
  • 文/慧欣 那一年我15.你16 你我坐在江心島照了第一張照片液兽, 沒有表達(dá)的情愫我怕讓時(shí)光沖走骂删, ...
    洪一閱讀 290評(píng)論 0 0