mamonsu
mamonsu — a monitoring agent for collecting Postgres Pro and system metrics.
Synopsis
mamonsu
{ report
| tune
}
mamonsu
agent action
mamonsu
zabbix {template
| host
| hostgroup
} zabbix-action
Description
mamonsu
is an active monitoring agent for Postgres Pro. Based on zabbix
, mamonsu
provides an extensible cross-platform solution that can collect and visualize multiple Postgres Pro and system metrics.
The mamonsu
agent includes the following components:
A supervisor process that monitors all the running threads.
Plugins that specify which metrics to collect, and how to visualize the collected data.
To ensure a stable connection to the monitored system, mamonsu
plugins use a Postgres Pro connection pooler. If required, you can add your own custom plugins to monitor specific metrics critical for your system.
Installation and Setup
To use mamonsu
, you must have a zabbix
account and a zabbix
server set up.
A pre-built mamonsu
package is provided together with Postgres Pro Standard, but has a separate installer. Once you have installed both Postgres Pro Standard and mamonsu
, complete the following steps to set up metrics collection:
If you are starting from scratch, configure your Postgres Pro instance and initialize a new database. For details, see Section 19.2.
Bootstrap
mamonsu
. You must specify the IP 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 Postgres Pro user formamonsu
to connect as. You can omit the-W
option if the password is not required.mamonsu bootstrap --host
host_ip
--dbnamedatabase_name
--usernameusername
-Wpassword
As a result,
mamonsu
creates several tables with themamonsu
prefix in the specified database. Do not delete these tables as they are required formamonsu
to work.mamonsu
enables you to control some of thezabbix
server functionality from the command line. You can create and deletezabbix
hosts and host groups, as well as create, delete, or importzabbix
templates. If you are going runzabbix
-related commands, configure the following environment variables for yourzabbix
server:Set the
ZABBIX_USER
andZABBIX_PASSWD
variables to the login and password of yourzabbix
account, respectively.Set the
ZABBIX_URL
tohttp://zabbix/
If you configure these variables, you can omit the following options in the subsequent commands:
--url=http://zabbix/ --user=
zabbix_login
--password=zabbix_password
If you do not have a
zabbix
host yet, create a newzabbix
host group and host to use for metrics collection:mamonsu zabbix hostgroup create
hostgroup_id
mamonsu zabbix host createhost_name
hostgroup_id
template_id
IP_address
Edit the
agent.conf
configuration file pre-installed withmamonsu
. By default,agent.conf
is located in themamonsu
installation directory.Configure
zabbix
-related settings. You must setaddress
to thezabbix
server address and specify the name of thezabbix
host that will receive the collected metrics. You can find the hosts available for your account in thezabbix
web interface under > .[zabbix] ; enabled by default enabled =
True
client =zabbix_host_name
address =zabbix_server_ip
Specify the Postgres Pro user and the database to connect to. In the example below, we connect to a
postgres
database as apostgres
user. If the password is not required, set thepassword
parameter toNone
.mamonsu
will start collecting metrics starting from this database, and will try to connect to other databases available in your system. By default,mamonsu
collects metrics data each 10ms. You can change thequery_timeout
parameter to modify this behavior. If you are using a custom port for Postgres Pro, make sure to change theport
parameter accordingly.[postgres] ; enabled by default enabled = True user = postgres database = postgres ; empty password password = None port = 5432 query_timeout = 10
By default,
mamonsu
will collect both Postgres Pro and system metrics. If required, you can disable metrics collection of either type by setting theenabled
parameter toFalse
in the corresponding section of theagent.conf
file.[system] ; enabled by default enabled = True
Export a template for
zabbix
:mamonsu export template template.xml
mamonsu
generates thetemplate.xml
file in your current directory.Import the
template.xml
intozabbix
:mamonsu zabbix template export template.xml --url=http://zabbix/ --user=
zabbix_login
--password=zabbix_password
To upload the template through the
zabbix
web interface, you can go to Templates > Import in yourzabbix
account.Add the template to your monitoring host. In the web interface, select your host, go to Templates, click Add, select the
PostgresPro-Linux
template, and click Update.
When the setup is complete, start mamonsu
:
service mamonsu start
mamonsu
picks up all the parameters from the configuration file and starts monitoring your system.
Options
mamonsu
enables you to manage metrics collection and control some of the zabbix
options from the command line. The mamonsu
can take the following options.
report
Display detailed information about the used hardware and Postgres Pro settings.
tune
Optimize system configuration based on the collected information about the used hardware and Postgres Pro settings.
agent
mamonsu
agent
command provides access to the available metrics from the command line. You can specify one of the following actions:version
Display
mamonsu
version.metric-list
Show the list of available metrics.
metric-get
metric_name
Specify the metric to monitor. You can get the list of available metrics using the
metric-list
option.
zabbix template
Manage the
zabbix
template using one of the actions described in the section called “zabbix Actions”.zabbix host
Manage the
zabbix
host using one of the actions described in the section called “zabbix Actions”.zabbix hostgroup
Manage the
zabbix
host group using one of the actions described in the section called “zabbix Actions”.
zabbix Actions
Using mamonsu
you can control some of the zabbix
server functionality from the command line. Specifically, you can create or delete zabbix
hosts and host groups, as well as generate, import, and delete zabbix
templates using one of the following commands. The object_name
to use must correspond to the type of the zabbix
object specified in the command: template, host, or hostgroup.
list
Display the list of available templates, hosts, or host groups.
show
object_name
Display the details about the specified template, host, or host group.
id
object_name
Show ID of the specified object.
delete
object_id
Delete the specified object.
create
hostgroup_name
create
host_name
hostgroup_id
template_id
ip_address
Create a new host or a host group.
export
template_name
Generate a
zabbix
template.info
Display detailed information about the specified host using one of the following options:
templates
host_id
Display the list of templates available for the specified host.
hostgroups
host_id
Display the host groups to which the specified host belongs.
graphs
host_id
Display the graphs available for the specified host.
Usage
Collecting Metrics Data
To view the list of available metrics, run the following command:
mamonsu agent metric-list
To monitor a specific metric, run:
mamonsu agent metric-get metric_name
where metric_name
is the name of the metric to monitor. You can view graphs for the collected metrics in the zabbix
web interface under the menu.
To create a report about the used hardware and Postgres Pro settings, run:
mamonsu report
Based on the hardware information, mamonsu
enables you to make a generic optimization for your system and the Postgres Pro instance:
mamonsu tune
Adding Custom Plugins
To add your own custom plugin to mamonsu
, follow these steps:
Make sure a plugin directory is defined in your configuration file, and put your plugin files into this directory.
[plugins] directory = /etc/mamonsu/plugins
Re-export the
zabbix
template:mamonsu -c agent.conf -e template.xml
Upload the new
template.xml
to thezabbix
server.