PMM安装和部署

hyming011 2021-09-01 原文


PMM安装和部署

###### 服务器信息

### 生产环境

IP     10.0.5.179

### 开发环境

IP     10.0.2.76

 

###### PMM构构图

 

PMM监控工具自带监控LINUX,MySQL,MongoDB
pmm重要组件 grafana,prometheus
https://grafana.com/ //grafana作为数据展示
https://prometheus.io/ //数据采集数据库

 

###### mysql数据库服务配置

https://www.percona.com/doc/percona-monitoring-and-management/conf-mysql.html

innodb_monitor_enable = all

docker run -d -p 80:80 –volumes-from pmm-data –name pmm-server -e SERVER_USER=pmm -e SERVER_PASSWORD=123456 -e METRICS_MEMORY=786432 –restart always –init percona/pmm-server:1.2.0

PMM 1.2.0需要加 METRICS_MEMORY=786432

https://www.percona.com/forums/questions-discussions/percona-monitoring-and-management/49047-pmm-1-2-0-a-lot-of-data-is-not-shown

 

###### PMM监控工具安装
参考:https://www.percona.com/doc/percona-monitoring-and-management/deploy/index.html
       https://docs.docker.com/engine/installation/linux/centos 

### 第一步:安装docker

1.yum remove docker docker-common container-selinux docker-selinux docker-engine 

yum install -y yum-utils

yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo

yum makecache fast

yum list docker-ce.x86_64 –showduplicates |sort -r

yum install docker-ce.x86_64

 

### 修改默认存储路径

vim /usr/lib/systemd/system/docker.service 

ExecStart=/usr/bin/dockerd -g /apps/docker/pmm (线上环境179的配置)

 

1. mkdir /home/docker(你想要docker存放image的目录)

2. systemctl stop docker

3. vi /usr/lib/systemd/system/docker.service

4. 添加 -g /home/docker (本地开发环境10.0.2.76的配置)

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket

[Service]
Type=notify
ExecStart=/usr/bin/docker daemon -g /home/docker -H fd://
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity

[Install]
WantedBy=multi-user.target

 

### 启动

systemctl start docker

### 第二步:安装PMM服务端安装

# 配置加速镜像

1.curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://396e823a.m.daocloud.io //开启镜像加速,由于docker镜像被墙

[root@pgxl-71 ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://396e823a.m.daocloud.io
docker version >= 1.12
{“registry-mirrors”: [“http://396e823a.m.daocloud.io“]}
Success.
You need to restart docker to take effect: sudo systemctl restart docker

systemctl restart docker // docker重启

 # 添加pmm-server镜像

docker pull percona/pmm-server:latest

# 添加数据容器

2.Create a PMM Data Container //数据目录
$ 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.3 /bin/true

# 启动pmm-server容器
3.Create and Run the PMM Server Container //创建PMM Server
$ docker run -d \
-p 80:80 \
–volumes-from pmm-data \
–name pmm-server \
-e SERVER_USER=admin \
-e SERVER_PASSWORD=password \
–restart always \
–init \
percona/pmm-server:1.1.3

### 第三步:安装PMM客户端安装
参考:https://www.percona.com/doc/percona-monitoring-and-management/deploy/client/yum.html#install-client-yum
1.yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm
yum install pmm-client

[root@pgxl-71 ~]# pmm-admin –help
Usage:
pmm-admin [flags]
pmm-admin [command]

Available Commands:
config Configure PMM Client.
add Add service to monitoring.
remove Remove service from monitoring.
list List monitoring services for this system.
info Display PMM Client information (works offline).
check-network Check network connectivity between client and server.
ping Check if PMM server is alive.
start Start monitoring service.
stop Stop monitoring service.
restart Restart monitoring service.
show-passwords Show PMM Client password information (works offline).
purge Purge metrics data on PMM server.
repair Repair installation.
uninstall Removes all monitoring services with the best effort.

Flags:
-c, –config-file string PMM config file (default “/usr/local/percona/pmm-client/pmm.yml”)
-v, –version show version

Use “pmm-admin [command] –help” for more information about a command.

2.添加MongoDB监控服务,自动会添加Linux相关监控
##### 客户端配置
pmm-admin config –server 10.0.0.148 –server-user admin –server-password password –client-name hostname //

##### mongo服务器配置
pmm-admin add mongodb –cluster cluster1 –uri mongodb://root:123456@localhost:27017/admin
//cluster1 为自定义集群名
//–uri mongodb://root:123456@localhost:27017/admin 为monogo链地址

 

3.添加MySQL监控服务,自动会添加Linux相关监控
pmm-admin config –server 10.0.0.148 –server-user admin –server-password password –client-name hostname

以上3,4操作都会写入配置文件 /usr/local/percona/pmm-client/pmm.yml
pmm-admin 已经封装对prometheus修改

pmm-admin add mysql –user root –socket /apps/dbdat/mysql-5.7.17/mysql.sock –password 123456 mysql143

 

4.添加redis监控服务(生产线已不使用该方式)

wget https://github.com/oliver006/redis_exporter/releases/download/v0.11/redis_exporter-v0.11.linux-amd64.tar.gz
tar -zxvf redis_exporter-v0.11.linux-amd64.tar.gz

[root@pgxl-76 tmp]# ./redis_exporter –help
Usage of ./redis_exporter:
-check-keys string
Comma separated list of keys to export value and length/size
-debug
Output verbose debug information
-log-format string
Log format, valid options are txt and json (default “txt”)
-namespace string
Namespace for metrics (default “redis”)
-redis.addr string
Address of one or more redis nodes, separated by separator (default “redis://localhost:6379“)
-redis.alias string
Redis instance alias for one or more redis nodes, separated by separator
-redis.password string
Password for one or more redis nodes, separated by separator
-separator string
separator used to split redis.addr, redis.password and redis.alias into several elements. (default “,”)
-version
Show version information and exit
-web.listen-address string
Address to listen on for web interface and telemetry. (default “:9121”)
-web.telemetry-path string
Path under which to expose metrics. (default “/metrics”)

启动客户端 ./redis_exporter -redis.addr redis://localhost:6379

redis_exporter 由于没有集成到PMM服务,所以需要修改prometheus,登入PMM服务端 
[root@pgxl-76 tmp]# docker exec -it pmm-server /bin/bash
[root@a5914a0f9617 opt]# vim /etc/prometheus.yml //添加以下
– job_name: redis_exporter
static_configs:
– targets: [\’10.0.2.76:9121\’]

5添加linux监控

pmm-admin config –server 10.0.5.179 –server-user pmm –server-password XXXXXXX –client-name PGXL182
pmm-admin add linux:metrics

 

###邮箱报警添加
进入docker
docker exec -it pmm-server /bin/bash

编缉grafana.ini
vim /etc/grafana/grafana.ini

[smtp]
enabled = true
host = smtp.healthmall.cn:25
user = liuqian@healthmall.cn
password = 123456
from_address = liuqian@healthmall.cn
from_name = Grafana

 
重启pmm-server容器
docker restart pmm-server

### 钉钉报警配置

http://docs.grafana.org/alerting/notifications/

在钉钉上创作一个内部群,并添加webhook机器人。

 

DingDing/DingTalk

Instructions in Chinese.

In DingTalk PC Client:

  1. Click “more” icon on left bottom of the panel.

  2. Click “Robot Manage” item in the pop menu, there will be a new panel call “Robot Manage”.

  3. In the “Robot Manage” panel, select “customised: customised robot with Webhook”.

  4. In the next new panel named “robot detail”, click “Add” button.

  5. In “Add Robot” panel, input a nickname for the robot and select a “message group” which the robot will join in. click “next”.

  6. There will be a Webhook URL in the panel, looks like this: https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxx. Copy this URL to the grafana Dingtalk setting page and then click “finish”.

Dingtalk supports the following “message type”: textlink and markdown. Only the text message type is supported.

 

 

 

升级
docker pull percona/pmm-server:latest
docker stop pmm-server && docker rm pmm-server
docker run -d -p 80:80 -p 9090:9090 –volumes-from pmm-data –name pmm-server -e SERVER_USER=pmm -e SERVER_PASSWORD=ngiISI0Q4g9gfqWz89folKJSi –restart always –init percona/pmm-server:latest

发表于
2018-01-09 16:29 
韩英明的个人笔记 
阅读(3347
评论(0
编辑 
收藏 
举报

 

版权声明:本文为hyming011原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/hyming011/p/8252135.html

PMM安装和部署的更多相关文章

随机推荐

  1. 使用CopyTable工具方法在线备份HBase表

    CopyTable is a simple Apache HBase utility that, unsurp […]...

  2. ps 图片去掉字体或多余部分

    魔棒或套索或钢笔选出多余部分,选框工具-》填充-》内容识别-》溶解 对比  ...

  3. 【加密】RSA简介

    RSA概述 首先看这个加密算法的命名.很有意思,它其实是三个人的名字.早在1977年由麻省理工学院的三位数学家 […]...

  4. 大数据未来前景怎么样?

    事实上,大数据工作者可以施展拳脚的领域非常广泛,从国防部、互联网创业公司到金融机构,到处需要大数据项目来做创新 […]...

  5. 秋天的第一份“干货” I Referer 防盗链,为什么少了个字母 R?

    Referer 为什么叫 Referer?它代表什么意思?在诸多防盗链竞争中它有什么优势? 今天,在聊 Ref […]...

  6. 整合ssm框架

     连载于https://www.cnblogs.com/gscq073240/articles/6298055 […]...

  7. mysql的三种安装方式(详细)

    安装MySQL的方式常见的有三种:  rpm包形式 通用二进制形式  源码编译 1,rpm包形式 (1) 操作 […]...

  8. 有道云笔记Markdown指南 – lolDragon

    有道云笔记Markdown指南 原文地址:http://note.youdao.com/iyoudao/?p= […]...

展开目录

目录导航