Skip to content

Latest commit

 

History

History
761 lines (603 loc) · 96.6 KB

File metadata and controls

761 lines (603 loc) · 96.6 KB
id applications-databases-postgresql
title PostgreSQL DB
description Supervisez vos bases PostgreSQL : connexions, cache hitratio, locks, temps de requête, vacuum, bloat et taille des tablespaces.

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

Dépendances du connecteur de supervision

Les connecteurs de supervision suivants sont automatiquement installés lors de l'installation du connecteur PostgreSQL depuis la page Configuration > Connecteurs > Connecteurs de supervision :

Contenu du pack

Modèles

Le connecteur de supervision PostgreSQL apporte un modèle d'hôte :

  • App-DB-Postgres-custom

Le connecteur apporte les modèles de service suivants (classés selon le modèle d'hôte auquel ils sont rattachés) :

Alias Modèle de service Description
Cache-Hitratio App-DB-Postgres-Cache-Hitratio-custom Contrôle permettant de vérifier le "buffer cache hitratio" du serveur Postgres
Connection App-DB-Postgres-Connection-custom Contrôle permettant de vérifier la connexions au serveur Postgres
Connection-Number App-DB-Postgres-Connection-Number-custom Contrôle permettant de vérifier le nombre de connexions au serveur Postgres
Locks App-DB-Postgres-Locks-custom Contrôle permettant de vérifier les types de "locks" d'un serveur Postgres
Query-Time App-DB-Postgres-Query-Time-custom Contrôle permettant de vérifier le temps d'exécution des requêtes d'un serveur Postgres

Les services listés ci-dessus sont créés automatiquement lorsque le modèle d'hôte App-DB-Postgres-custom est utilisé.

Alias Modèle de service Description Découverte
Bloat App-DB-Postgres-Bloat-custom Contrôle l'espace libre des tables et btrees
Database-Size App-DB-Postgres-Database-Size-custom Contrôle la taille des bases de données X
Sql-Statement App-DB-Postgres-Sql-Statement-custom Contrôle permettant d'exécuter une requête SQL personnalisée renvoyant une donnée numérique
Statistics App-DB-Postgres-Statistics-custom Contrôle permettant de vérifier les types de requêtes
Tablespace-Size App-DB-Postgres-Tablespace-Size-custom Contrôle permettant de vérifier la différence de temps entre le poller et le serveur Postgres
Time-Sync App-DB-Postgres-Time-Sync-custom Contrôle permettant de vérifier la différence de temps entre le poller et le serveur Postgres
Vacuum App-DB-Postgres-Vacuum-custom Contrôle l'exécution du Vacuum sur une BD depuis un nombre de jours donné

Les services listés ci-dessus ne sont pas créés automatiquement lorsqu'un modèle d'hôte est appliqué. Pour les utiliser, créez un service manuellement et appliquez le modèle de service souhaité.

Si la case Découverte est cochée, cela signifie qu'une règle de découverte de service existe pour ce service.

Règles de découverte

Découverte de service

Nom de la règle Description
App-DB-Postgres-Databases-Size Découvrir les bases de données pour en superviser la taille.

Rendez-vous sur la documentation dédiée pour en savoir plus sur la découverte automatique de services et sa planification.

Métriques & statuts collectés

Voici le tableau des services pour ce connecteur, détaillant les métriques rattachées à chaque service.

Métrique Unité
db_name~table_name#table.space.usage.bytes B
db_name~table_name#table.space.free.bytes B
db_name~table_name#table.dead_tuple.bytes B
db_name~index_name#index.space.usage.bytes B
db_name~index_name#index.leaf_density.percentage %
Métrique Unité
db_name#database.hitratio.average.percentage
db_name#database.hitratio.delta.percentage
Métrique Unité
connection.time.milliseconds ms
Métrique Unité
instance.connected.count count
instance.connected.percentage %
backends#database.connected.count count
backends#database.connected.percentage %
roles#role.connected.count count
roles#role.connected.percentage %
Métrique Unité
databases#database.space.usage.bytes B
Métrique Unité
locks#database.locks.total.count count
locks#database.locks.waiting.count count
Métrique Unité
database.longqueries.count count
Métrique Unité
value N/A
sqlrequest.execution.time.seconds s
Métrique Unité
queries.commit.count count
queries.rollback.count count
queries.insert.count count
queries.update.count count
queries.delete.count count
database#queries.commit.count count
database#queries.rollback.count count
database#queries.insert.count count
database#queries.update.count count
database#queries.delete.count count
Métrique Unité
tablespaces#tablespace.space.usage.bytes B
Métrique Unité
time.offset.seconds s
Métrique Unité
vacuum.last.execution.seconds s

Prérequis

Pour superviser votre serveur PostgreSQL, créez un utilisateur dédié en lecture seule :

CREATE USER centreonro WITH PASSWORD 'test';
GRANT CONNECT ON DATABASE postgres TO centreonro;
GRANT USAGE ON SCHEMA public TO centreonro;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO centreonro;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO centreonro;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO centreonro;

Pour utiliser le service Tablespace-Size, un utilisateur avec les droits de administrateurs est nécessaire.

Pour utiliser le service Bloat, veuillez installer l'extension pgstattuple (https://docs.postgresql.fr/13/pgstattuple.html) et ajoutez les privilèges :

GRANT EXECUTE ON FUNCTION pgstattuple(regclass) TO centreonro;
GRANT EXECUTE ON FUNCTION pgstatindex(regclass) TO centreonro;

Installer le connecteur de supervision

Pack

La procédure d'installation des connecteurs de supervision diffère légèrement suivant que votre licence est offline ou online.

  1. Si la plateforme est configurée avec une licence online, l'installation d'un paquet n'est pas requise pour voir apparaître le connecteur dans le menu Configuration > Connecteurs > Connecteurs de supervision. Au contraire, si la plateforme utilise une licence offline, installez le paquet sur le serveur central via la commande correspondant au gestionnaire de paquets associé à sa distribution :
dnf install centreon-pack-applications-databases-postgresql
dnf install centreon-pack-applications-databases-postgresql
apt install centreon-pack-applications-databases-postgresql
yum install centreon-pack-applications-databases-postgresql
  1. Quel que soit le type de la licence (online ou offline), installez le connecteur PostgreSQL depuis l'interface web et le menu Configuration > Connecteurs > Connecteurs de supervision.

Plugin

À partir de Centreon 22.04, il est possible de demander le déploiement automatique du plugin lors de l'utilisation d'un connecteur. Si cette fonctionnalité est activée, et que vous ne souhaitez pas découvrir des éléments pour la première fois, alors cette étape n'est pas requise.

Plus d'informations dans la section Installer le plugin.

Utilisez les commandes ci-dessous en fonction du gestionnaire de paquets de votre système d'exploitation :

dnf install centreon-plugin-Applications-Databases-Postgresql
dnf install centreon-plugin-Applications-Databases-Postgresql
apt install centreon-plugin-applications-databases-postgresql
yum install centreon-plugin-Applications-Databases-Postgresql

Utiliser le connecteur de supervision

Utiliser un modèle d'hôte issu du connecteur

  1. Ajoutez un hôte à Centreon depuis la page Configuration > Hôtes.
  2. Complétez les champs Nom, Alias & IP Address/DNS correspondant à votre ressource.
  3. Appliquez le modèle d'hôte App-DB-Postgres-custom. Une liste de macros apparaît. Les macros vous permettent de définir comment le connecteur se connectera à la ressource, ainsi que de personnaliser le comportement du connecteur.
  4. Renseignez les macros désirées. Attention, certaines macros sont obligatoires.
Macro Description Valeur par défaut Obligatoire
POSTGRESUSERNAME User name used to connect to the database X
POSTGRESPASSWORD Password for the defined user name X
POSTGRESPORT Database server port 5432
POSTGRESDATABASE Database name postgres
POSTGRESEXTRAOPTIONS Any extra option you may want to add to every command (E.g. a --verbose flag). Toutes les options sont listées ici
  1. Déployez la configuration. L'hôte apparaît dans la liste des hôtes supervisés, et dans la page Statut des ressources. La commande envoyée par le connecteur est indiquée dans le panneau de détails de l'hôte : celle-ci montre les valeurs des macros.

Utiliser un modèle de service issu du connecteur

  1. Si vous avez utilisé un modèle d'hôte et coché la case Créer aussi les services liés aux modèles, les services associés au modèle ont été créés automatiquement, avec les modèles de services correspondants. Sinon, créez les services désirés manuellement et appliquez-leur un modèle de service.
  2. Renseignez les macros désirées (par exemple, ajustez les seuils d'alerte). Les macros indiquées ci-dessous comme requises (Obligatoire) doivent être renseignées.
Macro Description Valeur par défaut Obligatoire
FILTERTABLE Filter tables by name (can be a regexp).
FILTERINDEX Filter indexes by name (can be a regexp).
FILTERSIZE Filter tables and indexes by size (in bytes) keeping only sizes greater than the given value.
WARNINGINDEXLEAFDENSITY Thresholds.
CRITICALINDEXLEAFDENSITY Thresholds.
WARNINGINDEXUSAGE Thresholds.
CRITICALINDEXUSAGE Thresholds.
WARNINGTABLEDEADTUPLE Thresholds.
CRITICALTABLEDEADTUPLE Thresholds.
WARNINGTABLEFREE Thresholds.
CRITICALTABLEFREE Thresholds.
WARNINGTABLEUSAGE Thresholds.
CRITICALTABLEUSAGE Thresholds.
EXTRAOPTIONS Any extra option you may want to add to the command (E.g. a --verbose flag). Toutes les options sont listées ici --verbose
Macro Description Valeur par défaut Obligatoire
EXCLUDE_DATABASE Exclude databases using a regular expression
INCLUDE_DATABASE Filter databases using a regular expression
WARNING Warning threshold
CRITICAL Critical threshold
EXTRAOPTIONS Any extra option you may want to add to the command (E.g. a --verbose flag). Toutes les options sont listées ici --verbose
Macro Description Valeur par défaut Obligatoire
WARNING Warning threshold in milliseconds
CRITICAL Critical threshold in milliseconds
EXTRAOPTIONS Any extra option you may want to add to the command (E.g. a --verbose flag). Toutes les options sont listées ici
Macro Description Valeur par défaut Obligatoire
CHECK What to check Can be: 'database', 'role', 'all' database
EXCLUDE_DATABASE Exclude databases using a regular expression
INCLUDE_DATABASE Filter databases using a regular expression
EXCLUDE_ROLE Exclude roles using a regular expression
INCLUDE_ROLE Filter roles using a regular expresssion
WARNING Critical threshold in percentage 90
CRITICAL Warning threshold in percentage 95
WARNINGDATABASE Threshold
CRITICALDATABASE Threshold
WARNINGDATABASEPCT Threshold in percentage
CRITICALDATABASEPCT Threshold in percentage
WARNINGINSTANCEPRCT Threshold
CRITICALINSTANCEPRCT Threshold
WARNINGROLE Threshold
CRITICALROLE Threshold
WARNINGROLEPRCT Threshold in percentage
CRITICALROLEPRCT Threshold in percentage
EXTRAOPTIONS Any extra option you may want to add to the command (a --verbose flag for example). Toutes les options sont listées ici. --verbose
Macro Description Valeur par défaut Obligatoire
FILTERDATABASE Filter database to checks (can use regexp) .*
WARNINGSIZE Warning threshold in bytes, maximum size allowed
CRITICALSIZE Critical threshold in bytes, maximum size allowed
EXTRAOPTIONS Any extra option you may want to add to the command (E.g. a --verbose flag). Toutes les options sont listées ici
Macro Description Valeur par défaut Obligatoire
EXCLUDE_DATABASE Exclude databases using a regular expression
INCLUDE_DATABASE Filter databases using a regular expression
CRITICAL Critical threshold. (example: "total=250,waiting=5,exclusive=20") 'total', 'waiting', or the name of a lock type used by PostgreSQL total=250,waiting=5,exclusive=20
WARNING Warning threshold. (example: "total=250,waiting=5,exclusive=20") 'total', 'waiting', or the name of a lock type used by PostgreSQL total=200
EXTRAOPTIONS Any extra option you may want to add to the command (a --verbose flag for example). Toutes les options sont listées ici. --verbose
Macro Description Valeur par défaut Obligatoire
EXCLUDE_DATABASE Exclude databases using a regular expression
INCLUDE_DATABASE Filter databases using a regular expression
EXCLUDE_USER Exclude users a regular expression
INCLUDE_USER Filter users a regular expression
CRITICAL Critical threshold in seconds 60
WARNING Warning threshold in seconds 30
EXTRAOPTIONS Any extra option you may want to add to the command (a --verbose flag for example). Toutes les options sont listées ici.
Macro Description Valeur par défaut Obligatoire
SQLSTATEMENT SQL statement that returns a number X
WARNING Thresholds.
CRITICAL Thresholds.
EXTRAOPTIONS Any extra option you may want to add to the command (E.g. a --verbose flag). Toutes les options sont listées ici
Macro Description Valeur par défaut Obligatoire
FILTER Filter databases by name (can be a regexp). ^(?!(postgres|template1|template0)$)
WARNINGTOTALCOMMIT Warning threshold
CRITICALTOTALCOMMIT Critical threshold
EXTRAOPTIONS Any extra option you may want to add to the command (E.g. a --verbose flag). Toutes les options sont listées ici --verbose
Macro Description Valeur par défaut Obligatoire
FILTERSQLNAME Filter tablespace name directly in sql query (LIKE sql syntax used)
FILTERNAME Filter tablespace name after getting all tablespaces (can be a regexp)
TABLESPACE Filter tablespace name after getting all tablespaces (can be a regexp)
WARNING Thresholds
CRITICAL Thresholds
Macro Description Valeur par défaut Obligatoire
WARNING Warning threshold in seconds. (use a range. it can be -0.3s or +0.3s.) -1.0:1.0
CRITICAL Critical threshold in seconds. (use a range. it can be -0.3s or +0.3s.) -3.0:3.0
EXTRAOPTIONS Any extra option you may want to add to the command (E.g. a --verbose flag). Toutes les options sont listées ici
Macro Description Valeur par défaut Obligatoire
POSTGRESDATABASE Database Name. postgres
WARNING Warning threshold in seconds, maximum time interval since last vacuum
CRITICAL Critical threshold in seconds, maximum time interval since last vacuum
EXTRAOPTIONS Any extra option you may want to add to the command (E.g. a --verbose flag). Toutes les options sont listées ici
  1. Déployez la configuration. Le service apparaît dans la liste des services supervisés, et dans la page Statut des ressources. La commande envoyée par le connecteur est indiquée dans le panneau de détails du service : celle-ci montre les valeurs des macros.

Comment puis-je tester le plugin et que signifient les options des commandes ?

Une fois le plugin installé, vous pouvez tester celui-ci directement en ligne de commande depuis votre collecteur Centreon en vous connectant avec l'utilisateur centreon-engine (su - centreon-engine). Vous pouvez tester que le connecteur arrive bien à superviser une ressource en utilisant une commande telle que celle-ci (remplacez les valeurs d'exemple par les vôtres) :

/usr/lib/centreon/plugins/centreon_postgresql.pl \
	--plugin=database::postgres::plugin \
	--mode=tablespace \
	--host=10.0.0.1 \
	--username='' \
	--password='' \
	--port='5432'  \
	--filter-sql-name='' \
	--filter-name='' \
	--warning-space-usage=''  \
	--critical-space-usage='' \
	--filter-name=''

La commande devrait retourner un message de sortie similaire à :

OK: All tablespaces are ok | '*tablespaces*#tablespace.space.usage.bytes'=B;;;0;

Diagnostic des erreurs communes

Rendez-vous sur la documentation dédiée pour le diagnostic des erreurs communes des plugins Centreon.

Modes disponibles

Dans la plupart des cas, un mode correspond à un modèle de service. Le mode est renseigné dans la commande d'exécution du connecteur. Dans l'interface de Centreon, il n'est pas nécessaire de les spécifier explicitement, leur utilisation est implicite dès lors que vous utilisez un modèle de service. En revanche, vous devrez spécifier le mode correspondant à ce modèle si vous voulez tester la commande d'exécution du connecteur dans votre terminal.

Tous les modes disponibles peuvent être affichés en ajoutant le paramètre --list-mode à la commande :

/usr/lib/centreon/plugins/centreon_postgresql.pl \
	--plugin=database::postgres::plugin \
	--list-mode

Le plugin apporte les modes suivants :

Mode Modèle de service associé
backends [code] App-DB-Postgres-Connection-Number-custom
bloat [code] App-DB-Postgres-Bloat-custom
collection [code] Not used in this Monitoring Connector
connection-time [code] App-DB-Postgres-Connection-custom
database-size [code] App-DB-Postgres-Database-Size-custom
hitratio [code] App-DB-Postgres-Cache-Hitratio-custom
list-databases [code] Used for service discovery
locks [code] App-DB-Postgres-Locks-custom
name [code] Not used in this Monitoring Connector
query-time [code] App-DB-Postgres-Query-Time-custom
sql [code] App-DB-Postgres-Sql-Statement-custom
sql-string [code] Not used in this Monitoring Connector
statistics [code] App-DB-Postgres-Statistics-custom
tablespace [code] App-DB-Postgres-Tablespace-Size-custom
timesync [code] App-DB-Postgres-Time-Sync-custom
vacuum [code] App-DB-Postgres-Vacuum-custom

Options disponibles

Options génériques

Les options génériques sont listées ci-dessous :

Option Description
--mode Define the mode in which you want the plugin to be executed (see--list-mode).
--dyn-mode Specify a mode with the module's path (advanced).
--list-mode List all available modes.
--mode-version Check minimal version of mode. If not, unknown error.
--version Return the version of the plugin.
--sqlmode This plugin offers several ways to query the database (default: dbi). See --list-sqlmode.
--list-sqlmode List all available sql modes.
--multiple Enable connecting to multiple databases (required by some specific modes such as replication).
--pass-manager Define the password manager you want to use. Supported managers are: environment, file, keepass, hashicorpvault and teampass.
--verbose Display extended status information (long output).
--debug Display debug messages.
--filter-perfdata Filter perfdata that match the regexp. Eg: adding --filter-perfdata='avg' will remove all metrics that do not contain 'avg' from performance data.
--filter-perfdata-adv Filter perfdata based on a "if" condition using the following variables: label, value, unit, warning, critical, min, max. Variables must be written either %{variable} or %(variable). Eg: adding --filter-perfdata-adv='not (%(value) == 0 and %(max) eq "")' will remove all metrics whose value equals 0 and that don't have a maximum value.
--explode-perfdata-max Create a new metric for each metric that comes with a maximum limit. The new metric will be named identically with a '_max' suffix). Eg: it will split 'used_prct'=26.93%;0:80;0:90;0;100 into 'used_prct'=26.93%;0:80;0:90;0;100 'used_prct_max'=100%;;;;
--change-perfdata --extend-perfdata Change or extend perfdata. Syntax: --extend-perfdata=searchlabel,newlabel,target[,[newuom],[min],[m ax]] Common examples: Convert storage free perfdata into used: --change-perfdata=free,used,invert() Convert storage free perfdata into used: --change-perfdata=used,free,invert() Scale traffic values automatically: --change-perfdata=traffic,,scale(auto) Scale traffic values in Mbps: --change-perfdata=traffic_in,,scale(Mbps),mbps Change traffic values in percent: --change-perfdata=traffic_in,,percent()
--extend-perfdata-group Add new aggregated metrics (min, max, average or sum) for groups of metrics defined by a regex match on the metrics' names. Syntax: --extend-perfdata-group=regex,namesofnewmetrics,calculation[,[ne wuom],[min],[max]] regex: regular expression namesofnewmetrics: how the new metrics' names are composed (can use $1, $2... for groups defined by () in regex). calculation: how the values of the new metrics should be calculated newuom (optional): unit of measure for the new metrics min (optional): lowest value the metrics can reach max (optional): highest value the metrics can reach Common examples: Sum wrong packets from all interfaces (with interface need --units-errors=absolute): --extend-perfdata-group=',packets_wrong,sum(packets_(discard |error)_(in|out))' Sum traffic by interface: --extend-perfdata-group='traffic_in_(.*),traffic_$1,sum(traf fic_(in|out)_$1)'
--change-short-output --change-long-output Modify the short/long output that is returned by the plugin. Syntax: --change-short-output=patternreplacementmodifier Most commonly used modifiers are i (case insensitive) and g (replace all occurrences). Eg: adding --change-short-output='OK~Up~gi' will replace all occurrences of 'OK', 'ok', 'Ok' or 'oK' with 'Up'
--change-exit Replace an exit code with one of your choice. Eg: adding --change-exit=unknown=critical will result in a CRITICAL state instead of an UNKNOWN state.
--range-perfdata Rewrite the ranges displayed in the perfdata. Accepted values: 0: nothing is changed. 1: if the lower value of the range is equal to 0, it is removed. 2: remove the thresholds from the perfdata.
--filter-uom Mask the units when they don't match the given regular expression.
--opt-exit Replace the exit code in case of an execution error (i.e. wrong option provided, SSH connection refused, timeout, etc). Default: unknown.
--output-ignore-perfdata Remove all the metrics from the service. The service will still have a status and an output.
--output-ignore-label Remove the status label ("OK:", "WARNING:", "UNKNOWN:", CRITICAL:") from the beginning of the output. Eg: 'OK: Ram Total:...' will become 'Ram Total:...'
--output-xml Return the output in XML format (to send to an XML API).
--output-json Return the output in JSON format (to send to a JSON API).
--output-openmetrics Return the output in OpenMetrics format (to send to a tool expecting this format).
--output-file Write output in file (can be combined with json, xml and openmetrics options). E.g.: --output-file=/tmp/output.txt will write the output in /tmp/output.txt.
--disco-format Applies only to modes beginning with 'list-'. Returns the list of available macros to configure a service discovery rule (formatted in XML).
--disco-show Applies only to modes beginning with 'list-'. Returns the list of discovered objects (formatted in XML) for service discovery.
--float-precision Define the float precision for thresholds (default: 8).
--source-encoding Define the character encoding of the response sent by the monitored resource Default: 'UTF-8'.
--datasource Database server information, mandatory if the server's address and port are not defined in the corresponding options. The syntax depends on the database type.
--username User name used to connect to the database.
--password Password for the defined user name.
--connect-options Add connection options for the DBI connect method. Format: name=value,name2=value2,...
--connect-query Execute a query just after the connection.
--sql-errors-exit Expected status in case of DB error or timeout. Possible values are warning, critical and unknown (default).
--timeout Timeout in seconds for connection.
--exec-timeout Timeout in seconds for query execution

Options des modes

Les options disponibles pour chaque modèle de services sont listées ci-dessous :

Option Description
--filter-counters Only display some counters (regexp can be used). Example to check SSL connections only : --filter-counters='^xxxx|yyyy$'
--filter-table Filter tables by name (can be a regexp).
--filter-index Filter indexes by name (can be a regexp).
--filter-size Filter tables and indexes by size (in bytes) keeping only sizes greater than the given value.
--warning-* --critical-* Thresholds. Can be: 'table-usage', 'table-free', 'table-dead-tuple', 'index-usage', 'index-leaf-density'.
Option Description
--memcached Memcached server to use (only one server).
--redis-server Redis server to use (only one server). Syntax: address[:port]
--redis-attribute Set Redis Options (--redis-attribute="cnx_timeout=5").
--redis-db Set Redis database index.
--failback-file Failback on a local file if redis connection failed.
--memexpiration Time to keep data in seconds (Default: 86400).
--statefile-dir Define the cache directory (default: '/var/lib/centreon/centplugins').
--statefile-suffix Define a suffix to customize the statefile name (Default: '').
--statefile-concat-cwd If used with the '--statefile-dir' option, the latter's value will be used as a sub-directory of the current working directory. Useful on Windows when the plugin is compiled, as the file system and permissions are different from Linux.
--statefile-format Define the format used to store the cache. Available formats: 'dumper', 'storable', 'json' (default).
--statefile-key Define the key to encrypt/decrypt the cache.
--statefile-cipher Define the cipher algorithm to encrypt the cache (Default: 'AES').
--warning Warning threshold.
--critical Critical threshold.
--lookback Threshold isn't on the percent calculated from the difference ('xxx_hitratio_now').
--include-database Filter databases using a regular expression.
--exclude-database Exclude databases using a regular expression.
Option Description
--warning Warning threshold in milliseconds.
--critical Critical threshold in milliseconds.
Option Description
--filter-counters Only display some counters (regexp can be used). Example to check SSL connections only : --filter-counters='^xxxx|yyyy$'
--check What to check (default: 'database') Can be: 'database', 'role', 'all'.
--include-database Filter databases using a regular expression.
--exclude-database Exclude databases using a regular expression.
--include-user Filter users using a regular expression.
--exclude-user Exclude users using a regular expression.
--noidle Idle connections are not counted.
--warning-database Threshold.
--critical-database Threshold.
--warning-database-pct Threshold in percentage.
--critical-database-pct Threshold in percentage.
--warning-instance Threshold.
--critical-instance Threshold.
--warning-instance-prct Threshold.
--critical-instance-prct Threshold.
--warning-role Threshold.
--critical-role Threshold.
--warning-role-prct Threshold in percentage.
--critical-role-prct Threshold in percentage.
Option Description
--filter-database Filter database to checks (Can use regexp).
--warning-size Warning threshold in bytes, maximum size allowed.
--critical-size Critical threshold in bytes, maximum size allowed.
Option Description
--warning Warning threshold. (example: "total=250,waiting=5,exclusive=20") 'total', 'waiting', or the name of a lock type used by Postgres.
--critical Critical threshold. (example: "total=250,waiting=5,exclusive=20") 'total', 'waiting', or the name of a lock type used by Postgres.
--include-database Filter databases using a regular expression.
--exclude-database Exclude databases using a regular expression.
Option Description
--warning Warning threshold in seconds.
--critical Critical threshold in seconds.
--include-database Filter databases using a regular expression.
--exclude-database Exclude databases using a regular expression.
--include-user Filter users a regular expression.
--exclude-user Exclude users a regular expression.
--idle Idle queries are counted.
Option Description
--sql-statement SQL statement that returns a number.
--format Output format (Default: 'SQL statement result : %i.').
--perfdata-unit Perfdata unit in perfdata output (Default: '')
--perfdata-name Perfdata name in perfdata output (Default: 'value')
--perfdata-min Minimum value to add in perfdata output (Default: '')
--perfdata-max Maximum value to add in perfdata output (Default: '')
--warning-* --critical-* Thresholds. Can be: 'value', 'execution-time'.
Option Description
--memcached Memcached server to use (only one server).
--redis-server Redis server to use (only one server). Syntax: address[:port]
--redis-attribute Set Redis Options (--redis-attribute="cnx_timeout=5").
--redis-db Set Redis database index.
--failback-file Failback on a local file if redis connection failed.
--memexpiration Time to keep data in seconds (Default: 86400).
--statefile-dir Define the cache directory (default: '/var/lib/centreon/centplugins').
--statefile-suffix Define a suffix to customize the statefile name (Default: '').
--statefile-concat-cwd If used with the '--statefile-dir' option, the latter's value will be used as a sub-directory of the current working directory. Useful on Windows when the plugin is compiled, as the file system and permissions are different from Linux.
--statefile-format Define the format used to store the cache. Available formats: 'dumper', 'storable', 'json' (default).
--statefile-key Define the key to encrypt/decrypt the cache.
--statefile-cipher Define the cipher algorithm to encrypt the cache (Default: 'AES').
--warning-* Warning threshold. Can be: 'commit', 'rollback', 'insert', 'delete', 'update', 'total-commit', 'total-rollback', 'total-insert', 'total-delete', 'total-update'.
--critical-* Critical threshold. Can be: 'commit', 'rollback', 'insert', 'delete', 'update', 'total-commit', 'total-rollback', 'total-insert', 'total-delete', 'total-update'.
--filter-database Filter database (can be a regexp).
Option Description
--filter-sql-name Filter tablespace name directly in sql query (LIKE sql syntax used).
--filter-name Filter tablespace name after getting all tablespaces (can be a regexp).
--warning-* --critical-* Thresholds. Can be: 'space-usage' (B).
Option Description
--warning Warning threshold in seconds. (use a range. it can be -0.3s or +0.3s.)
--critical Critical threshold in seconds. (use a range. it can be -0.3s or +0.3s.)
Option Description
--warning Warning threshold in seconds, maximum time interval since last vacuum.
--critical Critical threshold in seconds, maximum time interval since last vacuum.

Pour un mode, la liste de toutes les options disponibles et leur signification peut être affichée en ajoutant le paramètre --help à la commande :

/usr/lib/centreon/plugins/centreon_postgresql.pl \
	--plugin=database::postgres::plugin \
	--mode=tablespace \
	--help