Parameters and configuration
Parameters
| --conf | Path to configuration file |
| --target\_databases | Path to the configuration file that contains the database targets |
| --target\_agents | Path to the configuration file that contains the agent targets |
| --custom\_queries | Path to the configuration file containing the custom queries |
Configuration file (--conf)
agents_group_id = < ID of the group in which the agents will be created >
interval = < Agent monitoring interval in seconds >
user = <Connection user>
password = <Password>
threads = < Number of threads that will be used to create agents >
modules_prefix = <Modules Prefix>
execute_custom_queries = < Enable with 1 to enable the use of custom queries >
analyze_connections = < Enable with 1 to enable connection monitoring >
engine_uptime = <Enable with 1 to enable runtime monitoring>
query_stats = < Enable with 1 to enable query statistics monitoring >
fragmentation_ratio = < Enable with 1 to enable fragmentation ratio statistics monitoring >
cache_stats = < Enable with 1 to enable cache statistics monitoring >
scan_databases = < Enable with 1 to discover the databases available on each PostgreSQL target >
agent_per_database = < Enable with 1 to create a separate agent for each discovered database >
db_agent_prefix = < Prefix for the names of the per-database agents >
entities_list = < Path to the persistent discovered entities file >
enable_entities_interval = < Enable with 1 to periodically revalidate the entities file >
entities_interval = < Entities file revalidation interval in seconds >
check_storage_stats = < Enable with 1 to enable storage statistics for discovered databases >
check_query_performance = < Enable with 1 to enable query performance statistics >
check_connection_stats = < Enable with 1 to enable per-database connection statistics >
check_transaction_stats = < Enable with 1 to enable transaction activity statistics >
check_table_stats = < Enable with 1 to enable structural table statistics >
check_advanced_perf = < Enable with 1 to enable advanced performance metrics >
Note: Credentials can also be provided through the credentials token, using a Base64-encoded JSON with the same format as Pandora FMS Custom credentials from the Credential store. When defined, it takes precedence over user and password.
credentials = < Base64-encoded JSON with the "user" and "password" fields >
Example
agents_group_id = 10
interval = 300
user = sa
password = HHgD85V@
threads = 1
modules_prefix =
execute_custom_queries = 1
analyze_connections = 1
engine_uptime = 1
query_stats = 1
fragmentation_ratio = 1
cache_stats = 1
scan_databases = 1
agent_per_database = 1
db_agent_prefix =
entities_list = /tmp/postgresql_entities_list.txt
enable_entities_interval = 1
entities_interval = 300
check_storage_stats = 1
check_query_performance = 1
check_connection_stats = 1
check_transaction_stats = 1
check_table_stats = 1
check_advanced_perf = 1
List of target databases (--target_databases)
The content of the file will be a list of PostgreSQL targets separated by commas or lines. Blank lines and lines starting with # are ignored. The following formats are supported for each target:
-
IP:PORT\DATABASE— Monitor only the specified database. -
IP:PORT|db1;db2;db3— Monitor several specific databases of the target. -
IP:PORT!|db1;db2— Exclude the listed databases (requiresscan_databasesto be enabled). -
IP:PORT— Ifscan_databasesis enabled, all databases of the target will be discovered; otherwise only the instance will be monitored.
Example
172.17.0.3:5432\postgres
172.17.0.4:5432|pandora;metadatos
172.17.0.5:5432!|template0;template1
# This line is a comment and will be ignored
172.17.0.6:5432
List of target agents (--target_agents)
The content of the file will be a list of agent name bases, separating each agent by commas or lines. These agent names will be used to dump the information from each target database into the corresponding indicated agent name, rather than letting the plugin generate the agent names automatically.
The position of each agent name in the listing must match the position of the target database in its own listing, that is, the name for the first target database will be the first name in this listing, taking into account that blank lines are ignored.
Example
agente1,,agente3
agente4
agente5,agente6,agente7,,agente9
Custom queries (--custom_queries)
A module must be introduced for each personalized query that is intended to be monitored. The modules must follow a structure, which is the following:
check_begin --> Module opening label
name --> Module name
description --> Description of the module.
operation --> Operation type
datatype --> Module type
min_warning --> Configuration of the minimum warning threshold
max_warning --> Configuration of the maximum warning threshold
str_warning --> Warning string configuration
warning_inverse --> Activate the inverse interval with 1 for warning threshold
min_critical --> Setting the minimum critical threshold
max_critical --> Setting the maximum critical threshold
str_critical --> Critical string configuration
critical_inverse --> Activate inverse interval with 1 for critical threshold
module_interval --> This interval is calculated as a multiplier of the agent interval.
target --> Custom query
target_databases --> Database agents in which the module will be created
target_scope --> Application scope: "instances" (instance only), "databases" (databases only) or "all" (default)
check_end --> Module closing tag
Important notes on custom queries:
- Only
SELECTqueries are allowed. Any other query is discarded with a notice in the plugin output. - The reserved word
$__self_dbnamewill be replaced with the name of the database in which the query is being executed (orpostgreswhen run at instance level). It can be used in bothtargetandname. - The key
sqlis also accepted as an alias oftarget. - If
target_scopeis not specified, it defaults toall(backwards compatible). - If
target_databasesis not specified, it defaults toall(backwards compatible). - The resulting
nameafter the$__self_dbnamesubstitution will be prefixed withmodules_prefixand, when applicable, with the corresponding database name.
Example
check_begin
name Select 1
description Number of invalid objects
operation value
datatype generic_data
min_warning 5
target SELECT 1 FROM dual
target_databases all
check_end
check_begin
name NumeroConexiones
description Number of connections
operation value
datatype generic_data
min_warning 5
target SELECT COUNT(*) AS NumeroConexiones FROM pg_stat_activity
target_databases pandora
target_scope databases
check_end
check_begin
name $__self_dbname.files_table
description Invalid objects (detail)
operation full
datatype generic_data
target SELECT COUNT(*) AS NumeroRegistros FROM files
target_databases pandora
check_end