|
| 1 | +# Mamonsu: configuration file |
| 2 | + |
| 3 | +## Configuration Parameters |
| 4 | +The agent.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: |
| 5 | +- [Connection Parameters](#connection-parameters); |
| 6 | +- [Logging parameters](#logging-parameters); |
| 7 | +- [Plugin Parameters](#plugin-parameters). |
| 8 | + |
| 9 | +All parameters must be specified in the parameter = value format. |
| 10 | + |
| 11 | +*** |
| 12 | + |
| 13 | +### Connection Parameters |
| 14 | +**[postgres]** |
| 15 | +The [postgres] section controls PostgreSQL metrics collection and can contain the following parameters: |
| 16 | + |
| 17 | +**enabled** |
| 18 | + Enables/disables PostgreSQL metrics collection if set to True or False, respectively. |
| 19 | + |
| 20 | + Default: True |
| 21 | + |
| 22 | +**user** |
| 23 | + The user on behalf of which the cluster will be monitored. It must be the same user that you specified in the -M option of the bootstrap command, or a superuser if you skipped the bootstrap. |
| 24 | + |
| 25 | + Default: postgres |
| 26 | + |
| 27 | +**password** |
| 28 | + The password for the specified user. |
| 29 | + |
| 30 | +**database** |
| 31 | + The database to connect to for metrics collection. |
| 32 | + |
| 33 | + Default: postgres |
| 34 | + |
| 35 | +**host** |
| 36 | + The server address to connect to. |
| 37 | + |
| 38 | + Default: localhost |
| 39 | + |
| 40 | +**port** |
| 41 | + The port to connect to. |
| 42 | + |
| 43 | + Default: 5432 |
| 44 | + |
| 45 | +**application_name** |
| 46 | + Application name that identifies Mamonsu connected to the PostgreSQL cluster. |
| 47 | + |
| 48 | + Default: mamonsu |
| 49 | + |
| 50 | +**query_timeout** |
| 51 | + [statement_timeout](https://postgrespro.com/docs/postgresql/13/runtime-config-client#GUC-STATEMENT-TIMEOUT) for the Mamonsu session, in seconds. If a PostgreSQL metric query does not complete within this time interval, it gets terminated. |
| 52 | + |
| 53 | + Default: 10 |
| 54 | + |
| 55 | +<p> </p> |
| 56 | + |
| 57 | +**[system]** |
| 58 | +The [system] section controls system metrics collection and can contain the following parameters: |
| 59 | + |
| 60 | +**enabled** |
| 61 | + Enables/disables system metrics collection if set to True or False, respectively. |
| 62 | + |
| 63 | + Default: True |
| 64 | + |
| 65 | +<p> </p> |
| 66 | + |
| 67 | +**[zabbix]** |
| 68 | +The [zabbix] section provides connection settings for the Zabbix server and can contain the following parameters: |
| 69 | + |
| 70 | +**enabled** |
| 71 | + Enables/disables sending the collected metric data to the Zabbix server if set to True or False, respectively. |
| 72 | + |
| 73 | + Default: True |
| 74 | + |
| 75 | +**client** |
| 76 | + The name of the Zabbix host. |
| 77 | + |
| 78 | +**address** |
| 79 | + The address of the Zabbix server. |
| 80 | + |
| 81 | + Default: 127.0.0.1 |
| 82 | + |
| 83 | +**port** |
| 84 | + The port of the Zabbix server. |
| 85 | + |
| 86 | + Default: 10051 |
| 87 | + |
| 88 | +<p> </p> |
| 89 | + |
| 90 | +**[agent]** |
| 91 | +The [agent] section specifies the location of Mamonsu and whether it is allowed to access metrics from the command line: |
| 92 | + |
| 93 | +**enabled** |
| 94 | + Enables/disables metrics collection from the command line using the agent command. |
| 95 | + |
| 96 | + Default: True |
| 97 | + |
| 98 | +**host** |
| 99 | + The address of the system on which Mamonsu is running. |
| 100 | + |
| 101 | + Default: 127.0.0.1 |
| 102 | + |
| 103 | +**port** |
| 104 | + The port on which Mamonsu is running. |
| 105 | + |
| 106 | + Default: 10052 |
| 107 | + |
| 108 | +<p> </p> |
| 109 | + |
| 110 | +**[sender]** |
| 111 | +The [sender] section controls the queue size of the data to be sent to the Zabbix server: |
| 112 | + |
| 113 | +**queue** |
| 114 | + The maximum number of collected metric values that can be accumulated locally before mamonsu sends them to the Zabbix server. Once the accumulated data is sent, the queue is cleared. |
| 115 | + |
| 116 | + Default: 2048 |
| 117 | + |
| 118 | +*** |
| 119 | + |
| 120 | +### Logging Parameters |
| 121 | +**[metric_log]** |
| 122 | +The [metric_log] section enables storing the collected metric data in text files locally. This section can contain the following parameters: |
| 123 | + |
| 124 | +**enabled** |
| 125 | + Enables/disables storing the collected metric data in a text file. If this option is set to True, Mamonsu creates the localhost.log file for storing metric values. |
| 126 | + |
| 127 | + Default: False |
| 128 | + |
| 129 | +**directory** |
| 130 | + Specifies the directory where log files with metric data will be stored. |
| 131 | + |
| 132 | + Default: /var/log/mamonsu |
| 133 | + |
| 134 | +**max_size_mb** |
| 135 | + The maximum size of a log file, in MB. When the specified size is reached, it is renamed to localhost.log.archive, and an empty localhost.log file is created. |
| 136 | + |
| 137 | + Default: 1024 |
| 138 | + |
| 139 | +<p> </p> |
| 140 | + |
| 141 | +**[log]** |
| 142 | +The [log] section specifies logging settings for Mamonsu and can contain the following parameters: |
| 143 | + |
| 144 | +**file** |
| 145 | + Specifies the log filename, which can be preceded by the full path. |
| 146 | + |
| 147 | +**level** |
| 148 | + Specifies the debug level. This option can take DEBUG, ERROR, or INFO values. |
| 149 | + |
| 150 | + Default: INFO |
| 151 | + |
| 152 | +**format** |
| 153 | + The format of the logged data. |
| 154 | + |
| 155 | + Default: [%(levelname)s] %(asctime)s - %(name)s - %(message)s |
| 156 | + where levelname is the debug level, asctime returns the current time, name specifies the plugin that emitted this log entry or root otherwise, and message provides the actual log message. |
| 157 | + |
| 158 | +*** |
| 159 | + |
| 160 | +### Plugin Parameters |
| 161 | +**[plugins]** |
| 162 | +The [plugins] section specifies custom plugins to be added for metrics collection and can contain the following parameters: |
| 163 | + |
| 164 | +**enabled** |
| 165 | + Enables/disables using custom plugins for metrics collection if set to True or False, respectively. |
| 166 | + |
| 167 | + Default: False |
| 168 | + |
| 169 | +**directory** |
| 170 | + Specifies the directory that contains custom plugins for metrics collection. Setting this parameter to None forbids using custom plugins. |
| 171 | + |
| 172 | + Default: /etc/mamonsu/plugins |
| 173 | + |
| 174 | +If you need to configure any of the plugins you add to Mamonsu after installation, you have to add this plugin section to the agent.conf file. |
| 175 | + |
| 176 | +The syntax of this section should follow the syntax used with the examples shown below in the section called “[Individual Plugin Sections](#individual-plugin-sections)”. |
| 177 | + |
| 178 | +*** |
| 179 | + |
| 180 | +### Individual Plugin Sections |
| 181 | +All built-in plugins are installed along with Mamonsu. To configure a built-in plugin you should find a corresponding section below the Individual Plugin Sections heading and edit its parameter values. |
| 182 | + |
| 183 | +To disable any plugin you should set the enabled parameter to False and to enable it — set it to True. These values are case sensitive. |
| 184 | + |
| 185 | +The example below shows individual plugin sections corresponding to the *preparedtransaction* and the *pgprobackup* built-in plugins: |
| 186 | +```editorconfig |
| 187 | +[preparedtransaction] |
| 188 | +max_prepared_transaction_time = 60 |
| 189 | +interval = 60 |
| 190 | +
|
| 191 | +[pgprobackup] |
| 192 | +enabled = false |
| 193 | +interval = 300 |
| 194 | +backup_dirs = /backup_dir1,/backup_dir2 |
| 195 | +pg_probackup_path = /usr/bin/pg_probackup-11 |
| 196 | +``` |
| 197 | + |
| 198 | +**[preparedtransaction]** |
| 199 | +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 to [PREPARE TRANSACTION](https://postgrespro.com/docs/postgresql/13/sql-prepare-transaction) and [pg_prepared_xacts](https://postgrespro.com/docs/postgresql/13/view-pg-prepared-xacts). |
| 200 | + |
| 201 | +The *max_prepared_transaction_time parameter* specifies the threshold in seconds for the age of the prepared transaction. |
| 202 | + |
| 203 | +The interval parameter allows you to change the metrics collection interval. |
| 204 | + |
| 205 | +The plugin collects two metrics: *pgsql.prepared.count* (number of prepared transactions) and *pgsql.prepared.oldest* (oldest prepared transaction age in seconds). |
| 206 | + |
| 207 | +If *pgsql.prepared.oldest* value exceeds the threshold specified by the *max_prepared_transaction_time* parameter, a trigger with the following message is fired: "PostgreSQL prepared transaction is too old on {host}". |
| 208 | + |
| 209 | +**[pgprobackup]** |
| 210 | +This plugin uses pg_probackup to track its backups' state and gets size of backup directories which store all backup files. |
| 211 | + |
| 212 | +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. |
| 213 | + |
| 214 | +The *backup_dirs* parameter specifies a comma-separated list of paths to directories for which metrics should be collected. |
| 215 | + |
| 216 | +The *pg_probackup_path* parameter specifies the path to pg_probackup. |
| 217 | + |
| 218 | +The *interval* parameter allows you to change the metrics collection interval. |
| 219 | + |
| 220 | +By default this plugin is disabled. To enable it set the enabled parameter to True. |
| 221 | + |
| 222 | +This plugin collects two metrics: *pg_probackup.dir.size[#backup_directory]* (the size of the target directory) and *pg_probackup.dir.error[#backup_directory]* (backup errors) for each specified *backup_directory*. |
| 223 | + |
| 224 | +If any generated backup has bad status, like ERROR, CORRUPT, ORPHAN, а trigger is fired. |
0 commit comments