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 formamonsuto connect as. You can omit the-Woption if the password is not required.mamonsu bootstrap --host
host_ip--dbnamedatabase_name--usernameusername-WpasswordAs a result,
mamonsucreates several tables with themamonsuprefix in the specified database. Do not delete these tables as they are required formamonsuto work.mamonsuenables you to control some of thezabbixserver functionality from the command line. You can create and deletezabbixhosts and host groups, as well as create, delete, or importzabbixtemplates. If you are going runzabbix-related commands, configure the following environment variables for yourzabbixserver:Set the
ZABBIX_USERandZABBIX_PASSWDvariables to the login and password of yourzabbixaccount, respectively.Set the
ZABBIX_URLtohttp://zabbix/
If you configure these variables, you can omit the following options in the subsequent commands:
--url=http://zabbix/ --user=
zabbix_login--password=zabbix_passwordIf you do not have a
zabbixhost yet, create a newzabbixhost group and host to use for metrics collection:mamonsu zabbix hostgroup create
hostgroup_idmamonsu zabbix host createhost_namehostgroup_idtemplate_idIP_addressEdit the
agent.confconfiguration file pre-installed withmamonsu. By default,agent.confis located in themamonsuinstallation directory.Configure
zabbix-related settings. You must setaddressto thezabbixserver address and specify the name of thezabbixhost that will receive the collected metrics. You can find the hosts available for your account in thezabbixweb interface under > .[zabbix] ; enabled by default enabled =
Trueclient =zabbix_host_nameaddress =zabbix_server_ipSpecify the Postgres Pro user and the database to connect to. In the example below, we connect to a
postgresdatabase as apostgresuser. If the password is not required, set thepasswordparameter toNone.mamonsuwill start collecting metrics starting from this database, and will try to connect to other databases available in your system. By default,mamonsucollects metrics data each 10ms. You can change thequery_timeoutparameter to modify this behavior. If you are using a custom port for Postgres Pro, make sure to change theportparameter accordingly.[postgres] ; enabled by default enabled = True user = postgres database = postgres ; empty password password = None port = 5432 query_timeout = 10
By default,
mamonsuwill collect both Postgres Pro and system metrics. If required, you can disable metrics collection of either type by setting theenabledparameter toFalsein the corresponding section of theagent.conffile.[system] ; enabled by default enabled = True
Export a template for
zabbix:mamonsu export template template.xml
mamonsugenerates thetemplate.xmlfile in your current directory.Import the
template.xmlintozabbix:mamonsu zabbix template export template.xml --url=http://zabbix/ --user=
zabbix_login--password=zabbix_passwordTo upload the template through the
zabbixweb interface, you can go to Templates > Import in yourzabbixaccount.Add the template to your monitoring host. In the web interface, select your host, go to Templates, click Add, select the
PostgresPro-Linuxtemplate, 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.
reportDisplay detailed information about the used hardware and Postgres Pro settings.
tuneOptimize system configuration based on the collected information about the used hardware and Postgres Pro settings.
agentmamonsuagentcommand provides access to the available metrics from the command line. You can specify one of the following actions:versionDisplay
mamonsuversion.metric-listShow the list of available metrics.
metric-getmetric_nameSpecify the metric to monitor. You can get the list of available metrics using the
metric-listoption.
zabbix templateManage the
zabbixtemplate using one of the actions described in the section called “zabbix Actions”.zabbix hostManage the
zabbixhost using one of the actions described in the section called “zabbix Actions”.zabbix hostgroupManage the
zabbixhost 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.
listDisplay the list of available templates, hosts, or host groups.
showobject_nameDisplay the details about the specified template, host, or host group.
idobject_nameShow ID of the specified object.
deleteobject_idDelete the specified object.
createhostgroup_namecreatehost_namehostgroup_idtemplate_idip_addressCreate a new host or a host group.
exporttemplate_nameGenerate a
zabbixtemplate.infoDisplay detailed information about the specified host using one of the following options:
templateshost_idDisplay the list of templates available for the specified host.
hostgroupshost_idDisplay the host groups to which the specified host belongs.
graphshost_idDisplay 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
zabbixtemplate:mamonsu -c agent.conf -e template.xml
Upload the new
template.xmlto thezabbixserver.

