Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
mamonsu
Prev UpI.3. AdditionalPostgres Pro Server ApplicationsHome Next

mamonsu

mamonsu — a monitoring agent for collectingPostgres Pro and system metrics

Synopsis

mamonsuagent [agent_action]

mamonsubootstrap-Mmamonsu_user [-c |--config] [-x |--create-extensions] [connection_options]

mamonsuexport {template |config}filename [export_options]

mamonsureport [report_options] [connection_options]

mamonsutune [tuning_options] [connection_options]

mamonsuupload [upload_options]

mamonsuzabbixdashboarduploadtemplate_name

mamonsuzabbix {template |host |hostgroup}server_action

mamonsuzabbixitem {error |lastvalue |lastclock}host_id

mamonsuzabbix version

mamonsu [-c |--config] [-d |--daemonize]

mamonsu--version

mamonsu--help

Description

mamonsu is a monitoring agent for collectingPostgres Pro and system metrics that can be visualized on theZabbix server. Unlike the nativeZabbix Agent configured to collectPostgres Pro metrics,mamonsu uses a single database connection, which allows to minimize performance impact on the monitored system.

Themamonsu agent includes the following components:

  • A supervisor process that monitors database and system activity.

  • Plugins that specify whichPostgres Pro and system metrics to collect.

  • Customizable configuration and template files that define which plugins to use and how to visualize the collected data.

mamonsu is an active agent, which means that it sends the data to theZabbix server once it is collected. Pre-configured to monitor multiplePostgres Pro and system metrics out of the box,mamonsu can be extended with your own custom plugins to track other metrics critical for your system.

mamonsu also provides the command-line interface for updating someZabbix server settings, as well as getting an overview of the monitored system configuration and tuningPostgres Pro and system settings on the fly. You can find the list of allmamonsu commands inthe section called “Command-Line Reference”.

Installation and Setup#

Important

Before you start installation, attentively readCompatibility Considerations.

To usemamonsu, you must create aZabbix account and set up aZabbix server as explained inZabbix documentation. Naturally, you must also have aPostgres Pro instance up and running if you are going to monitorPostgres Pro metrics. If you are configuring yourPostgres Pro cluster from scratch, seeChapter 16 andSection 17.2 forPostgres Pro installation and setup instructions, respectively.

Note

Whilemamonsu can collectPostgres Pro metrics from a remote cluster, system metrics are only collected locally. If you choose to collectPostgres Pro metrics remotely, make sure to disable collection of system metrics to avoid confusion, as they will be displayed under the same host inZabbix.

mamonsu is provided withPostgres Pro Standard as a separate pre-built packagemamonsu (for the detailed installation instructions, seeChapter 16). Once you have installedmamonsu, complete the following steps to set up metrics collection:

  1. Optionally, bootstrapmamonsu

    If you omit this step, metrics can only be collected on behalf of a superuser, which is not recommended.

    In this step, thebootstrap command sets themamonsu user, createsmamonsu schema in the specified or implied database, as well as extensions and objects needed for monitoring.

    bootstrap has no mandatory options. When run without options, it takes the values needed from the configuration file (/etc/mamonsu/agent.conf by default). Below is a simple example of bootstrap:

    1. In the[postgres] section ofagent.conf, specify connection parameters for thePostgres Pro cluster you are going to monitor. For more details, seeConnection Parameters.

    2. Run the following command to bootstrapmamonsu:

      mamonsu bootstrap

      This command will create the usermamonsu with the passwordmamonsu, create monitoring functions in the database specified inagent.conf and grant the right to execute them to themamonsu user.

    In the following example,bootstrap options are passed explicitly.

    1. Create a non-privileged database user formamonsu. For example:

      CREATE USER mamonsu_user WITH PASSWORD 'mamonsu_password';GRANT pg_monitor TO mamonsu_user;

    2. Create a database that will be used for connection toPostgres Pro. For example:

      CREATE DATABASE mamonsu_database OWNER mamonsu_user;

    3. Run the following command to bootstrapmamonsu:

      mamonsu bootstrap -M mamonsu_user -x -c /etc/mamonsu/agent.conf -d mamonsu_database -U postgres --host myhost --port 5432

      For details of the options-M,-x and-c, seebootstrap. For details of other options, seeConnection Options. This command will create monitoring functions in themamonsu_database and grant the right to execute them tomamonsu_user. Thepg_buffercache extension will also be created to ensure collection of metrics on the shared buffer cache, and the path to the configuration file will be changed.

    As a result, a superuser connection is no longer required. Note thatmamonsu also creates several tables in themamonsu schema in the specified database. Do not delete these tables as they are required formamonsu to work.

  2. Configuremamonsu

    Edit theagent.conf configuration file, which is located in the/etc/mamonsu/ directory by default.

    • ConfigureZabbix-related settings. Theaddress field must point to the runningZabbix server, while theclient field must provide the name of theZabbix host. You can find the list of hosts available for your account in theZabbix web interface underConfiguration >Hosts.

      [zabbix]; enabled by defaultenabled =Trueclient =zabbix_host_nameaddress =zabbix_server
    • By default,mamonsu will collect bothPostgres Pro and system metrics. If required, you can disable metrics collection of either type by setting theenabled parameter toFalse in the[postgres] or[system] section of theagent.conf file, respectively.

      [system]; enabled by defaultenabled = True

      Note

      Whilemamonsu can collectPostgres Pro metrics from a remote cluster, system metrics are only collected locally. If you choose to collectPostgres Pro metrics remotely, make sure to disable collection of system metrics to avoid confusion, as they will be displayed under the same host inZabbix.

    • If you are going to collectPostgres Pro metrics, specify connection parameters for thePostgres Pro cluster you are going to monitor. In theuser,password, anddatabase fields, you must specify themamonsu_user,mamonsu_password, and themamonsu_database used for bootstrap, respectively. If you skipped the bootstrap, specify superuser credentials and the database to connect to.

      [postgres]; enabled by defaultenabled = Trueuser =mamonsu_userdatabase =mamonsu_databasepassword =mamonsu_passwordport = 5432

    These are the mainmamonsu settings to get started. You can also fine-tune othermamonsu settings as explained inthe section called “Configuration Parameters”.

  3. Configure how to display metrics on theZabbix server

    1. Generate a template that defines how to visualize the collected metrics on theZabbix server:

      mamonsu export template template.xml

      mamonsu generates thetemplate.xml file in your current directory. By default, the name of the template that will be displayed in theZabbix account isPostgresPro-OS, whereOS is the name of your operating system. To get a template with a different display name, you can run the above command with the--template-name option.

    2. Optionally, specify yourZabbix account settings in the following environment variables on your monitoring system:

      • Set theZABBIX_USER andZABBIX_PASSWD variables to the login and password of yourZabbix account, respectively.

      • Set theZABBIX_URL tohttp://zabbix/

      If you skip this step, you will have to add the following options to allmamonsu zabbix commands that you run:

      --url=http://zabbix/ --user=zabbix_login --password=zabbix_password
    3. Uploadtemplate.xml to theZabbix server.

      mamonsu zabbix template export template.xml

      Alternatively, you can upload the template through theZabbix web interface: log in to yourZabbix account and selectTemplates >Import.

    4. Link the generated template to the host to be monitored.

      In theZabbix web interface, select your host, go toTemplates >Add, select your template, and clickUpdate.

      Tip

      If you would like to link a template with a newZabbix host, you can do it from the command line usingmamonsu zabbix commands. Seethe section called “ManagingZabbix Server Settings from the Command Line” for details.

When the setup is complete, startmamonsu. For example, on Linux systems, you can startmamonsu as a service with the following command:

service mamonsu start

mamonsu picks up all the parameters from themamonsu configuration file and starts monitoring your system.

Command-Line Reference#

agent

Syntax:

mamonsu agent { metric-list | metric-getmetric_name | version }

Provide information on the collected metrics from the command line. You can specify one of the following parameters:

metric-list

Show the list of metrics thatmamonsu is collecting. The output of this command provides the item key of each metric, its latest value, and the time when this value was received.

metric-getmetric_name

Check the latest value for the specified metric. You can get the list of available metrics using themetric-list option.

version

Displaymamonsu version.

bootstrap#

Syntax:

mamonsu bootstrap -Mmamonsu_user        [-c[config_file] | --config[=config_file]]        [-x | --create-extensions] [connection_options]

Bootstrapmamonsu. This command can take the following options:

-M

Specify a non-privileged user that will own allmamonsu processes.

-cconfig_file
--config=config_file

Specify theagent.conf file where the[postgres] section contains the database name to be used if--dbname is not specified throughconnection_options.

Default:/etc/mamonsu/agent.conf

-x
--create-extensions

Create auxiliary extensions. Thepg_buffercache extension will be created, which is no longer created by default. ForPostgres Pro 12 or higher, thebootstrap-x command will also create functions to work with thepgpro_stats extension and grant the right to execute them to themamonsu user.

connection_options

Provide optionalcommand-line connection parameters.

export

Syntax:

mamonsu export configfilename.conf  [--add-plugins=plugin_directory]mamonsu export templatefilename.xml [--add-plugins=plugin_directory]                                     [--template-name=template_name]                                     [--application=application_name]                                     [--old-zabbix]

Generate a template or configuration file for metrics collection. The optional parameters to customize metrics collection are as follows:

--add-plugins=plugin_directory

Collect metrics that are defined in custom plugins located in the specifiedplugin_directory. If you are going to use custom plugins, you must provide this option when generating both the configuration file and the template.

--template-name=template_name

Specify the name of the template that will be displayed on theZabbix server.

Default:PostgresPro-OS, whereOS is the name of your operating system

--application=application_name

Specify an identifier under which the collected metrics will be displayed on theZabbix server.

Default:App-PostgresPro-OS, whereOS is the name of your operating system

--old-zabbix

Export a template forZabbix server version 4.2 or lower. By default, the template is generated in a format compatible with Zabbix 4.4 or higher.

export zabbix-parameters

Syntax:

mamonsu export zabbix-parametersfilename.conf [--add-plugins=plugin_directory]                                     [--plugin-type={pg | sys | all}]                                     [--pg-version=version]                                     [--config=config_file]

Export metrics configuration for use with the nativeZabbix agent. The optional parameters to customize metrics collection are as follows:

--add-plugins=plugin_directory

Collect metrics that are defined in custom plugins located in the specifiedplugin_directory. If you are going to use custom plugins, you must provide this option when generating both the configuration file and the template.

--plugin-type={pg | sys | all}

Specify the type of metrics to collect:

  • pg forPostgres Pro metrics.

  • sys for system metrics.

  • all for bothPostgres Pro and system metrics.

Default:all

--pg-version=version

Specify the major version of the server for which to configure metrics collection.mamonsu can collect metrics for all supportedPostgres Pro versions, as well asPostgreSQL versions starting from 9.5.

Default:10

--config=config_file

Specify theagent.conf file to be used as the source for metrics definitions.

Default:/etc/mamonsu/agent.conf

export zabbix-template

Syntax:

mamonsu export zabbix-templatefilename.conf [--add-plugins=plugin_directory]                                     [--plugin-type={pg | sys | all}]                                     [--template-name=template_name]                                     [--application=application_name]                                     [--config=config_file]                                     [--old-zabbix]

Export a template for use with the nativeZabbix agent. The optional parameters to customize metrics collection are as follows:

--add-plugins=plugin_directory

Collect metrics that are defined in custom plugins located in the specifiedplugin_directory. If you are going to use custom plugins, you must provide this option when generating both the configuration file and the template.

--plugin-type={pg | sys | all}

Specify the type of metrics to collect:

  • pg configuresPostgres Pro metrics.

  • sys configures system metrics.

  • all configures bothPostgres Pro and system metrics.

Default:all

--template-name=template_name

Specify the name of the template that will be displayed on theZabbix server.

Default:PostgresPro-OS, whereOS is the name of your operating system

--application=application_name

Specify an identifier under which the collected metrics will be displayed on theZabbix server.

Default:App-PostgresPro-OS, whereOS is the name of your operating system

--config=config_file

Specify theagent.conf file to be used as the source for metrics definitions.

Default:/etc/mamonsu/agent.conf

--old-zabbix

Export a template forZabbix server version 4.2 or lower. By default, the template is generated in a format compatible with Zabbix 4.4 or higher.

report

Syntax:

mamonsu report [--run-system=Boolean] [--run-postgres=Boolean]               [--print-report=Boolean] [--report-path=report_file]               [--disable-sudo] [connection_options]

Generate a detailed report on the hardware, operating system, memory usage and other parameters of the monitored system, as well asPostgres Pro configuration.

The following optional parameters customize the report:

--run-system=Boolean

Include system information into the generated report.

Default:True

--run-postgres=Boolean

Include information onPostgres Pro into the generated report.

Default:True

--print-report=Boolean

Print the report tostdout.

Default:True

--report-path=report_file

Save the report into the specified file.

Default:/tmp/report.txt

--disable-sudo

Do not report data that can only be received with superuser rights. This option is only available for Linux systems.

connection_options

Provide optionalcommand-line connection parameters.

tune

Syntax:

mamonsu tune [--dry-run] [--disable-sudo] [--log-level {INFO|DEBUG|WARN}]             [--dont-tune-pgbadger] [--dont-reload-postgresql]             [connection_options]

OptimizePostgres Pro and system configuration based on the collected statistics. You can use the following options:

--dry-run

Display the settings to be tuned without changing the actual system andPostgres Pro configuration.

--disable-sudo

Do not tune the settings that can only be changed by a superuser. This option is only available for Linux systems.

--dont-tune-pgbadger

Do not tunepgbadger parameters.

--log-level { INFO | DEBUG | WARN}

Change the logging level.

Default:INFO

--dont-reload-postgresql

Forbidmamonsu to run thepg_reload_conf() function. If you specify this option, the modified settings that require reloadingPostgres Pro configuration do not take effect immediately.

connection_options

Provide optionalcommand-line connection parameters.

upload#

Syntax:

mamonsu upload [--zabbix-file=metrics_file]               [--zabbix-address=zabbix_address] [--zabbix-port=port_number]                [--zabbix-client=zabbix_host_name] [--zabbix-log-level={INFO|DEBUG|WARN}]

Upload metrics data previously saved into a file onto a Zabbix server for visualization. For details on how to save metrics into a file, seethe section called “Logging Parameters”.

This command can take the following options:

--zabbix-address=zabbix_address

The address of theZabbix server.

Default:localhost

--zabbix-port=port_number

The port of theZabbix server.

Default: 10051

--zabbix-file=metrics_file

A text file that stores the collected metrics data to be visualized, such aslocalhost.log.

--zabbix-client=zabbix_host_name

The name of theZabbix host.

Default:localhost

--zabbix-log-level={INFO|DEBUG|WARN}

Change the logging level.

Default:INFO

zabbix dashboard upload

Syntax:

mamonsu dashboard uploadtemplate_name

Upload aZabbix dashboard with themamonsu metrics to a template on theZabbix server version 6.0 or higher.

zabbix item

Syntax:

mamonsu zabbix item {error | lastvalue | lastclock }host_name

View the specified property of the latest metrics data received byZabbix for the specified host.

zabbix version

Syntax:

mamonsu zabbix version

Get the version of theZabbix server thatmamonsu is connected to.

zabbix host

Syntax:

mamonsu zabbix host listmamonsu zabbix host showhost_namemamonsu zabbix host idhost_namemamonsu zabbix host deletehost_idmamonsu zabbix host createhost_namehostgroup_idtemplate_idmamonsu_addressmamonsu zabbix host info {templates | hostgroups | graphs | items}host_id

ManageZabbix hosts using one of the actions described inthe section called “Zabbix Server Actions”.

zabbix hostgroup

Syntax:

mamonsu zabbix hostgroup listmamonsu zabbix hostgroup showhostgroup_namemamonsu zabbix hostgroup idhostgroup_namemamonsu zabbix hostgroup deletehostgroup_idmamonsu zabbix hostgroup createhostgroup_name

ManageZabbix host groups using one of the actions described inthe section called “Zabbix Server Actions”.

zabbix template

Syntax:

mamonsu zabbix template listmamonsu zabbix template showtemplate_namemamonsu zabbix template idtemplate_namemamonsu zabbix template deletetemplate_idmamonsu zabbix template exportfile

ManageZabbix templates using one of the actions described inthe section called “Zabbix Server Actions”.

[--config] [--daemonize]

Syntax:

mamonsu [-cconfig_file | --config=config_file]        [-d | --daemonize]

Start working as a monitoring agent in the foreground or in the background using configuration parameters loaded from the configuration file. If the specified or default configuration file does not exist, exit with an error. Useful for debugging. You can specify the following options:

-cconfig_file
--config=config_file

Specify theagent.conf file where to load the configuration parameters from.

Default:/etc/mamonsu/agent.conf

-d
--daemonize

Run in the background. Without it,mamonsu will run in the foreground.

--version

Syntax:

mamonsu --version

Displaymamonsu version.

--help

Syntax:

mamonsu --help

Displaymamonsu command-line help.

Connection Options#

connection_options provide command-line connection parameters for the targetPostgres Pro cluster.connection_options can be--host,--port,--dbname (-d),--username (-U), and--password (-W). The--dbname option should specify themamonsu_database created for monitoring purposes. Note that the--username (-U) option must specify a superuser that can access the cluster.

If you omitconnection_options,mamonsu checks the configuration file for the needed settings.

Zabbix Server Actions#

Usingmamonsu, you can control some of theZabbix server functionality from the command line. Specifically, you can create or deleteZabbix hosts and host groups, as well as generate, import, and deleteZabbix templates using one of the following commands. Theobject_name to use must correspond to the type of theZabbix object specified in the command:template,host, orhostgroup.

list

Display the list of available templates, hosts, or host groups.

showobject_name

Display the details about the specified template, host, or host group.

idobject_name

Show the ID of the specified object, which is assigned automatically by theZabbix server.

deleteobject_id

Delete the object with the specified ID.

createhostgroup_name
createhost_namehostgroup_idtemplate_idmamonsu_address

Create a new host or a host group.

exporttemplate_name

Generate aZabbix template.

info {templates | hostgroups | graphs | items}host_id

Display detailed information about the templates, host groups, graphs, and metrics available on the host with the specified ID.

Configuration Parameters#

Theagent.conf configuration file is located in the/etc/mamonsu directory by default. It provides several groups of parameters that control which metrics to collect and how to log the collected data:

All parameters must be specified in theparameter =value format.

Connection Parameters#

[postgres]

The[postgres] section controlsPostgres Pro metrics collection and can contain the following parameters:

enabled

Enables/disablesPostgres Pro metrics collection if set toTrue orFalse, respectively.

Default:True

user

The user on behalf of which the cluster will be monitored. It must be themamonsu user set in bootstrap, or a superuser ifbootstrap was not run.

Default:postgres

password

The password for the specified user.

database

The database to connect to for metrics collection.

Default:postgres

host

The server address to connect to.

Default:localhost

port

The port to connect to.

Default: 5432

application_name

Application name that identifiesmamonsu connected to thePostgres Pro cluster.

Default:mamonsu

query_timeout

statement_timeout for themamonsu session, in seconds. If aPostgres Pro metric query does not complete within this time interval, it gets terminated.

Default: 10

Alternatively you can specify environment variables rather than the configuration parameters. The following environment variables can be used:PGUSER,PGPASSWORD,PGHOST,PGDATABASE,PGPORT, andPGAPPNAME. SeeSection 32.15 for their meaning.

[system]

The[system] section controls system metrics collection and can contain the following parameters:

enabled

Enables/disables system metrics collection if set toTrue orFalse, respectively.

Default:True

[zabbix]

The[zabbix] section provides connection settings for theZabbix server and can contain the following parameters:

enabled

Enables/disables sending the collected metrics data to theZabbix server if set toTrue orFalse, respectively.

Default:True

client

The name of theZabbix host.

address

The address of theZabbix server.

Default: 127.0.0.1

port

The port of theZabbix server.

Default: 10051

timeout

Maximum time to wait while connecting to theZabbix server, in seconds.

Default: 15

[agent]

The[agent] section specifies the location ofmamonsu and whether it is allowed to access metrics from the command line:

enabled

Enables/disables metrics collection from the command line using theagent command.

Default:True

host

The address of the system on whichmamonsu is running.

Default: 127.0.0.1

port

The port on whichmamonsu is running.

Default: 10052

[sender]

The[sender] section controls the queue size of the data to be sent to theZabbix server:

queue

The maximum number of collected metric values that can be accumulated locally beforemamonsu sends them to theZabbix server. Once the accumulated data is sent, the queue is cleared.

Default: 2048

Logging Parameters#

[metric_log]

The[metric_log] section enables storing the collected metrics data in text files locally. This section can contain the following parameters:

enabled

Enables/disables storing the collected metrics data in a text file. If this option is set toTrue,mamonsu creates thelocalhost.log file for storing metric values.

Default:False

directory

Specifies the directory where log files with metrics data will be stored.

Default:/var/log/mamonsu

max_size_mb

The maximum size of a log file, in MB. When the specified size is reached, it is renamed tolocalhost.log.archive, and an emptylocalhost.log file is created.

Default: 1024

[log]

The[log] section specifies logging settings formamonsu and can contain the following parameters:

file

Specifies the log filename, which can be preceded by the full path.

level

Specifies the debug level. This option can takeDEBUG,ERROR, orINFO values.

Default:INFO

format

The format of the logged data.

Default:[%(levelname)s] %(asctime)s - %(name)s - %(message)s

wherelevelname is the debug level,asctime returns the current time,name specifies the plugin that emitted this log entry orroot otherwise, andmessage provides the actual log message.

Plugin Parameters#

[plugins]

The[plugins] section specifies custom plugins to be added for metrics collection and can contain the following parameters:

enabled

Enables/disables using custom plugins for metrics collection if set toTrue orFalse, respectively.

Default:False

directory

Specifies the directory that contains custom plugins for metrics collection. Setting this parameter toNone forbids using custom plugins.

Default:/etc/mamonsu/plugins

If you need to configure any of the plugins you add tomamonsu after installation, you have to add this plugin section to theagent.conf file.

The syntax of this section should follow the syntax used with the examples shown below inthe section called “Individual Plugin Sections”.

Individual Plugin Sections#

All built-in plugins are installed along withmamonsu. To configure a built-in plugin you should find a corresponding section below theIndividual Plugin Sections heading and edit its parameter values:

enabled

Enables/disables using built-in plugins if set toTrue orFalse, respectively. These values are case-sensitive.

Default:False

interval

Specifies the plugin operation interval, in seconds. The parameter is set with an integer specifying the plugin operation interval in seconds. You can set different intervals for different plugins. For plugins that collectPostgreSQL/Postgres Pro metrics, for example,autovacuum,checkpoint, etc., this is the interval within whichmamonsu accesses thePostgres Pro instance for metrics collection. For system plugins, for example,diskstats,memory, etc., this is the interval within which the operating system is accessed. For service plugins, for example,agentapi,logsender,zbxsender, this is the interval within which their functions are called. Note that theinterval parameter of thezbxsender plugin is associated with thetimeout parameter of the[zabbix] section. The maximumZabbix server response timeout greater than the plugin operation interval may cause misbehavior of thezbxsender plugin: the plugin restarts with an error message if the connection or data transfer require longer time than the value specified in theinterval parameter.

Default: 60

The example below shows individual plugin sections corresponding to thepreparedtransaction and thepgprobackup built-in plugins:

[preparedtransaction]max_prepared_transaction_time = 60interval = 60[pgprobackup]enabled = falseinterval = 300backup_dirs = /backup_dir1,/backup_dir2pg_probackup_path = /usr/bin/pg_probackup-11

[preparedtransaction]#

This plugin gets age in seconds of the oldest prepared transaction and number of all transactions prepared for a two-phase commit. For additional information refer toPREPARE TRANSACTION andSection 52.16.

Themax_prepared_transaction_time parameter specifies the threshold in seconds for the age of the prepared transaction.

The plugin collects two metrics:pgsql.prepared.count (number of prepared transactions) andpgsql.prepared.oldest (oldest prepared transaction age in seconds).

Ifpgsql.prepared.oldest value exceeds the threshold specified by themax_prepared_transaction_time parameter, a trigger with the following message is fired: "PostgreSQL prepared transaction is too old on {host}".

[pgprobackup]#

This plugin usespg_probackup to track its backups' state and gets size of backup directories which store all backup files.

Please note that this plugin counts the total size of all files in the target directory. Make sure that extraneous files are not stored in this directory.

Thebackup_dirs parameter specifies a comma-separated list of paths to directories for which metrics should be collected.

Thepg_probackup_path parameter specifies the path topg_probackup.

By default this plugin is disabled. To enable it set theenabled parameter toTrue.

This plugin collects two metrics:pg_probackup.dir.size[#backup_directory] (the size of the target directory) andpg_probackup.dir.error[#backup_directory] (backup errors) for each specifiedbackup_directory.

If any generated backup has bad status, likeERROR,CORRUPT,ORPHAN, a trigger is fired.

Usage

Collecting and Viewing Metrics Data#

Once started,mamonsu begins collecting system andPostgres Pro metrics. Theagent command enables you to get an overview of the collected metrics from the command line in real time.

To view the list of available metrics, use theagent metric-list command:

mamonsu agent metric-list

The output of this command provides the item key of each metric, its latest value, and the time when this value was received. For example:

system.memory[active]      7921004544    1564570818system.memory[swap_cache]      868352    1564570818pgsql.connections[idle]           6.0    1564570818pgsql.archive_command[failed_trying_to_archive]    0    1564570818

To view the current value for a specific metric, you can use theagent metric-get command:

mamonsu agent metric-getmetric_name

wheremetric_name is the item key of the metric to monitor, as returned by themetric-list command. For example,pgsql.connections[idle].

You can view graphs for the collected metrics in theZabbix web interface under theGraphs menu. For details on working withZabbix, see its official documentation athttps://www.zabbix.com/documentation/current/manual.

If you have chosen to save all the collected metrics data into a file, as explained inthe section called “Logging Parameters”, you can later upload these metrics onto a Zabbix server for visualization using theupload command.

Adding Custom Plugins#

You can extendmamonsu with your own custom plugins, as follows:

  1. Save all custom plugins in a single directory, such as/etc/mamonsu/plugins.

  2. Make sure this directory is specified in your configuration file under the[plugins] section:

    [plugins]directory = /etc/mamonsu/plugins

  3. Generate a newZabbix template to include custom plugins:

    mamonsu export template template.xml --add-plugins=/etc/mamonsu/plugins

  4. Upload the generatedtemplate.xml to theZabbix server as explained inthe section called “Installation and Setup”.

TuningPostgres Pro and System Configuration

Based on the collected metrics data,mamonsu can tune yourPostgres Pro and system configuration for optimal performance.

You can get detailed information about the hardware, operating system, memory usage and other parameters of the monitored system, as well asPostgres Pro configuration, as follows:

mamonsu report

To view the suggested optimizations without applying them, run thetune command with the--dry-run option:

mamonsu tune --dry-run

To apply all the suggested changes, run thetune command without any parameters:

mamonsu tune

You can exclude some settings from the report or disable some of the optimizations by passing optional parameters. Seethe section called “Command-Line Reference” for the full list of parameters available forreport andtune commands.

ManagingZabbix Server Settings from the Command Line#

mamonsu enables you to work with theZabbix server from the command line. You can upload template files toZabbix, create and deleteZabbix hosts and host groups, link templates with hosts and check the latest metric values.

To set up yourZabbix host from scratch, you can follow these steps:

  1. Optionally, specify yourZabbix account settings in the following environment variables on your monitoring system:

    • Set theZABBIX_USER andZABBIX_PASSWD variables to the login and password of yourZabbix account, respectively.

    • Set theZABBIX_URL tohttp://zabbix/

    If you skip this step, you will have to add the following options to allmamonsu zabbix commands that you run:

    --url=http://zabbix/ --user=zabbix_login --password=zabbix_password
  2. Generate a new template file and upload it to theZabbix server:

    mamonsu export template template.xmlmamonsu zabbix template export template.xml

  3. Create a new host group:

    mamonsu zabbix hostgroup createhostgroup_name

  4. Check the IDs for this host group and the uploaded template, which are assigned automatically by theZabbix server:

    mamonsu zabbix hostgroup idhostgroup_namemamonsu zabbix template idtemplate_name

  5. Create a host associated with this group and link it with the uploaded template using a single command:

    mamonsu zabbix host createhost_namehostgroup_idtemplate_idmamonsu_address

    wherehost_name is the name of the host,hostgroup_id andtemplate_id are the unique IDs returned in the previous step, andmamonsu_address is the IP address of the system on whichmamonsu runs.

Once yourZabbix host is configured, complete the setup of your monitoring system as explained inthe section called “Installation and Setup”.

Exporting Metrics for NativeZabbix Agent

Usingmamonsu, you can convert system andPostgres Pro metrics definitions to the format supported by the nativeZabbix agent.

This feature currently has the following limitations:

  • You cannot export metrics if you runmamonsu on Windows systems.

  • Metrics definitions forpg_wait_sampling and CFS features available inPostgres Pro Enterprise are not converted.

Important

To work withZabbix proxy, you must export settings to the format supported by the nativeZabbix agent.

To collect metrics provided bymamonsu using the nativeZabbix agent, do the following:

  1. Generate a configuration file that is compatible with the nativeZabbix agent and place it under/etc/zabbix/zabbix_agent.d/. You can prepend the filename with the required path:

    mamonsu export zabbix-parameters /etc/zabbix/zabbix_agent.d/zabbix_agent.conf

    For all possible options of theexport zabbix-parameters command, seethe section called “Command-Line Reference”.

  2. Generate a template for the nativeZabbix agent:

    mamonsu export zabbix-template template.xml

    For all possible options of theexport zabbix-template command, seethe section called “Command-Line Reference”.

  3. Upload the generated template to theZabbix server, as explained inthe section called “Installation and Setup”.

  4. If you are going to collectPostgres Pro metrics, change the following macros in the template after the upload:

    • For{$PG_CONNINFO}, provide connection parameters for thePostgres Pro server to be monitored.

    • For{$PG_PATH}, specifypsql installation directory.

Compatibility Considerations#

If you want to upgrademamonsu to a version that is not compatible with the previous one, what you must do to continue using the application depends on whether you need to retain the metrics data collected.

  • If you need to retain the collected data, do the following:

    1. Install the new version ofmamonsu.

    2. Generate a new template for theZabbix server.

    3. If you performed a bootstrap using the previous version ofmamonsu, run thebootstrap command again.

    4. Upload the new template to theZabbix server.

    5. Rename the host for which you want to retain the collected data and leave the old template linked to that host.

    6. Create a new host for the same system and link the new template to it.

    7. Restartmamonsu. It will collect data for the new host. The old host will no longer be used, but the data collected will be available.

  • If you do not need to retain the collected data, do the following:

    1. Install the new version ofmamonsu.

    2. Generate a new template for theZabbix server.

    3. If you performed a bootstrap using the previous version ofmamonsu, run thebootstrap command again.

    4. Upload the new template to theZabbix server.

    5. In the settings of theZabbix host, link the new template to the host instead of the old one.

    6. Restartmamonsu. It will start collecting data. All the data collected earlier will be lost.


Prev Up Next
I.3. AdditionalPostgres Pro Server Applications Home pgpro_controldata
pdfepub
Go to Postgres Pro Standard 17
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp