diff --git a/doc/7-icinga-template-library.md b/doc/7-icinga-template-library.md
index dbc00991b..f7c9b9aae 100644
--- a/doc/7-icinga-template-library.md
+++ b/doc/7-icinga-template-library.md
@@ -949,6 +949,28 @@ mailq_timeout | **Optional.** Plugin timeout in seconds (default = 15).
mailq_servertype | **Optional.** [ sendmail | qmail | postfix | exim | nullmailer ] (default = autodetect).
+## pgsql
+
+Check command object for the `check_pgsql` plugin.
+
+Custom attributes passed as [command parameters](3-monitoring-basics.md#command-passing-parameters):
+
+Name | Description
+------------------------|---------------------------------------------------------------
+pgsql_hostname | **Optional.** Host name, IP Address, or unix socket (must be an absolute path).
+pgsql_port | **Optional.** Port number (default: 5432).
+pgsql_database | **Optional.** Database to check (default: template1).
+pgsql_username | **Optional.** Login name of user.
+pgsql_password | **Optional.** Password (BIG SECURITY ISSUE).
+pgsql_options | **Optional.** Connection parameters (keyword = value), see below.
+pgsql_warning | **Optional.** Response time to result in warning status (seconds).
+pgsql_critical | **Optional.** Response time to result in critical status (seconds).
+pgsql_timeout | **Optional.** Seconds before connection times out (default: 10).
+pgsql_query | **Optional.** SQL query to run. Only first column in first row will be read.
+pgsql_query_warning | **Optional.** SQL query value to result in warning status (double).
+pgsql_query_critical | **Optional.** SQL query value to result in critical status (double).
+
+
# Icinga 2 Windows plugins
To allow a basic monitoring of Windows clients Icinga 2 comes with a set of Windows only plugins. While trying to mirror the functionalities of their linux cousins from the monitoring-plugins package, the differences between Windows and Linux are too big to be able use the same CheckCommands for both systems.
diff --git a/itl/command-plugins.conf b/itl/command-plugins.conf
index 633c29b89..d81c642ea 100644
--- a/itl/command-plugins.conf
+++ b/itl/command-plugins.conf
@@ -1626,3 +1626,28 @@ object CheckCommand "mailq" {
}
}
}
+
+object CheckCommand "pgsql" {
+ import "plugin-check-command"
+ import "ipv4-or-ipv6"
+
+ command = [ PluginDir + "/check_pgsql" ]
+
+ arguments = {
+ "-H" = "$pgsql_hostname$"
+ "-P" = "$pgsql_port$"
+ "-d" = "$pgsql_database$"
+ "-l" = "$pgsql_username$"
+ "-p" = "$pgsql_password$"
+ "-o" = "$pgsql_options$"
+ "-w" = "$pgsql_warning$"
+ "-c" = "$pgsql_critical$"
+ "-t" = "$pgsql_timeout$"
+ "-q" = "$pgsql_query$"
+ "-W" = "$pgsql_query_warning$"
+ "-C" = "$pgsql_query_critical$"
+ }
+
+ vars.pgsql_hostname = "$check_address$"
+}
+