mamonsu — a monitoring agent for collecting Postgres Pro and system metrics.
mamonsu { report | tune }
mamonsu agent action
mamonsu zabbix {template | host | hostgroup} zabbix-action
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.
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 17.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 for mamonsu to connect as. You can omit the -W option if the password is not required.
mamonsu bootstrap --hosthost_ip--dbnamedatabase_name--usernameusername-Wpassword
As a result, mamonsu creates several tables
with the mamonsu prefix in the specified
database. Do not delete these tables as they are required for
mamonsu to work.
mamonsu enables you to control some of the zabbix server functionality from the command line. You can create and delete zabbix hosts and host groups, as well as create, delete, or import zabbix templates. If you are going run zabbix-related commands, configure the following environment variables for your zabbix server:
Set the ZABBIX_USER and ZABBIX_PASSWD variables to the login and password of your zabbix account, respectively.
Set the ZABBIX_URL to http://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 new zabbix host group and host to use for metrics collection:
mamonsu zabbix hostgroup createhostgroup_idmamonsu zabbix host createhost_namehostgroup_idtemplate_idIP_address
Edit the agent.conf configuration file
pre-installed with mamonsu. By default, agent.conf is located in the mamonsu installation directory.
Configure zabbix-related settings. You must
set address to the zabbix server address and specify the name of the zabbix host that will receive the collected metrics. You can find the hosts available for your account in the zabbix web interface under > .
[zabbix] ; enabled by default enabled =Trueclient =zabbix_host_nameaddress =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 a postgres user. If the
password is not required, set the password
parameter to None.
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 the query_timeout parameter
to modify this behavior. If you are using a custom port for
Postgres Pro, make sure to change the port
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 the
enabled parameter to
False in the corresponding section of the
agent.conf file.
[system] ; enabled by default enabled = True
Export a template for zabbix:
mamonsu export template template.xml
mamonsu generates the
template.xml file in your current
directory.
Import the template.xml into
zabbix:
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 your zabbix 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.
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.
agentmamonsu agent command provides access to the available metrics from the command line. You can specify one of the following actions:
versionDisplay mamonsu version.
metric-listShow the list of available metrics.
metric-get metric_nameSpecify the metric to monitor. You can get the list of available metrics using the metric-list option.
zabbix templateManage the zabbix template using one of the actions described in the section called “zabbix Actions”.
zabbix hostManage the zabbix host using one of the actions described in the section called “zabbix Actions”.
zabbix hostgroupManage the zabbix host group using one of the actions described in the section called “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.
show object_nameDisplay the details about the specified template, host, or host group.
id object_nameShow ID of the specified object.
delete object_idDelete the specified object.
create hostgroup_namecreate host_name hostgroup_id
template_id ip_addressCreate a new host or a host group.
export template_nameGenerate a zabbix template.
infoDisplay detailed information about the specified host using one of the following options:
templates host_idDisplay the list of templates available for the specified host.
hostgroups host_idDisplay the host groups to which the specified host belongs.
graphs host_idDisplay the graphs available for the specified host.
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
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 the zabbix server.