Skip to content

Commit 2eb7a3b

Browse files
committed
Merge branch 'PGPROEE9_6' of gitlab.postgrespro.ru:pgpro-dev/postgrespro into PGPROEE9_6
2 parents cf4a24a + 07ee401 commit 2eb7a3b

File tree

9 files changed

+1516
-689
lines changed

9 files changed

+1516
-689
lines changed

doc/src/sgml/contrib.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,5 +227,6 @@ pages.
227227
</para>
228228

229229
&pgstandby;
230+
&mamonsu;
230231
</sect1>
231232
</appendix>

doc/src/sgml/filelist.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
<!ENTITY jsquery SYSTEM "jsquery.sgml">
136136
<!ENTITY lo SYSTEM "lo.sgml">
137137
<!ENTITY ltree SYSTEM "ltree.sgml">
138+
<!ENTITY mamonsu SYSTEM "mamonsu.sgml">
138139
<!ENTITY mchar SYSTEM "mchar.sgml">
139140
<!ENTITY oid2name SYSTEM "oid2name.sgml">
140141
<!ENTITY online-analyze SYSTEM "online-analyze.sgml">

doc/src/sgml/mamonsu.sgml

Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
<!-- doc/src/sgml/mamonsu.sgml -->
2+
3+
<refentry id="mamonsu">
4+
<indexterm zone="mamonsu">
5+
<primary>mamonsu</primary>
6+
</indexterm>
7+
8+
<refmeta>
9+
<refentrytitle><application>mamonsu</application></refentrytitle>
10+
<manvolnum>1</manvolnum>
11+
<refmiscinfo>Application</refmiscinfo>
12+
</refmeta>
13+
14+
<refnamediv>
15+
<refname>mamonsu</refname>
16+
<refpurpose> a monitoring agent for collecting <productname>PostgreSQL</productname> and system metrics.</refpurpose>
17+
</refnamediv>
18+
19+
<refsect1><title>Description</title>
20+
<para>
21+
<filename>mamonsu</filename> is an active monitoring agent for
22+
<productname>&productname;</productname>. Based on <filename>zabbix</filename>,
23+
<filename>mamonsu</filename> provides an extensible cross-platform
24+
solution that can collect and visualize multiple <productname>PostgreSQL</productname> and
25+
system metrics.
26+
</para>
27+
<para>
28+
The <filename>mamonsu</filename> agent includes the following
29+
components:
30+
</para>
31+
<itemizedlist>
32+
<listitem>
33+
<para>
34+
A supervisor process that monitors all the running threads.
35+
</para>
36+
</listitem>
37+
<listitem>
38+
<para>
39+
Plugins that specify which metrics to collect, and how to
40+
visualize the collected data. To ensure a stable connection to
41+
the monitored system, <filename>mamonsu</filename> plugins use a
42+
<productname>PostgreSQL</productname> connection pooler.
43+
</para>
44+
</listitem>
45+
</itemizedlist>
46+
<para>
47+
If required, you can add your own custom plugins to monitor specific
48+
metrics critical for your system.
49+
</para>
50+
<refsect2 id="installation-and-setup">
51+
<title>Installation and Setup</title>
52+
<para>
53+
To use <filename>mamonsu</filename>, you must have a <filename>zabbix</filename> account and a <filename>zabbix</filename> server set up, and install the
54+
<filename>zabbix</filename> agent on the system you are going to monitor.</para>
55+
<para>Pre-built <filename>mamonsu</filename> packages are
56+
provided together with <productname>&productname;</productname>, but have a
57+
separate installer. Once you have installed both <productname>&productname;</productname> and <filename>mamonsu</filename>, complete the following
58+
steps to set up metrics collection:
59+
</para>
60+
<orderedlist>
61+
<listitem>
62+
<para>
63+
If you are starting from scratch, configure your <productname>&productname;</productname> instance and intialize a new database. For details, see
64+
<xref linkend="creating-cluster">.
65+
</para>
66+
</listitem>
67+
<listitem>
68+
<para>
69+
Bootstrap <filename>mamonsu</filename>. You must specify the IP
70+
address of the host you are going to monitor and the first database to connect to, as well as provide the username and password of the <productname>PostgreSQL</productname> user for <filename>mamonsu</filename> to connect as. You can omit the <literal>-W</literal> option if the password is not required.
71+
</para>
72+
<programlisting>
73+
mamonsu bootstrap --host <replaceable>host_ip</replaceable> --dbname <replaceable>database_name</replaceable> --username <replaceable>username</replaceable> -W <replaceable>password</replaceable>
74+
</programlisting>
75+
<para>
76+
As a result, <filename>mamonsu</filename> creates several tables
77+
with the <filename>mamonsu</filename> prefix in the specified
78+
database. Do not delete these tables as they are required for
79+
<filename>mamonsu</filename> to work.
80+
</para>
81+
</listitem>
82+
<listitem>
83+
<para>
84+
If you are going to use <filename>zabbix</filename> from the
85+
command line, configure the following environment variables
86+
for your <filename>zabbix</filename> server:
87+
</para>
88+
<itemizedlist>
89+
<listitem>
90+
<para>Set the <varname>ZABBIX_USER</varname> and <varname>ZABBIX_PASSWD</varname> variables to the login and password of your <filename>zabbix</filename> account, respectively.</para>
91+
</listitem>
92+
<listitem>
93+
<para>Set the <varname>ZABBIX_URL</varname> to <literal>'http://zabbix/'</literal></para>
94+
</listitem>
95+
</itemizedlist>
96+
<para>
97+
If you configure these variables, you can omit the
98+
following options in the subsequent commands:
99+
</para>
100+
<programlisting>
101+
--url=http://zabbix/ --user=<replaceable>zabbix_login</replaceable> --password=<replaceable>zabbix_password</replaceable>
102+
</programlisting>
103+
</listitem>
104+
<listitem>
105+
<para>
106+
Edit the <filename>agent.conf</filename> configuration file
107+
pre-installed with <filename>mamonsu</filename>. By default, <filename>agent.conf</filename> is located in the <filename>mamonsu</filename> installation directory.
108+
</para>
109+
<itemizedlist>
110+
<listitem>
111+
<para>
112+
Configure <filename>zabbix</filename>-related settings. You must
113+
set <varname>address</varname>to the <filename>zabbix</filename> server address and specify the name of the <filename>zabbix</filename> host that will receive the collected metrics. You can find the hosts available for your account in the <filename>zabbix</filename> web interface under <emphasis role="srong"><guimenu>Configuration</guimenu></emphasis> > <emphasis role="srong"><guimenu>Hosts</guimenu></emphasis>.
114+
</para>
115+
<programlisting>
116+
[zabbix]
117+
; enabled by default
118+
enabled = <literal>True</literal>
119+
client = <replaceable>zabbix_host_name</replaceable>
120+
address = <replaceable>zabbix_server_ip</replaceable>
121+
</programlisting>
122+
<note><para>If required, you can create a new <filename>zabbix</filename> host
123+
from the command line:
124+
</para>
125+
<programlisting>
126+
mamonsu zabbix host create \<replaceable>host_name</replaceable> \<replaceable>hostgroup_id</replaceable> \<replaceable>template_id</replaceable> \<replaceable>host_ip</replaceable> --url=http://zabbix/ --user=<replaceable>zabbix_login</replaceable> --password=<replaceable>zabbix_password</replaceable>
127+
</programlisting></note></listitem>
128+
<listitem>
129+
<para>
130+
Specify the <productname>PostgreSQL</productname> user and the database to connect to. In
131+
the example below, we connect to a <literal>postgres</literal>
132+
database as a <literal>postgres</literal> user. If the
133+
password is not required, set the <literal>password</literal>
134+
parameter to <literal>None</literal>.
135+
<filename>mamonsu</filename> will start collecting metrics
136+
starting from this database, and will try to connect to other
137+
databases available in your system. By default,
138+
<filename>mamonsu</filename> collects metrics data each 10ms.
139+
You can change the <literal>query_timeout</literal> parameter
140+
to modify this behavior. If you are using a custom port for
141+
<productname>&productname;</productname>, make sure to change the <literal>port</literal>
142+
parameter accordingly.
143+
</para>
144+
<programlisting>
145+
[postgres]
146+
; enabled by default
147+
enabled = True
148+
user = postgres
149+
database = postgres
150+
; empty password
151+
password = None
152+
port = 5432
153+
query_timeout = 10
154+
</programlisting>
155+
</listitem>
156+
<listitem>
157+
<para>
158+
By default, <filename>mamonsu</filename> will collect both
159+
<productname>PostgreSQL</productname> and system metrics. If required, you can disable
160+
metrics collection of either type by setting the
161+
<literal>enabled</literal> parameter to
162+
<literal>False</literal> in the corresponding section of the
163+
<filename>agent.conf</filename> file.
164+
</para>
165+
<programlisting>
166+
[system]
167+
; enabled by default
168+
enabled = True
169+
</programlisting>
170+
</listitem></itemizedlist>
171+
</listitem>
172+
<listitem>
173+
<para>
174+
Export a template for <filename>zabbix</filename>:
175+
</para>
176+
<programlisting>
177+
mamonsu export template template.xml
178+
</programlisting>
179+
<para>
180+
<filename>mamonsu</filename> generates the
181+
<literal>template.xml</literal> file in your current
182+
directory.
183+
</para>
184+
</listitem>
185+
<listitem>
186+
<para>
187+
Import the <literal>template.xml</literal> into
188+
<filename>zabbix</filename>:
189+
</para>
190+
<programlisting>
191+
mamonsu zabbix template export template.xml --url=http://zabbix/ --user=<replaceable>zabbix_login</replaceable> --password=<replaceable>zabbix_password</replaceable>
192+
</programlisting>
193+
<para>
194+
To upload the template through the <filename>zabbix</filename> web interface, you can go to <emphasis role="strong">Templates</emphasis> > <emphasis role="strong">Import</emphasis> in your <filename>zabbix</filename> account.</para>
195+
</listitem>
196+
<listitem>
197+
<para>
198+
Add the template to your monitoring host. In the web interface, select your host, go to <emphasis role="strong">Templates</emphasis>, click <emphasis role="strong">Add</emphasis>, select the <literal>PostgresPro-Linux</literal> template, and click <emphasis role="strong">Update</emphasis>.</para>
199+
</listitem>
200+
</orderedlist>
201+
<para>
202+
When the setup is complete, start <filename>mamonsu</filename>:
203+
</para>
204+
<programlisting>
205+
service mamonsu start
206+
</programlisting>
207+
<para>
208+
<filename>mamonsu</filename> picks up all the parameters from the
209+
configuration file and starts monitoring your system.
210+
</para>
211+
</refsect2>
212+
<refsect2 id="collecting-metrics-data">
213+
<title>Collecting Metrics Data</title>
214+
<para>
215+
To view the list of available metrics, run the following command:
216+
</para>
217+
<programlisting>
218+
mamonsu agent metric-list
219+
</programlisting>
220+
<para>
221+
To monitor a specific metric, run:
222+
</para>
223+
<programlisting>
224+
mamonsu agent metric-get <replaceable>key</replaceable>
225+
</programlisting>
226+
<para>
227+
where <replaceable>key</replaceable> is the name of the metric. You can view graphs for the
228+
collected metrics in the <filename>zabbix</filename> web interface under the <emphasis role="strong"><guimenu>Graphs</guimenu></emphasis> menu.
229+
</para>
230+
<para>
231+
To create a report about the used hardware and <productname>PostgreSQL</productname>, run:
232+
</para>
233+
<programlisting>
234+
mamonsu report
235+
</programlisting>
236+
<para>
237+
Based on the hardware information, <filename>mamonsu</filename>
238+
enables you to make a generic optimization for your system and the
239+
<productname>PostgreSQL</productname> instance:
240+
</para>
241+
<programlisting>
242+
mamonsu tune
243+
</programlisting>
244+
</refsect2>
245+
246+
<refsect2 id="mamonsu-adding-custom-plugins">
247+
<title>Adding Custom Plugins</title>
248+
<para>To add your own custom plugin to <filename>mamonsu</filename>, follow these steps:</para>
249+
250+
<orderedlist>
251+
<listitem><para>Make sure a plugin directory is defined in your configuration file, and put your plugin files into this directory.</para>
252+
<programlisting>
253+
[plugins]
254+
directory = /etc/mamonsu/plugins
255+
</programlisting>
256+
</listitem>
257+
<listitem><para>Re-export the <filename>zabbix</filename> template:</para>
258+
<programlisting>
259+
mamonsu -c agent.conf -e template.xml
260+
</programlisting>
261+
</listitem>
262+
<listitem>
263+
<para>
264+
Upload the new <filename>template.xml</filename> to the <filename>zabbix</filename> server.
265+
</para>
266+
</listitem>
267+
</orderedlist>
268+
</refsect2>
269+
</refsect1>
270+
</refentry>

0 commit comments

Comments
 (0)