[ZBXNEXT-817] Multiline SQL queries in DB Monitor Created: 2011 Jun 15  Updated: 2017 May 31  Resolved: 2013 Sep 10

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Proxy (P), Server (S)
Affects Version/s: 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.9.1 (alpha), 1.9.2 (alpha), 1.9.3 (alpha), 1.9.4 (alpha), 1.9.5 (alpha)
Fix Version/s: 2.1.3

Type: Change Request Priority: Major
Reporter: Alexey Pustovalov Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: odbc, patch, trivial
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File db_monitor.diff    
Issue Links:
Duplicate
is duplicated by ZBX-7135 Unable to use macro values in "Databa... Closed

 Description   

this patch allow multi lines queries after key word "sql="



 Comments   
Comment by Oleksii Zagorskyi [ 2012 Jan 21 ]

Related forum thread: http://www.zabbix.com/forum/showthread.php?t=13047

Comment by Andris Zeila [ 2013 Aug 06 ]

Currently the dsn, user, password and sql are stored in items table params field (Additional parameters field in frontend).

It was decided to change how the ODBC data (dsn,user,password,sql) are stored:

  1. store dsn in item key as the second parameter: db.odbc.select[<unique short description>,<dsn>]
  2. store user,password in items table username,password fields
  3. store sql in items table params field
Comment by Andris Zeila [ 2013 Aug 06 ]

(1) [S] server changes

  1. assemble ODBC query from the key_, user, password and params fields
  2. create database patch to convert old database monitoring items to the new format

wiper RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-817 r37633

sasha CLOSED

Comment by Andris Zeila [ 2013 Aug 06 ]

(2) [F] frontend changes

Add the required fields (username,password) to database monitor item form, rename the 'Additional parameters' field to 'SQL query' and read/store the field data in respective items table fields.

jelisejev Fields username and password must be optional.

iivs RESOLVED in svn://svn.zabbix.com/branches/dev/ZBXNEXT-817 r37750

sasha CLOSED

Comment by Andris Zeila [ 2013 Aug 06 ]

(3) Documentation update

  1. https://www.zabbix.com/documentation/2.2/manual/introduction/whatsnew220
  2. https://www.zabbix.com/documentation/2.2/manual/installation/upgrade_notes_220
  3. https://www.zabbix.com/documentation/2.2/manual/config/items/itemtypes/odbc_checks

wiper updated upgrade notes, please review.

<richlv> let's also have an example of the error message that would be written in the logfile

wiper added, ugly ones though

<richlv> example messages are there, CLOSED

wiper not sure if something should be added to whatsnew, as the database monitoring was unofficial feature and the upgrade procedure is covered in upgrade notes, but the database monitoring item documentation must be updated with new example.

wiper updated also whatsnew, database monitoring item description. Please review

<richlv> thanks, seems ok to me -> CLOSED

Comment by richlv [ 2013 Aug 06 ]

please consider removing iodbc support at the same time, see ZBX-6852

wiper i don't think we have iodbc specific support in code, only in makefiles to link appropriate library. Then it's better handled separately.

Comment by Alexander Vladishev [ 2013 Aug 09 ]

(4) src/zabbix_server/poller/poller.c:664

  • substutute_simple_macros() function is called twice for SSH and TELNET items.
  • should be set 5th argument (hostid) for MACRO_TYPE_COMMON macros

wiper RESOLVED in r37696

sasha CLOSED

Comment by Alexander Vladishev [ 2013 Aug 09 ]

(5) src/zabbix_server/poller/checks_db.c:66

  • it would be better to use the new parse_item_key() and free_request() functions

wiper RESOLVED in r37701

sasha REVIEWED.

Please review my changes in r37712:37713.

wiper CLOSED

Comment by Alexander Vladishev [ 2013 Aug 09 ]

(6) parse_db_monitor_item_params() function

  • "pnext = strchr(params, '\n');" - better use "pvalue" as first parameter
  • function doesn't properly handle lines like "=" or "<key>=" or "=<value>"

wiper RESOLVED in r37699

sasha CLOSED

Comment by Alexander Vladishev [ 2013 Aug 09 ]

(7) DBpatch_2010094() function

  • The second parameter (DSN) should be quoted if it contains the special symbols. You can use quote_key_param() function.
  • Initially, item key can contain more than one parameter. All this shall be quoted if needed.

wiper RESOLVED in r37715

sasha REVIEWED

Please review my changes in r37726 and r37852.

wiper CLOSED

Comment by Alexander Vladishev [ 2013 Aug 15 ]

(8) [A] Documentation update:

iivs RESOLVED

sasha CLOSED

Comment by Alexander Vladishev [ 2013 Aug 15 ]

(10) [F] please review my changes in r37854.

iivs REVIEWED.
CLOSED.

Comment by Alexander Vladishev [ 2013 Aug 15 ]

(11) [F] please add support of DB Monitor lld-rules

iivs RESOLVED in r37865

sasha REOPENED "Warning. Incorrect value for field "type"." when trying to save "Database monitor" discovery rule.

iivs RESOLVED in r37869

sasha CLOSED

Comment by Alexander Vladishev [ 2013 Aug 15 ]

(12) [A] Documentation update (support of item types):

sasha RESOLVED

iivs CLOSED

Comment by Alexander Vladishev [ 2013 Aug 15 ]

Frontend is successfully tested!

Comment by Andris Zeila [ 2013 Aug 19 ]

Relased in:
pre-2.1.3 r37916

Comment by Andris Zeila [ 2013 Aug 19 ]

Reopening to finish documentation update

Generated at Sat Apr 20 10:21:39 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.