Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-16972

Database data import script is not working on DB2

XMLWordPrintable

    • Sprint 58 (Nov 2019), Sprint 59 (Dec 2019), Sprint 60 (Jan 2020)
    • 0.5

      Our data import scripts contains multiline text fields where some of lines are ending with ';' which cannot be processed by db2batch:

      ** CLI error in preparing the SQL statement:
      (-10): [IBM][CLI Driver][DB2/LINUXX8664] SQL0010N  The string constant beginning with "'Requirements for template operation: 1.Install Zabbix agent and MySQL" does not have an ending string delimiter.  SQLSTATE=42603
      

      The text being inserted is:

      INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress) values ('10170',NULL,'Template DB MySQL','3','-1','2','','','Template DB MySQL','0',NULL,'Requirements for template operation:
      1.Install Zabbix agent and MySQL client.
      2.Copy Template_DB_MySQL.conf into folder with Zabbix agent configuration (/etc/zabbix/zabbix_agentd.d/ by default). Don''t forget restart zabbix-agent. 
      3.Create MySQL user for monitoring. For example:
      CREATE USER ''zbx_monitor''@''%'' IDENTIFIED BY ''<password>'';
      GRANT USAGE,REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO ''zbx_monitor''@''%'';
      For more information read the MYSQL documentation https://dev.mysql.com/doc/refman/8.0/en/grant.html , please. 
      4.Create .my.cnf in home directory of Zabbix agent for Linux (/var/lib/zabbix by default ) or my.cnf in c:\ for Windows. For example:
      [client]
      user=zbx_monitor
      password=<password>','1','1','','','','','','1');
      

      If all ';' are removed from text value line endings then the data can be imported normally.

      Not sure if there are some db2batch options which might help (has to be checked first), but in worst case we need to investigate how to format such strings so db2batch can process them.

            viktors.tjarve Viktors Tjarve
            wiper Andris Zeila
            Team A
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: