Skip to content

Instantly share code, notes, and snippets.

@meet59patel
Last active August 20, 2020 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meet59patel/8db7104b419eb0b6fb189b4bca5d4136 to your computer and use it in GitHub Desktop.
Save meet59patel/8db7104b419eb0b6fb189b4bca5d4136 to your computer and use it in GitHub Desktop.
Set up PMM

Structure

PMM-Server: The central part of PMM that aggregates collected data and presents it in the form of tables,dashboards, and graphs in a web interface.

PMM-Client: It installed on every database host that you want to monitor. It collects server metrics, general systemmetrics, and Query Analytics data for a complete performance overview.

image

PMM-server can be installed using: 1. Docker Image 2. Amazon Machine Image 3. OVA (Open Virtual Appliance)

Installation using Docker:

Docker Hub Percona PMM-server Repository: percona/pmm-server

  1. Pull pmm-server (v2.4.0) Docker Image $ docker pull percona/pmm-server:2.4.0

  2. Create pmm-data container (helpful when upgrading PMM)

  $ docker create \
   -v /srv \
   --name pmm-data \
   percona/pmm-server:2.4.0 /bin/true 
  1. Create and launch PMM Server container
   $ docker run -d \
   -p 80:80 \
   -p 443:443 \
   --volumes-from pmm-data \
   --name pmm-server \
   --restart always \
   percona/pmm-server:2.4.0

This will create pmm-server container, mounts volumes from pmm-data container, run it.

PMM-client can be set up on the same system as pmm-server, or different system as well. All the database hosts that you want to monitor has to have pmm-client installed.

Can be installed using: 1. Tar Ball files 2. Packages (DEB for Debian based distros, RPM for Red Hat based distros)

Installation using DEB packages (Ubuntu 16.04)

  1. Configure Percona repositories using the percona-release tool. First you’ll need to download and install the official percona-release package from Percona:

wget https://repo.percona.com/apt/percona-release_latest.generic_all.deb

sudo dpkg -i percona-release_latest.generic_all.deb

  1. Install pmm2-client
sudo apt-get install pmm2-client
  1. Configure this client with the central pmm-server

pmm-admin config --server-insecure-tls --server-url=https://admin:admin@<IP Address>:443

git clone https://github.com/meet59patel/pmm-qa.git
git remote add upstream https://github.com/percona/pmm-qa.git
git fetch upstream 

To continue working on same branch after PR based off of this branch is merged:

https://stackoverflow.com/a/42332860/9749509 (Fixes 1 commit ahead/behind issue. As commit id on upstream are different than made on forked repo.)

# ensures current branch is master
git checkout master

# pulls all new commits made to upstream/master
git pull upstream master

# this will delete all your local changes to master
git reset --hard upstream/master

# take care, this will delete all your changes on your forked master
git push origin master --force
sudo rm -rf /usr/local/percona
sudo rm /usr/bin/pmm-agent
sudo rm /usr/bin/pmm-admin
sudo rm /usr/sbin/pmm-agent
sudo rm /usr/sbin/pmm-admin

echo "Remove PMM-client binary files at this location:"
source ~/.bash_profile
which pmm-agent

image

all:
hosts:
percona.example.com:
children:
pmm-server:
hosts:
pmm-server-1.example.com:
pmm-client:
hosts:
pmm-client-1.example.com:
pmm-client-2.example.com:
pmm-client-other.example.com:
---
- name: Deploy pmm-server using pmm-Framework
connection: network_cli
gather_facts: false
hosts: pmm-server
tasks:
- name: Install latest PMM2 server
script: /dir/to/pmm-framework.sh --setup-server --pmm2
- name: Display the config
debug:
msg: "The hostname of pmm-server is {{ ansible_net_hostname }} and the OS is {{ ansible_net_version }}"
- name: Deploy pmm-client using pmm-Framework
connection: network_cli
gather_facts: false
hosts: pmm-client
tasks:
- name: Install latest PMM2 pmm-client
script: /dir/to/local/pmm-framework.sh --setup-client --pmm2
- name: Display the config
debug:
msg: "The hostname of pmm-client is {{ ansible_net_hostname }} and the OS is {{ ansible_net_version }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment