Zabbix Documentation 3.4

2.23.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.43.23.4

User Tools

Site Tools


manual:discovery:low_level_discovery:sql_queries

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
manual:discovery:low_level_discovery:sql_queries [2017/06/21 13:08]
martins-v created; separate page for sql query discovery
manual:discovery:low_level_discovery:sql_queries [2019/01/28 14:50] (current)
sasha <code js> => <code java>
Line 1: Line 1:
 ==== 5 Discovery using ODBC SQL queries ==== ==== 5 Discovery using ODBC SQL queries ====
  
-This type of discovery is done using SQL queries, whose results get automatically transformed into a JSON object suitable for low-level discovery. SQL queries are performed using items of type "​Database monitor"​. Therefore, most of the instructions on [[:​manual/​config/​items/​itemtypes/​odbc_checks|ODBC monitoring]] page apply in order to get a working "​Database monitor"​ discovery rule, the only difference being that "db.odbc.discovery[<​description>,<​dsn>​]" ​key should be used instead of "​db.odbc.select[<​description>,<​dsn>​]"​.+=== Overview === 
 + 
 +This type of low-level [[:manual/discovery/​low_level_discovery|discovery]] ​is done using SQL queries, whose results get automatically transformed into a JSON object suitable for low-level discovery. ​ 
 + 
 +=== Item key === 
 + 
 +SQL queries are performed using "​Database monitor" ​item type. Therefore, most of the instructions on [[:​manual/​config/​items/​itemtypes/​odbc_checks|ODBC monitoring]] page apply in order to get a working "​Database monitor"​ discovery rule, the only difference being that 
 + 
 +  ​db.odbc.discovery[<​description>,<​dsn>​] 
 + 
 +key should be used instead of "​db.odbc.select[<​description>,<​dsn>​]"​
 + 
 +Discovery using SQL queries is supported since Zabbix server/​proxy 3.0.
  
 As a practical example to illustrate how the SQL query is transformed into JSON, let us consider low-level discovery of Zabbix proxies by performing an ODBC query on Zabbix database. This is useful for automatic creation of "​zabbix[proxy,<​name>,​lastaccess]"​ [[:​manual/​config/​items/​itemtypes/​internal|internal items]] to monitor which proxies are alive. As a practical example to illustrate how the SQL query is transformed into JSON, let us consider low-level discovery of Zabbix proxies by performing an ODBC query on Zabbix database. This is useful for automatic creation of "​zabbix[proxy,<​name>,​lastaccess]"​ [[:​manual/​config/​items/​itemtypes/​internal|internal items]] to monitor which proxies are alive.
Line 25: Line 37:
 By the internal workings of "​db.odbc.discovery[]"​ item, the result of this query gets automatically transformed into the following JSON: By the internal workings of "​db.odbc.discovery[]"​ item, the result of this query gets automatically transformed into the following JSON:
  
-<​code ​js>+<​code ​java>
 { {
     "​data":​ [     "​data":​ [