### Option:Plugins.PostgreSQL.System.Path
#	Path to external plugin executable.
#
# Mandatory: yes
# Default:
{% if agent_param_plugins_postgresql_system_path  is defined and agent_param_plugins_postgresql_system_path %}

Plugins.PostgreSQL.System.Path={{ agent_param_plugins_postgresql_system_path }}
{% endif %}

### Option: Plugins.PostgreSQL.CallTimeout
#	The maximum time in seconds for waiting when a request has to be done.
#
# Mandatory: no
# Range: 1-30
# Default:
# Plugins.PostgreSQL.CallTimeout=<Global timeout>
{% if agent_param_plugins_postgresql_calltimeout  is defined and agent_param_plugins_postgresql_calltimeout %}

Plugins.PostgreSQL.CallTimeout={{ agent_param_plugins_postgresql_calltimeout }}
{% endif %}

### Option: Plugins.PostgreSQL.Timeout
#	The maximum time in seconds for waiting when a connection has to be established.
#
# Mandatory: no
# Range: 1-30
# Default:
# Plugins.PostgreSQL.Timeout=<Global timeout>
{% if agent_param_plugins_postgresql_timeout  is defined and agent_param_plugins_postgresql_timeout %}

Plugins.PostgreSQL.Timeout={{ agent_param_plugins_postgresql_timeout }}
{% endif %}

### Option: Plugins.PostgreSQL.KeepAlive
#   Time in seconds for waiting before unused connections will be closed.
#
# Mandatory: no
# Range: 60-900
# Default:
# Plugins.PostgreSQL.KeepAlive=300
{% if agent_param_plugins_postgresql_keepalive  is defined and agent_param_plugins_postgresql_keepalive %}

Plugins.PostgreSQL.KeepAlive={{ agent_param_plugins_postgresql_keepalive }}
{% endif %}

### Option: Plugins.PostgreSQL.CustomQueriesPath
#	Full pathname of a directory containing *.sql* files with custom queries.
#
# Mandatory: no
# Default:
# Plugins.PostgreSQL.CustomQueriesPath=
{% if agent_param_plugins_postgresql_customqueriespath  is defined and agent_param_plugins_postgresql_customqueriespath %}

Plugins.PostgreSQL.CustomQueriesPath={{ agent_param_plugins_postgresql_customqueriespath }}
{% endif %}

### Option: Plugins.PostgreSQL.Sessions.*.Uri
#	Uri to connect. "*" should be replaced with a session name.
#
# Mandatory: no
# Range:
#   Must match the URI format.
#   Supported schemas: "tcp" and "unix".
#   Embedded credentials will be ignored.
# Default:
# Plugins.PostgreSQL.Sessions.*.Uri=
{% if agent_param_plugins_postgresql_sessions is defined and agent_param_plugins_postgresql_sessions is iterable and agent_param_plugins_postgresql_sessions is not string and agent_param_plugins_postgresql_sessions is not mapping %}

{% for session in agent_param_plugins_postgresql_sessions %}
{% if session["uri"] is defined and session["uri"] %}
Plugins.PostgreSQL.Sessions.{{ session["name"] }}.Uri={{ session["uri"] }}
{% endif %}
{% endfor %}
{% endif %}

### Option: Plugins.PostgreSQL.Sessions.*.User
#	Username for session connection. "*" should be replaced with a session name.
#
# Mandatory: no
# Range: Must match the PostgreSQL user name.
# Default:
# Plugins.PostgreSQL.Sessions.*.User=
{% if agent_param_plugins_postgresql_sessions is defined and agent_param_plugins_postgresql_sessions is iterable and agent_param_plugins_postgresql_sessions is not string and agent_param_plugins_postgresql_sessions is not mapping %}

{% for session in agent_param_plugins_postgresql_sessions %}
{% if session["user"] is defined and session["user"] %}
Plugins.PostgreSQL.Sessions.{{ session["name"] }}.User={{ session["user"] }}
{% endif %}
{% endfor %}
{% endif %}

### Option: Plugins.PostgreSQL.Sessions.*.Password
#	Password for session connection. "*" should be replaced with a session name.
#
# Mandatory: no
# Range: Must match the Password format.
# Default:
# Plugins.PostgreSQL.Sessions.*.Password=
{% if agent_param_plugins_postgresql_sessions is defined and agent_param_plugins_postgresql_sessions is iterable and agent_param_plugins_postgresql_sessions is not string and agent_param_plugins_postgresql_sessions is not mapping %}

{% for session in agent_param_plugins_postgresql_sessions %}
{% if session["password"] is defined and session["password"] %}
Plugins.PostgreSQL.Sessions.{{ session["name"] }}.Password={{ session["password"] }}
{% endif %}
{% endfor %}
{% endif %}

### Option: Plugins.PostgreSQL.Sessions.*.Database
#	Database for session connection. "*" should be replaced with a session name.
#
# Mandatory: no
# Default:
# Plugins.PostgreSQL.Sessions.*.Database=
{% if agent_param_plugins_postgresql_sessions is defined and agent_param_plugins_postgresql_sessions is iterable and agent_param_plugins_postgresql_sessions is not string and agent_param_plugins_postgresql_sessions is not mapping %}

{% for session in agent_param_plugins_postgresql_sessions %}
{% if session["database"] is defined and session["database"] %}
Plugins.PostgreSQL.Sessions.{{ session["name"] }}.Database={{ session["database"] }}
{% endif %}
{% endfor %}
{% endif %}

### Option: Plugins.PostgreSQL.Sessions.*.TLSConnect
#	Encryption type for PostgreSQL connection. "*" should be replaced with a session name.
#		require/required        - connect using TLS as transport mode without identity checks, acts like verify-ca if ca 
#               file is provided;
#		verify-ca/verify_ca     - connect using TLS and verify certificate;
#		verify-full/verify_full - connect using TLS, verify certificate and verify that database identity (CN) specified
#				by DBHost matches its certificate;
#	Undefined encryption type means unencrypted connection.
#
# Mandatory: no
# Default:
# Plugins.PostgreSQL.Sessions.*.TLSConnect=
{% if agent_param_plugins_postgresql_sessions is defined and agent_param_plugins_postgresql_sessions is iterable and agent_param_plugins_postgresql_sessions is not string and agent_param_plugins_postgresql_sessions is not mapping %}

{% for session in agent_param_plugins_postgresql_sessions %}
{% if session["tlsconnect"] is defined and session["tlsconnect"] %}
Plugins.PostgreSQL.Sessions.{{ session["name"] }}.TLSConnect={{ session["tlsconnect"] }}
{% endif %}
{% endfor %}
{% endif %}

### Option: Plugins.PostgreSQL.Sessions.*.TLSCAFile
#	Full pathname of a file containing the top-level CA(s) certificate
#	peer certificate verification.
#
# Mandatory: no
# Default:
# Plugins.PostgreSQL.Sessions.*.TLSCAFile=
{% if agent_internal_plugins_postgresql_tls_file_list is defined and agent_internal_plugins_postgresql_tls_file_list is iterable and agent_internal_plugins_postgresql_tls_file_list is not string and agent_internal_plugins_postgresql_tls_file_list is not mapping %}

{% for tls_file in agent_internal_plugins_postgresql_tls_file_list %}
{% if tls_file["type"] == "ca" %}
Plugins.PostgreSQL.Sessions.{{ tls_file["session_name"] }}.TLSCAFile={{ tls_file["target"] }}
{% endif %}
{% endfor %}
{% endif %}

### Option: Plugins.PostgreSQL.Sessions.*.TLSCertFile
#	Full pathname of a file containing the PostgreSQL certificate or certificate chain.
#
# Mandatory: no
# Default:
# Plugins.PostgreSQL.Sessions.*.TLSCertFile=
{% if agent_internal_plugins_postgresql_tls_file_list is defined and agent_internal_plugins_postgresql_tls_file_list is iterable and agent_internal_plugins_postgresql_tls_file_list is not string and agent_internal_plugins_postgresql_tls_file_list is not mapping %}

{% for tls_file in agent_internal_plugins_postgresql_tls_file_list %}
{% if tls_file["type"] == "cert" %}
Plugins.PostgreSQL.Sessions.{{ tls_file["session_name"] }}.TLSCertFile={{ tls_file["target"] }}
{% endif %}
{% endfor %}
{% endif %}

### Option: Plugins.PostgreSQL.Sessions.*.TLSKeyFile
#	Full pathname of a file containing the PostgreSQL private key.
#
# Mandatory: no
# Default:
# Plugins.PostgreSQL.Sessions.*.TLSKeyFile=
{% if agent_internal_plugins_postgresql_tls_file_list is defined and agent_internal_plugins_postgresql_tls_file_list is iterable and agent_internal_plugins_postgresql_tls_file_list is not string and agent_internal_plugins_postgresql_tls_file_list is not mapping %}

{% for tls_file in agent_internal_plugins_postgresql_tls_file_list %}
{% if tls_file["type"] == "key" %}
Plugins.PostgreSQL.Sessions.{{ tls_file["session_name"] }}.TLSKeyFile={{ tls_file["target"] }}
{% endif %}
{% endfor %}
{% endif %}

### Option: Plugins.PostgreSQL.Sessions.*.CacheMode
#   Cache mode for PostgreSQL connection. "*" should be replaced with a session name.
#		prepare - will create prepared statements on the PostgreSQL server.;
#		describe - will use the anonymous prepared statement to describe a statement without creating a statement on the
#       server.
#
# Mandatory: no
# Default: prepare
# Plugins.PostgreSQL.Sessions.*.CacheMode=
{% if agent_param_plugins_postgresql_sessions is defined and agent_param_plugins_postgresql_sessions is iterable and agent_param_plugins_postgresql_sessions is not string and agent_param_plugins_postgresql_sessions is not mapping %}

{% for session in agent_param_plugins_postgresql_sessions %}
{% if session["cachemode"] is defined and session["cachemode"] %}
Plugins.PostgreSQL.Sessions.{{ session["name"] }}.CacheMode={{ session["cachemode"] }}
{% endif %}
{% endfor %}
{% endif %}
 
### Option: Plugins.PostgreSQL.Default.Uri
#	Uri to connect. Default value used if no other is specified.
#
# Mandatory: no
# Range:
#   Must matches the URI format.
#   Supported schemas: "tcp" and "unix".
#   Embedded credentials will be ignored.
# Default:
# Plugins.PostgreSQL.Default.Uri=
{% if agent_param_plugins_postgresql_default is defined and agent_param_plugins_postgresql_default.uri is defined and agent_param_plugins_postgresql_default.uri %}

Plugins.PostgreSQL.Default.Uri={{ agent_param_plugins_postgresql_default.uri }}
{% endif %}

### Option: Plugins.PostgreSQL.Default.User
#	Username for session connection. Default value used if no other is specified.
#
# Mandatory: no
# Range: Must matches PostgreSQL user name.
# Default:
# Plugins.PostgreSQL.Default.User=
{% if agent_param_plugins_postgresql_default is defined and agent_param_plugins_postgresql_default.user is defined and agent_param_plugins_postgresql_default.user %}

Plugins.PostgreSQL.Default.User={{ agent_param_plugins_postgresql_default.user }}
{% endif %}

### Option: Plugins.PostgreSQL.Default.Password
#	Password for session connection. Default value used if no other is specified.
#
# Mandatory: no
# Range: Must matches the Password format.
# Default:
# Plugins.PostgreSQL.Default.Password=
{% if agent_param_plugins_postgresql_default is defined and agent_param_plugins_postgresql_default.password is defined and agent_param_plugins_postgresql_default.password %}

Plugins.PostgreSQL.Default.Password={{ agent_param_plugins_postgresql_default.password }}
{% endif %}

### Option: Plugins.PostgreSQL.Default.Database
#	Database for session connection. Default value used if no other is specified.
#
# Mandatory: no
# Default:
# Plugins.PostgreSQL.Default.Database=
{% if agent_param_plugins_postgresql_default is defined and agent_param_plugins_postgresql_default.database is defined and agent_param_plugins_postgresql_default.database %}

Plugins.PostgreSQL.Default.Database={{ agent_param_plugins_postgresql_default.database }}
{% endif %}

### Option: Plugins.PostgreSQL.Default.TLSConnect
#	Encryption type for Postgres connection. Default value used if no other is specified.
#		tls connection required     - required
#		verifies certificates       - verify_ca
#		verify certificates and ip  - verify_full
#
# Mandatory: no
# Default:
# Plugins.PostgreSQL.Default.TLSConnect=
{% if agent_param_plugins_postgresql_default is defined and agent_param_plugins_postgresql_default.tlsconnect is defined and agent_param_plugins_postgresql_default.tlsconnect %}

Plugins.PostgreSQL.Default.TLSConnect={{ agent_param_plugins_postgresql_default.tlsconnect }}
{% endif %}

### Option: Plugins.PostgreSQL.Default.TLSCAFile
#	Full pathname of a file containing the top-level CA(s) certificate
#	peer certificate verification. Default value used if no other is specified.
#
# Mandatory: no
# Default:
# Plugins.PostgreSQL.Default.TLSCAFile=
{% if agent_internal_plugins_postgresql_default_tls_file_list is defined and agent_internal_plugins_postgresql_default_tls_file_list is iterable and agent_internal_plugins_postgresql_tls_file_list is not string and agent_internal_plugins_postgresql_tls_file_list is not mapping %}

{% for tls_file in agent_internal_plugins_postgresql_default_tls_file_list %}
{% if tls_file["type"] == "ca" %}
Plugins.PostgreSQL.Default.TLSCAFile={{ tls_file["target"] }}
{% endif %}
{% endfor %}
{% endif %}

### Option: Plugins.PostgreSQL.Default.TLSCertFile
#	Full pathname of a file containing the postgres certificate or certificate chain. 
#   Default value used if no other is specified.
#
# Mandatory: no
# Default:
# Plugins.PostgreSQL.Default.TLSCertFile=
{% if agent_internal_plugins_postgresql_default_tls_file_list is defined and agent_internal_plugins_postgresql_default_tls_file_list is iterable and agent_internal_plugins_postgresql_tls_file_list is not string and agent_internal_plugins_postgresql_tls_file_list is not mapping %}

{% for tls_file in agent_internal_plugins_postgresql_default_tls_file_list %}
{% if tls_file["type"] == "cert" %}
Plugins.PostgreSQL.Default.TLSCertFile={{ tls_file["target"] }}
{% endif %}
{% endfor %}
{% endif %}

### Option: Plugins.PostgreSQL.Default.TLSKeyFile
#	Full pathname of a file containing the postgres private key. Default value used if no other is specified.
#
# Mandatory: no
# Default:
# Plugins.PostgreSQL.Default.TLSKeyFile=
{% if agent_internal_plugins_postgresql_default_tls_file_list is defined and agent_internal_plugins_postgresql_default_tls_file_list is iterable and agent_internal_plugins_postgresql_tls_file_list is not string and agent_internal_plugins_postgresql_tls_file_list is not mapping %}

{% for tls_file in agent_internal_plugins_postgresql_default_tls_file_list %}
{% if tls_file["type"] == "key" %}
Plugins.PostgreSQL.Default.TLSKeyFile={{ tls_file["target"] }}
{% endif %}
{% endfor %}
{% endif %}

### Option: Plugins.PostgreSQL.Default.CacheMode
#   Cache mode for PostgreSQL connection.
#		prepare - will create prepared statements on the PostgreSQL server.;
#		describe - will use the anonymous prepared statement to describe a statement without creating a statement on the
#       server.
#
# Mandatory: no
# Default: prepare
# Plugins.PostgreSQL.Default.CacheMode=
{% if agent_param_plugins_postgresql_default is defined and agent_param_plugins_postgresql_default.cachemode is defined and agent_param_plugins_postgresql_default.cachemode %}

Plugins.PostgreSQL.Default.CacheMode={{ agent_param_plugins_postgresql_default.cachemode }}
{% endif %}
