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

LLD host macros deleted during name update and then recreated with new name.

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 6.0.0alpha1
    • Server (S)

      That was found during testing new audit functionality. ** 
      Steps to reproduce:
      **

      1) Create host with discovery rule. Discovery key - vfs.file.contents[/home/sergejs/Documents/discovery2.txt]
      discovery2.txt file should have values like 

       {"data": [ {"{#KEY}": "1"}, {"{#KEY}": "2"}, {"{#KEY}": "3"} ]}

      2) Create host prototype with name - name_{#KEY} and macros. 
      macro: {$NAME}
      value: macro_value
      description: macro_description
      3) Turn on server and agent. Wait till 3 host appears.
      4) Change Macro name to - {$NAME2}.
      5) Check audit and server logs.

      Result:
      Audit:

      Server logs:

      82652:20210819:155809.293 In DBget_nextid() tablename:'hostmacro'
       82652:20210819:155809.293 query [txnlev:1] [select nextid from ids where table_name='hostmacro' and field_name='hostmacroid']
       82652:20210819:155809.293 query [txnlev:1] [update ids set nextid=nextid+3 where table_name='hostmacro' and field_name='hostmacroid']
       82652:20210819:155809.294 query [txnlev:1] [select nextid from ids where table_name='hostmacro' and field_name='hostmacroid']
       82652:20210819:155809.294 End of DBget_nextid():2279 table:'hostmacro' recid:'hostmacroid'
       82652:20210819:155809.294 query [txnlev:1] [insert into hostmacro (hostmacroid,hostid,macro,value,description,type) values (2279,10415,'{$NAME2}','macro_value','macro_description',0),(2280,10416,'{$NAME2}','macro_value','macro_description',0),(2281,10417,'{$NAME2}','macro_value','macro_description',0);
      ]
       82652:20210819:155809.294 query [txnlev:1] [delete from hostmacro where hostmacroid in (2276,2277,2278);
      ]
       82652:20210819:155809.294 query [txnlev:1] [commit;]
       82652:20210819:155809.295 End of lld_hosts_save()
       82652:20210819:155809.295 In lld_templates_link()
       82652:20210819:155809.295 End of lld_templates_link()
       82652:20210819:155809.295 query [txnlev:1] [begin;]
       82652:20210819:155809.295 query [txnlev:1] [update host_discovery set lastcheck=1629377889 where hostid in (10415,10416,10417);
      ]
       82652:20210819:155809.295 query [txnlev:1] [commit;]
       82652:20210819:155809.296 End of lld_update_hosts()
       82652:20210819:155809.296 query without transaction detected
       82652:20210819:155809.296 query [txnlev:0] [insert into auditlog (auditid,userid,username,clock,action,ip,resourceid,resourcename,resourcetype,recordsetid,details) values ('cksixixow000drw12hi95iiov',null,'System',1629377889,1,'',10416,'name_2',4,'cksixixow000crw123316fyh2','{"host.macros[2277]":["delete"],"host.macros[2280].name":["add","{$NAME2}"],"host.macros[2280].value":["add","macro_value"],"host.macros[2280].description":["add","macro_description"],"host.macros[2280].type":["add",0]}'),('cksixixow000erw12fn6egcvl',null,'System',1629377889,1,'',10417,'name_3',4,'cksixixow000crw123316fyh2','{"host.macros[2278]":["delete"],"host.macros[2281].name":["add","{$NAME2}"],"host.macros[2281].value":["add","macro_value"],"host.macros[2281].description":["add","macro_description"],"host.macros[2281].type":["add",0]}'),('cksixixow000frw1259si316u',null,'System',1629377889,1,'',10415,'name_1',4,'cksixixow000crw123316fyh2','{"host.macros[2276]":["delete"],"host.macros[2279].name":["add","{$NAME2}"],"host.macros[2279].value":["add","macro_value"],"host.macros[2279].description":["add","macro_description"],"host.macros[2279].type":["add",0]}');
      ] 

      Macro deleted. New macros with same value and description recreated.
      Expected:
      Just name update?

      maybe some improvement can be done in LLD macros. 

            zabbix.dev Zabbix Development Team
            smaklakovs Sergejs Maklakovs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: