784 lines
31 KiB
HTML
784 lines
31 KiB
HTML
|
||
<!doctype html>
|
||
<html lang="en" class="no-js">
|
||
<head>
|
||
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||
|
||
<meta name="description" content="Documentation">
|
||
|
||
|
||
<meta name="author" content="Percona LLC">
|
||
|
||
|
||
<link rel="icon" href="_images/percona-favicon.ico">
|
||
<meta name="generator" content="mkdocs-1.2.3, mkdocs-material-8.1.8">
|
||
|
||
|
||
|
||
<title>Setting up `pg_stat_monitor` - pg_stat_monitor Documentation</title>
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="assets/stylesheets/main.6e60f8b8.min.css">
|
||
|
||
|
||
<link rel="stylesheet" href="assets/stylesheets/palette.e6a45f82.min.css">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
|
||
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v3.0.3/css/line.css">
|
||
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
|
||
|
||
<link rel="stylesheet" href="css/version-select.css">
|
||
|
||
<link rel="stylesheet" href="css/toctree.css">
|
||
|
||
<link rel="stylesheet" href="css/percona.css">
|
||
|
||
<script>__md_scope=new URL(".",location),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
|
||
|
||
|
||
|
||
|
||
|
||
</head>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<body dir="ltr" data-md-color-scheme="percona-light" data-md-color-primary="" data-md-color-accent="">
|
||
|
||
|
||
|
||
<script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script>
|
||
|
||
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||
<label class="md-overlay" for="__drawer"></label>
|
||
<div data-md-component="skip">
|
||
|
||
|
||
<a href="#setting-up-pg_stat_monitor" class="md-skip">
|
||
Skip to content
|
||
</a>
|
||
|
||
</div>
|
||
<div data-md-component="announce">
|
||
|
||
</div>
|
||
|
||
<div data-md-component="outdated" hidden>
|
||
<aside class="md-banner md-banner--warning">
|
||
|
||
</aside>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<header class="md-header" data-md-component="header">
|
||
<nav class="md-header__inner md-grid" aria-label="Header">
|
||
<a href="index.html" title="pg_stat_monitor Documentation" class="md-header__button md-logo" aria-label="pg_stat_monitor Documentation" data-md-component="logo">
|
||
|
||
<img src="_images/percona-logo.svg" alt="logo">
|
||
|
||
</a>
|
||
<label class="md-header__button md-icon" for="__drawer">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
|
||
</label>
|
||
<div class="md-header__title" data-md-component="header-title">
|
||
<div class="md-header__ellipsis">
|
||
<div class="md-header__topic">
|
||
<span class="md-ellipsis">
|
||
pg_stat_monitor Documentation
|
||
</span>
|
||
</div>
|
||
<div class="md-header__topic" data-md-component="header-topic">
|
||
<span class="md-ellipsis">
|
||
|
||
Setting up `pg_stat_monitor`
|
||
|
||
</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<form class="md-header__option" data-md-component="palette">
|
||
|
||
|
||
|
||
<input class="md-option" data-md-color-media="(prefers-color-scheme: light)" data-md-color-scheme="percona-light" data-md-color-primary="" data-md-color-accent="" aria-label="Switch to dark mode" type="radio" name="__palette" id="__palette_1">
|
||
|
||
<label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_2" hidden>
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zM7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>
|
||
</label>
|
||
|
||
|
||
|
||
|
||
<input class="md-option" data-md-color-media="(prefers-color-scheme: dark)" data-md-color-scheme="slate" data-md-color-primary="" data-md-color-accent="" aria-label="Switch to light mode" type="radio" name="__palette" id="__palette_2">
|
||
|
||
<label class="md-header__button md-icon" title="Switch to light mode" for="__palette_1" hidden>
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h10a5 5 0 0 0 5-5 5 5 0 0 0-5-5m0 8a3 3 0 0 1-3-3 3 3 0 0 1 3-3 3 3 0 0 1 3 3 3 3 0 0 1-3 3z"/></svg>
|
||
</label>
|
||
|
||
|
||
</form>
|
||
|
||
|
||
|
||
<label class="md-header__button md-icon" for="__search">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
|
||
</label>
|
||
<div class="md-search" data-md-component="search" role="dialog">
|
||
<label class="md-search__overlay" for="__search"></label>
|
||
<div class="md-search__inner" role="search">
|
||
<form class="md-search__form" name="search">
|
||
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
|
||
<label class="md-search__icon md-icon" for="__search">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
|
||
</label>
|
||
<nav class="md-search__options" aria-label="Search">
|
||
|
||
<button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
|
||
</button>
|
||
</nav>
|
||
|
||
</form>
|
||
<div class="md-search__output">
|
||
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||
<div class="md-search-result" data-md-component="search-result">
|
||
<div class="md-search-result__meta">
|
||
Initializing search
|
||
</div>
|
||
<ol class="md-search-result__list"></ol>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="md-header__source">
|
||
<a href="https://github.com/percona/pg_stat_monitor/" title="Go to repository" class="md-source" data-md-component="source">
|
||
<div class="md-source__icon md-icon">
|
||
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
|
||
</div>
|
||
<div class="md-source__repository">
|
||
percona/pg_stat_monitor
|
||
</div>
|
||
</a>
|
||
</div>
|
||
|
||
</nav>
|
||
|
||
</header>
|
||
|
||
<div class="md-container" data-md-component="container">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<main class="md-main" data-md-component="main">
|
||
<div class="md-main__inner md-grid">
|
||
|
||
|
||
|
||
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
|
||
<div class="md-sidebar__scrollwrap">
|
||
<div class="md-sidebar__inner">
|
||
|
||
|
||
|
||
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
|
||
<label class="md-nav__title" for="__drawer">
|
||
<a href="index.html" title="pg_stat_monitor Documentation" class="md-nav__button md-logo" aria-label="pg_stat_monitor Documentation" data-md-component="logo">
|
||
|
||
<img src="_images/percona-logo.svg" alt="logo">
|
||
|
||
</a>
|
||
pg_stat_monitor Documentation
|
||
</label>
|
||
|
||
<div class="md-nav__source">
|
||
<a href="https://github.com/percona/pg_stat_monitor/" title="Go to repository" class="md-source" data-md-component="source">
|
||
<div class="md-source__icon md-icon">
|
||
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
|
||
</div>
|
||
<div class="md-source__repository">
|
||
percona/pg_stat_monitor
|
||
</div>
|
||
</a>
|
||
</div>
|
||
|
||
<ul class="md-nav__list" data-md-scrollfix>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="md-nav__item">
|
||
<a href="index.html" class="md-nav__link">
|
||
Welcome
|
||
</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="md-nav__item md-nav__item--active">
|
||
|
||
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
||
|
||
|
||
|
||
|
||
|
||
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||
Setting up `pg_stat_monitor`
|
||
<span class="md-nav__icon md-icon"></span>
|
||
</label>
|
||
|
||
<a href="setup.html" class="md-nav__link md-nav__link--active">
|
||
Setting up `pg_stat_monitor`
|
||
</a>
|
||
|
||
|
||
|
||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<label class="md-nav__title" for="__toc">
|
||
<span class="md-nav__icon md-icon"></span>
|
||
Table of contents
|
||
</label>
|
||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#supported-platforms" class="md-nav__link">
|
||
Supported platforms
|
||
</a>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#installation-guidelines" class="md-nav__link">
|
||
Installation guidelines
|
||
</a>
|
||
|
||
<nav class="md-nav" aria-label="Installation guidelines">
|
||
<ul class="md-nav__list">
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#installing-from-percona-repositories" class="md-nav__link">
|
||
Installing from Percona repositories
|
||
</a>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#installing-from-postgresql-yum-repositories" class="md-nav__link">
|
||
Installing from PostgreSQL yum repositories
|
||
</a>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#installing-from-pgxn" class="md-nav__link">
|
||
Installing from PGXN
|
||
</a>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#building-from-source" class="md-nav__link">
|
||
Building from source
|
||
</a>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
</nav>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#setup" class="md-nav__link">
|
||
Setup
|
||
</a>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#configuration" class="md-nav__link">
|
||
Configuration
|
||
</a>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#remove-pg_stat_monitor" class="md-nav__link">
|
||
Remove pg_stat_monitor
|
||
</a>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</nav>
|
||
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="md-nav__item">
|
||
<a href="USER_GUIDE.html" class="md-nav__link">
|
||
User guide
|
||
</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="md-nav__item">
|
||
<a href="REFERENCE.html" class="md-nav__link">
|
||
`pg_stat_monitor` view reference
|
||
</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="md-nav__item">
|
||
<a href="COMPARISON.html" class="md-nav__link">
|
||
Comparing pg_stat_monitor and pg_stat_statements
|
||
</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="md-nav__item">
|
||
<a href="RELEASE_NOTES.html" class="md-nav__link">
|
||
Release notes
|
||
</a>
|
||
</li>
|
||
|
||
|
||
|
||
</ul>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||
<div class="md-sidebar__scrollwrap">
|
||
<div class="md-sidebar__inner">
|
||
|
||
|
||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<label class="md-nav__title" for="__toc">
|
||
<span class="md-nav__icon md-icon"></span>
|
||
Table of contents
|
||
</label>
|
||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#supported-platforms" class="md-nav__link">
|
||
Supported platforms
|
||
</a>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#installation-guidelines" class="md-nav__link">
|
||
Installation guidelines
|
||
</a>
|
||
|
||
<nav class="md-nav" aria-label="Installation guidelines">
|
||
<ul class="md-nav__list">
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#installing-from-percona-repositories" class="md-nav__link">
|
||
Installing from Percona repositories
|
||
</a>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#installing-from-postgresql-yum-repositories" class="md-nav__link">
|
||
Installing from PostgreSQL yum repositories
|
||
</a>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#installing-from-pgxn" class="md-nav__link">
|
||
Installing from PGXN
|
||
</a>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#building-from-source" class="md-nav__link">
|
||
Building from source
|
||
</a>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
</nav>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#setup" class="md-nav__link">
|
||
Setup
|
||
</a>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#configuration" class="md-nav__link">
|
||
Configuration
|
||
</a>
|
||
|
||
</li>
|
||
|
||
<li class="md-nav__item">
|
||
<a href="#remove-pg_stat_monitor" class="md-nav__link">
|
||
Remove pg_stat_monitor
|
||
</a>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="md-content" data-md-component="content">
|
||
<article class="md-content__inner md-typeset">
|
||
|
||
|
||
<a href="https://github.com/percona/pg_stat_monitor/edit/master/docs/setup.md" title="Edit this page" class="md-content__button md-icon">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg>
|
||
</a>
|
||
|
||
|
||
<h1 id="setting-up-pg_stat_monitor">Setting up <code>pg_stat_monitor</code><a class="headerlink" href="#setting-up-pg_stat_monitor" title="Permanent link">¶</a></h1>
|
||
<h2 id="supported-platforms">Supported platforms<a class="headerlink" href="#supported-platforms" title="Permanent link">¶</a></h2>
|
||
<p>The PostgreSQL YUM repository supports <code>pg_stat_monitor</code> for all <a href="#supported-versions">supported versions</a> for the following platforms:</p>
|
||
<ul>
|
||
<li>Red Hat Enterprise/Rocky/CentOS/Oracle Linux 7 and 8</li>
|
||
<li>Fedora 33 and 34</li>
|
||
</ul>
|
||
<p>Find the list of supported platforms for <code>pg_stat_monitor</code> within <a href="https://www.percona.com/software/postgresql-distribution">Percona Distribution for PostgreSQL</a> on the <a href="https://www.percona.com/services/policies/percona-software-support-lifecycle#pgsql">Percona Release Lifecycle Overview</a> page.</p>
|
||
<h2 id="installation-guidelines">Installation guidelines<a class="headerlink" href="#installation-guidelines" title="Permanent link">¶</a></h2>
|
||
<p>You can install <code>pg_stat_monitor</code> from the following sources:</p>
|
||
<ul>
|
||
<li><a href="#installing-from-percona-repositories">Percona repositories</a>,</li>
|
||
<li><a href="#installing-from-postgresql-yum-repositories">PostgreSQL PGDG yum repositories</a>,</li>
|
||
<li><a href="#installing-from-pgxn">PGXN</a> and</li>
|
||
<li><a href="#building-from-source">source code</a>.</li>
|
||
</ul>
|
||
<h3 id="installing-from-percona-repositories">Installing from Percona repositories<a class="headerlink" href="#installing-from-percona-repositories" title="Permanent link">¶</a></h3>
|
||
<p>To install <code>pg_stat_monitor</code> from Percona repositories, you need to use the <code>percona-release</code> repository management tool.</p>
|
||
<ol>
|
||
<li><a href="https://www.percona.com/doc/percona-repo-config/installing.html">Install percona-release</a> following the instructions relevant to your operating system</li>
|
||
<li>Enable Percona repository:</li>
|
||
</ol>
|
||
<div class="highlight"><pre><span></span><code>percona-release setup ppgXX
|
||
</code></pre></div>
|
||
<p>Replace XX with the desired PostgreSQL version. For example, to install <code>pg_stat_monitor</code> for PostgreSQL 13, specify <code>ppg13</code>.</p>
|
||
<ol>
|
||
<li>
|
||
<p>Install <code>pg_stat_monitor</code> package</p>
|
||
<ul>
|
||
<li>For Debian and Ubuntu:</li>
|
||
</ul>
|
||
<div class="highlight"><pre><span></span><code>apt-get install percona-pg-stat-monitor13
|
||
</code></pre></div>
|
||
<ul>
|
||
<li>For RHEL and CentOS:</li>
|
||
</ul>
|
||
<div class="highlight"><pre><span></span><code>yum install percona-pg-stat-monitor13
|
||
</code></pre></div>
|
||
</li>
|
||
</ol>
|
||
<h3 id="installing-from-postgresql-yum-repositories">Installing from PostgreSQL <code>yum</code> repositories<a class="headerlink" href="#installing-from-postgresql-yum-repositories" title="Permanent link">¶</a></h3>
|
||
<p>Install the PostgreSQL repositories following the instructions in the <a href="https://www.postgresql.org/download/linux/redhat/">Linux downloads (Red Hat family)</a> chapter in PostgreSQL documentation.</p>
|
||
<p>Install <code>pg_stat_monitor</code>:</p>
|
||
<div class="highlight"><pre><span></span><code>dnf install -y pg_stat_monitor_<VERSION>
|
||
</code></pre></div>
|
||
<p>Replace the <code>VERSION</code> variable with the PostgreSQL version you are using (e.g. specify <code>pg_stat_monitor_13</code> for PostgreSQL 13)</p>
|
||
<h3 id="installing-from-pgxn">Installing from PGXN<a class="headerlink" href="#installing-from-pgxn" title="Permanent link">¶</a></h3>
|
||
<p>You can install <code>pg_stat_monitor</code> from PGXN (PostgreSQL Extensions Network) using the <a href="https://pgxn.github.io/pgxnclient/">PGXN client</a>.</p>
|
||
<p>Use the following command:</p>
|
||
<div class="highlight"><pre><span></span><code>pgxn install pg_stat_monitor
|
||
</code></pre></div>
|
||
<h3 id="building-from-source">Building from source<a class="headerlink" href="#building-from-source" title="Permanent link">¶</a></h3>
|
||
<p>To build <code>pg_stat_monitor</code> from source code, you require the following:</p>
|
||
<ul>
|
||
<li>git</li>
|
||
<li>make</li>
|
||
<li>gcc</li>
|
||
<li>pg_config</li>
|
||
</ul>
|
||
<p>You can download the source code of the latest release of <code>pg_stat_monitor</code> from <a href="https://github.com/Percona/pg_stat_monitor/releases">the releases page on GitHub</a> or using git:</p>
|
||
<div class="highlight"><pre><span></span><code>git clone git://github.com/Percona/pg_stat_monitor.git
|
||
</code></pre></div>
|
||
<p>Compile and install the extension</p>
|
||
<div class="highlight"><pre><span></span><code>cd pg_stat_monitor
|
||
make USE_PGXS=1
|
||
make USE_PGXS=1 install
|
||
</code></pre></div>
|
||
<h2 id="setup">Setup<a class="headerlink" href="#setup" title="Permanent link">¶</a></h2>
|
||
<p>You can enable <code>pg_stat_monitor</code> when your <code>postgresql</code> instance is not running.</p>
|
||
<p><code>pg_stat_monitor</code> needs to be loaded at the start time. The extension requires additional shared memory; therefore, add the <code>pg_stat_monitor</code> value for the <code>shared_preload_libraries</code> parameter and restart the <code>postgresql</code> instance.</p>
|
||
<p>Use the <a href="https://www.postgresql.org/docs/current/sql-altersystem.html">ALTER SYSTEM</a>command from <code>psql</code> terminal to modify the <code>shared_preload_libraries</code> parameter.</p>
|
||
<div class="highlight"><pre><span></span><code><span class="k">ALTER</span><span class="w"> </span><span class="k">SYSTEM</span><span class="w"> </span><span class="k">SET</span><span class="w"> </span><span class="n">shared_preload_libraries</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'pg_stat_monitor'</span><span class="p">;</span><span class="w"></span>
|
||
</code></pre></div>
|
||
<blockquote>
|
||
<p><strong>NOTE</strong>: If you’ve added other modules to the <code>shared_preload_libraries</code> parameter (for example, <code>pg_stat_statements</code>), list all of them separated by commas for the <code>ALTER SYSTEM</code> command. </p>
|
||
<p><img alt="âš " class="twemoji" src="https://twemoji.maxcdn.com/v/latest/svg/26a0.svg" title=":warning:" /> For PostgreSQL 13 and earlier versions,<code>pg_stat_monitor</code> <strong>must</strong> follow <code>pg_stat_statements</code>. For example, <code>ALTER SYSTEM SET shared_preload_libraries = 'foo, pg_stat_statements, pg_stat_monitor'</code>.</p>
|
||
<p>In PostgreSQL 14, modules can be specified in any order.</p>
|
||
</blockquote>
|
||
<p>Start or restart the <code>postgresql</code> instance to apply the changes.</p>
|
||
<ul>
|
||
<li>On Debian and Ubuntu:</li>
|
||
</ul>
|
||
<div class="highlight"><pre><span></span><code>sudo systemctl restart postgresql.service
|
||
</code></pre></div>
|
||
<ul>
|
||
<li>On Red Hat Enterprise Linux and CentOS:</li>
|
||
</ul>
|
||
<div class="highlight"><pre><span></span><code>sudo systemctl restart postgresql-13
|
||
</code></pre></div>
|
||
<p>Create the extension using the <a href="https://www.postgresql.org/docs/current/sql-createextension.html">CREATE EXTENSION</a> command. Using this command requires the privileges of a superuser or a database owner. Connect to <code>psql</code> as a superuser for a database and run the following command:</p>
|
||
<div class="highlight"><pre><span></span><code><span class="k">CREATE</span><span class="w"> </span><span class="n">EXTENSION</span><span class="w"> </span><span class="n">pg_stat_monitor</span><span class="p">;</span><span class="w"></span>
|
||
</code></pre></div>
|
||
<p>This allows you to see the stats collected by <code>pg_stat_monitor</code>.</p>
|
||
<p>By default, <code>pg_stat_monitor</code> is created for the <code>postgres</code> database. To access the statistics from other databases, you need to create the extension for every database.</p>
|
||
<div class="highlight"><pre><span></span><code>-- Select some of the query information, like client_ip, username and application_name etc.
|
||
|
||
postgres=# SELECT application_name, userid AS user_name, datname AS database_name, substr(query,0, 50) AS query, calls, client_ip
|
||
FROM pg_stat_monitor;
|
||
application_name | user_name | database_name | query | calls | client_ip
|
||
------------------+-----------+---------------+---------------------------------------------------+-------+-----------
|
||
psql | vagrant | postgres | SELECT application_name, userid::regrole AS user_ | 1 | 127.0.0.1
|
||
psql | vagrant | postgres | SELECT application_name, userid AS user_name, dat | 3 | 127.0.0.1
|
||
psql | vagrant | postgres | SELECT application_name, userid AS user_name, dat | 1 | 127.0.0.1
|
||
psql | vagrant | postgres | SELECT application_name, userid AS user_name, dat | 8 | 127.0.0.1
|
||
psql | vagrant | postgres | SELECT bucket, substr(query,$1, $2) AS query, cmd | 1 | 127.0.0.1
|
||
(5 rows)
|
||
</code></pre></div>
|
||
<p>To learn more about <code>pg_stat_monitor</code> features and usage, see <a href="https://github.com/percona/pg_stat_monitor/blob/master/docs/USER_GUIDE.md">User Guide</a>. To view all other data elements provided by <code>pg_stat_monitor</code>, please see the <a href="REREFENCE.md"><code>pg_stat_monitor</code> view reference</a>.</p>
|
||
<h2 id="configuration">Configuration<a class="headerlink" href="#configuration" title="Permanent link">¶</a></h2>
|
||
<p>You can find the configuration parameters of the <code>pg_stat_monitor</code> extension in the <code>pg_stat_monitor_settings</code> view. To change the default configuration, specify new values for the desired parameters using the GUC (Grant Unified Configuration) system. To learn more, refer to the <a href="https://github.com/percona/pg_stat_monitor/blob/master/docs/USER_GUIDE.md#configuration">Configuration</a> section of the user guide.</p>
|
||
<h2 id="remove-pg_stat_monitor">Remove <code>pg_stat_monitor</code><a class="headerlink" href="#remove-pg_stat_monitor" title="Permanent link">¶</a></h2>
|
||
<p>To uninstall <code>pg_stat_monitor</code>, do the following:</p>
|
||
<ol>
|
||
<li>
|
||
<p>Disable statistics collection. Establish the <code>psql</code> session and run the following command :</p>
|
||
<div class="highlight"><pre><span></span><code><span class="k">ALTER</span><span class="w"> </span><span class="k">SYSTEM</span><span class="w"> </span><span class="k">SET</span><span class="w"> </span><span class="n">pg_stat_monitor</span><span class="p">.</span><span class="n">pgsm_enable</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span>
|
||
</code></pre></div>
|
||
</li>
|
||
<li>
|
||
<p>Drop <code>pg_stat_monitor</code> extension:</p>
|
||
<div class="highlight"><pre><span></span><code><span class="k">DROP</span><span class="w"> </span><span class="n">EXTENSION</span><span class="w"> </span><span class="n">pg_stat_monitor</span><span class="p">;</span><span class="w"></span>
|
||
</code></pre></div>
|
||
</li>
|
||
<li>
|
||
<p>Remove <code>pg_stat_monitor</code> from the <code>shared_preload_libraries</code> configuration parameter:</p>
|
||
<div class="highlight"><pre><span></span><code><span class="k">ALTER</span><span class="w"> </span><span class="k">SYSTEM</span><span class="w"> </span><span class="k">SET</span><span class="w"> </span><span class="n">shared_preload_libraries</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">''</span><span class="p">;</span><span class="w"></span>
|
||
</code></pre></div>
|
||
<div class="admonition important">
|
||
<p class="admonition-title">Important</p>
|
||
<p>If the <code>shared_preload_libraries</code> parameter includes other modules, specify them all for the <code>ALTER SYSTEM SET</code> command to keep using them.</p>
|
||
</div>
|
||
</li>
|
||
<li>
|
||
<p>Restart the <code>postgresql</code> instance to apply the changes. The following command restarts PostgreSQL 13. Replace the version value with the one you are using. </p>
|
||
<ul>
|
||
<li>On Debian and Ubuntu:</li>
|
||
</ul>
|
||
<div class="highlight"><pre><span></span><code>sudo systemctl restart postgresql.service
|
||
</code></pre></div>
|
||
<ul>
|
||
<li>On Red Hat Enterprise Linux and CentOS:</li>
|
||
</ul>
|
||
<div class="highlight"><pre><span></span><code>sudo systemctl restart postgresql-13
|
||
</code></pre></div>
|
||
</li>
|
||
</ol>
|
||
|
||
<hr>
|
||
<div class="md-source-file">
|
||
<small>
|
||
|
||
Last update:
|
||
2022-01-19
|
||
|
||
</small>
|
||
</div>
|
||
|
||
|
||
</article>
|
||
</div>
|
||
</div>
|
||
|
||
<a href="#" class="md-top md-icon" data-md-component="top" data-md-state="hidden">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"/></svg>
|
||
Back to top
|
||
</a>
|
||
|
||
</main>
|
||
|
||
<footer class="md-footer">
|
||
|
||
<nav class="md-footer__inner md-grid" aria-label="Footer">
|
||
|
||
|
||
<a href="index.html" class="md-footer__link md-footer__link--prev" aria-label="Previous: Welcome" rel="prev">
|
||
<div class="md-footer__button md-icon">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
|
||
</div>
|
||
<div class="md-footer__title">
|
||
<div class="md-ellipsis">
|
||
<span class="md-footer__direction">
|
||
Previous
|
||
</span>
|
||
Welcome
|
||
</div>
|
||
</div>
|
||
</a>
|
||
|
||
|
||
|
||
<a href="USER_GUIDE.html" class="md-footer__link md-footer__link--next" aria-label="Next: User guide" rel="next">
|
||
<div class="md-footer__title">
|
||
<div class="md-ellipsis">
|
||
<span class="md-footer__direction">
|
||
Next
|
||
</span>
|
||
User guide
|
||
</div>
|
||
</div>
|
||
<div class="md-footer__button md-icon">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
|
||
</div>
|
||
</a>
|
||
|
||
</nav>
|
||
|
||
<div class="md-footer-meta md-typeset">
|
||
<div class="md-footer-meta__inner md-grid">
|
||
<div class="md-copyright">
|
||
|
||
<div class="md-copyright__highlight">
|
||
Percona LLC, © 2022
|
||
</div>
|
||
|
||
|
||
Made with
|
||
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
|
||
Material for MkDocs
|
||
</a>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
|
||
</div>
|
||
<div class="md-dialog" data-md-component="dialog">
|
||
<div class="md-dialog__inner md-typeset"></div>
|
||
</div>
|
||
<script id="__config" type="application/json">{"base": ".", "features": ["search.highlight", "navigation.top"], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "search": "assets/javascripts/workers/search.22074ed6.min.js", "version": {"provider": "mike"}}</script>
|
||
|
||
|
||
<script src="assets/javascripts/bundle.960e086b.min.js"></script>
|
||
|
||
<script src="js/version-select.js"></script>
|
||
|
||
|
||
</body>
|
||
</html> |