Check manual page of check_sql

SQL Database Request Check

Distribution Official part of Checkmk
License GPLv2
Supported Agents Active
This is an active check that connects to a database server. It sends an SQL query to that server, and interprets the result in the following manner:

Only the first row of the result is considered, which must consist of one to three columns.

First column: A number. If levels are provided, this number will be considered a measurement value, that is compared against those levels. If no levels are provided, the number will be interpreted as the service state, where 0, 1, 2 and 3 represent `OK`, `WARN`, `CRIT` and `UNKNOWN`, respectively.

Second column: A text. The text is used as the service output. If there is no second column, the number from the first column will be displayed.

Third column: Metrics. Metrics must be in the standard format of nagios performance data. If no third column is present, the service will not have any metrics.

Currently the check works with MySQL, Postgresql, MSSQL, DB2, SQL Anywhere and Oracle databases. For this to work, additional python libraries must be installed (depending on the type of database one of psycopg2, pymysql, pymssql, oracledb, ibm_db, ibm_db_dbi and sqlanydb). For Oracle support the Oracle instantclient needs to be installed as well, and the LD_LIBRARY_PATH needs to be modified to point to the libclntsh.so of that package.

The oracle check supports procedure calls. It must return excactly one output variable. The value of the variable must be in the same format as the return value of the sql statement described above.

This check is configured by the WATO ruleset "Check SQL Database".

See the usage page of the check for details about the invocation on the command line (check_sql --help).

Item

The name of the active service