[ZBX-24285] Cannot inherit item prototype with key <K1> of template <T1> to host <H1>, because an item with the same key is already inherited from template <T1>. Created: 2024 Apr 01  Updated: 2024 Apr 11

Status: Open
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 6.4.13
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Dmitry Zimin Assignee: Michal Kudlacz
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2024-04-01-14-10-34-674.png     PNG File image-2024-04-01-14-12-29-660.png     PNG File image-2024-04-05-08-58-59-485.png     PNG File image-2024-04-05-09-11-08-881.png     PNG File image-2024-04-05-09-19-34-939.png     PNG File image-2024-04-11-17-06-21-157.png     PNG File image-2024-04-11-17-10-19-813.png     File issue_templates.yaml    

 Description   

Steps to reproduce:

I'm trying to add template T2 to template T1 and I'm getting an error:

Cannot inherit item prototype with key <K1> of template <T1> to host <H1>, because an item with the same key is already inherited from template <T1>.

In this case, key K1 exists only in template T2. This key is not in host H1 or in template T1.

Result:



 Comments   
Comment by Michal Kudlacz [ 2024 Apr 03 ]

Hi,

Please can you unlink all templates from a 1602-N0028 host, then reload configuration cache with

zabbix_server -R config_cache_reload

and try linking templates to each other once again?

Would you be able to share templates that are being used so we can try reproducing the issue?

Thanks

Comment by Dmitry Zimin [ 2024 Apr 03 ]

When I unlink all templates from the host 1602-N0028, it starts swearing at the next host and so on ad infinitum.

Comment by Dmitry Zimin [ 2024 Apr 03 ]

My templates issue_templates.yaml

Comment by Michal Kudlacz [ 2024 Apr 05 ]

Thanks for sharing. I haven't encountered any issues linking 'Template BRL SMART by Zabbix agent 2' to 'Template BRL Workstation Laptop' while the latter was already linked to the host.
Had you previously used the 'SMART by Zabbix agent 2' on that host? If so, I would suggest unlinking and clearing the template from all hosts, removing the template from Zabbix, and then re-importing it from 'issue_templates.yaml' to the new host.

I can only reproduce this issue when the host already has the 'SMART by Zabbix agent 2' template attached. This behavior is entirely expected due to conflicting items but after unlinking the 'SMART by Zabbix agent 2' template from the host, everything works fine.

Tested on versions 6.4.12 and 6.4.13. Images for reference.



Comment by Dmitry Zimin [ 2024 Apr 05 ]

This template has never been associated with the host nodes where the error occurs. I showed screenshots and there are no items even with similar names. If I unlink and clear all templates from the host on which the error occurs, then the error appears on the next host. I clear it on the next one, it appears on the new one. And so on endlessly.

If convenient, I can show you via Zoom.

Comment by Dmitry Zimin [ 2024 Apr 11 ]

removing the template from Zabbix, and then re-importing it from 'issue_templates.yaml' - Did not help. Same error.

 

If the template linking directly to the host, then no error occurs.

Comment by Dmitry Zimin [ 2024 Apr 11 ]

I'm dump variables $item and $row from a function getChildObjectsUsingName.

I don’t understand where the host item "smart.disk.critical_warningNAME" comes from.
 

Result:

Last query before error:

SELECT i.itemid,ht.hostid,i.key_,i.templateid,i.flags,h.status AS host_status,ht.templateid AS parent_hostid,id.parent_itemid AS ruleid,COALESCE(id.parent_itemid,0) AS ruleid FROM hosts_templates ht INNER JOIN items i ON ht.hostid=i.hostid INNER JOIN hosts h ON ht.hostid=h.hostid LEFT JOIN item_discovery id ON i.itemid=id.itemid WHERE ht.templateid=55580 AND i.key_='smart.disk.critical_warning[{#NAME}]' AND ht.hostid IN (57215,57551,57906,58162,58243,58288,58289,58290,58291,58292,58297,58298,58299,58301,58304,58308,58315,58318,58322,58327,58335,58336,58357,58361,58362,58371,58391,58440,58441,58443,58449,58467,58469,58471,58494,58495,58503,58509,58515,58520,58524,58529,58553,58745,58749,58753,58758,58782,58801,58806,58813,58817,58820,58822,58823,58903,58969,58974,58978,59184,59421,59541,59560,59561,59615,59617,59619,59622,59628,59655,59660,59708,59714,59752,59796,59802,59851,59864,59930,59945,59970,60014,60015,60016,60018,60033,60081,60180,60269,60271,60295,60446,60460,60556,60613,60630,60638,60676,60696,60708,60710,60712,60713,60716,60717,60725,60753,60754,60755,60756,60757,60758,60770,60771,60772,60774,60775,60776,60777,60778,60781,60782,60783,60784,60785,60786,60787,60788,60789,60790,60795,60796,60797,60800,60801,60808,60809,60810,60813,60814,60816,60819,60821,60825,60826,60828,60830,60832,60833,60837,60845,60847,60884,60886,60892,60896,60899,60900,60901,60906,60907,60911,60916,60919,60920,60923,60931,60934,60937,60968,60979,60983,60993,60994,60995,60998,61008,61012,61013,61014,61019,61067,61080,61081,61082,61134,61148,61150,61152,61178,61200,61201,61209,61277,61305,61344,61384,61422,61463,61498,61502,61532,61577,61578,61579,61628,61698,61825,61826,61847,61959,61960,61961,62040,62050,62063,62081,62132,62167,62318,62350,62354,62369,62466,62473,62478,62479,62480,62487,62492,62529,62651,62657,62860,62934,63003,63006,63040,63042,63159,63189,63218,63274,63275,63276,63278,63280,63346,63367,63411,63414,63415,63416,63439,63445,63446,63494,63495,63496,63497,63498,63499,63501,63533,63542,63670,63681,63785,64059,64065,64148,64155,64163,64167,64199,64243,64298,64522,64540,64588,64627,64661,64671,64780,64966,65080,65087,65160,65161,65162,65223,65267,65280,65281,65331,65405,65419,65460,65466,65523,65573,65623,65624,65636,65638,65680,65682,65683,65684,65685,65696,65698,65701,65709,65710,65711,65713,65714,65716,65734,65736,65742,65745,65749,65764,65767,65773,65801,65819,65868,65874,65881,65908,65957,65968,65971,65978,66029,66030,66033,66035,66203,66248,66259,66260,66291,66327,66330,66333,66336,66342,66343,66364,66373,66374,66381,66421,66429,66485,67019,67461,67562,67564,67589,67590,67594,67605,67607,67619,67663,67699,67700,67701,67702,67710,67718,67764,67767,67768,67769,67774,67775,67808,67818,67823,67824,67825,67826,67830,67842,67859,67894,67895,67904,67937,67938,67952,67966,67967,68274,68315,68321,68440,68442,68443,68447,68457,68551,68552,68615,68620,68621,68622,68624,68629,68635,68688,68720,68721,68731,68733,68740,68741,68742,68745,68803,68807,68808,68838,68845,68850,68903,68904,68911,68936,68937,68938,68977,69001,69003,69004,69031,69038,69072,69081,69088,69089,69090,69110,69111,69137,69138,69179,69226,69239,69247,69252,69253,69256,69257,69258,69259,69293,69294,69295,69296,69333,69340,69350,69381,69390,69396,69401,69402,69450,69529,69539,69540,69560,69564,69572,69580,69623,69628,69633,69640,69667,69682,69735,69737,69770,69772,69773,69796,69797,69802,69803,69816,69818,69892,69893,69894,69921,69922,69938,69979,69982,69987,69988,69992,70001,70041,70043,70059,70066,70073);
$item = Array
(
    [hostid] => 55580
    [templateid] => 2944491
    [ruleid] => 3028375
    [name] => SMART [{#NAME}]: Critical warning
    [type] => 18
    [key_] => smart.disk.critical_warning[{#NAME}]
    [value_type] => 3
    [units] => 
    [history] => 7d
    [trends] => 365d
    [valuemapid] => 0
    [logtimefmt] => 
    [description] => This field indicates critical warnings for the state of the controller.
    [status] => 0
    [discover] => 0
    [authtype] => 0
    [username] => 
    [password] => 
    [params] => 
    [timeout] => 3s
    [delay] => 0
    [trapper_hosts] => 
    [master_itemid] => 3029134
    [url] => 
    [query_fields] => 
    [request_method] => 0
    [post_type] => 0
    [posts] => 
    [headers] => 
    [status_codes] => 200
    [follow_redirects] => 1
    [retrieve_mode] => 0
    [output_format] => 0
    [http_proxy] => 
    [verify_peer] => 0
    [verify_host] => 0
    [ssl_cert_file] => 
    [ssl_key_file] => 
    [ssl_key_password] => 
    [allow_traps] => 0
    [ipmi_sensor] => 
    [jmx_endpoint] => 
    [snmp_oid] => 
    [publickey] => 
    [privatekey] => 
    [tags] => Array
        (
            [0] => Array
                (
                    [tag] => component
                    [value] => storage
                    [itemtagid] => 1842178
                )

            [1] => Array
                (
                    [tag] => diskname
                    [value] => {#NAME}
                    [itemtagid] => 1842179
                )

            [2] => Array
                (
                    [tag] => disktype
                    [value] => {#DISKTYPE}
                    [itemtagid] => 1842180
                )

        )

    [preprocessing] => Array
        (
            [0] => Array
                (
                    [step] => 1
                    [type] => 12
                    [params] => $.critical_warning
                    [error_handler] => 0
                    [error_handler_params] => 
                    [item_preprocid] => 2330965
                )

            [1] => Array
                (
                    [step] => 2
                    [type] => 20
                    [params] => 6h
                    [error_handler] => 0
                    [error_handler_params] => 
                    [item_preprocid] => 2330966
                )

        )

    [uuid] => 
    [itemid] => 3029894
    [host_status] => 3
    [flags] => 2
)
$row = Array
(
    [itemid] => 3031226
    [hostid] => 57215
    [key_] => smart.disk.critical_warning[{#NAME}]
    [templateid] => 3029894
    [flags] => 2
    [host_status] => 0
    [parent_hostid] => 55580
    [ruleid] => 3028695
)
$lld_links[$item['ruleid']][$row['hostid']] = 3028695

If I run a query in the database, it returns an empty result.

Generated at Fri Aug 08 17:18:23 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.