[ZBX-8530] Cannot delete interface and unlink template at the same time Created: 2014 Jul 28  Updated: 2017 May 30  Resolved: 2014 Aug 13

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.2.4, 2.2.5
Fix Version/s: 2.3.4

Type: Incident report Priority: Trivial
Reporter: Kazuo Ito Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: interfaces, templatelinking
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File error.png    
Issue Links:
Duplicate

 Description   

How to reproduce:

1) Create Host

  • with Zabbix agent and SNMP agent interface
  • link to Template SNMP OS Linux
  • Save

2) Unlink Template SNMP OS Linux (without saving)
3) delete SNMP interfaces
4) Save
5) Interface is linked to item ... error happens (attached screenshot)



 Comments   
Comment by Krists Krigers (Inactive) [ 2014 Aug 07 ]

Hello kazuo.ito,

did You use "Unlink" or "Unlink and clear" link to unlink template?

Simply unlinking a template does not remove items created by it and therefore you get an error because interface being removed has items (from now unlinked template) using it. This is correct behavior.

On the other hand - when using "Unlink and clear" to unlink a template items created when linking to template are removed. Interface then can be removed without problems.

Comment by Kazuo Ito [ 2014 Aug 07 ]

Hello Krists Krigers,

I tried both.
"Unlink" or "Unlink and clear" was the same result.

Comment by Krists Krigers (Inactive) [ 2014 Aug 07 ]

Fixed template linking and interface update order, commited in r47914, branch svn://svn.zabbix.com/branches/dev/ZBX-8530.

Comment by Ivo Kurzemnieks [ 2014 Aug 08 ]

(1) I executed host.update with the following code:

{
    "hostid": "10258",
    "interfaces": [
        {
            "type": 1,
            "main": 1,
            "useip": 1,
            "ip": "192.168.3.1",
            "dns": "",
            "port": "10050"
        }
    ],
    "templates_clear ": [
        {
            "templateid": "10069"
        }
    ]
}

and received the same error.

kristsk RESOLVED - given API data has extra space in element key - "templates_clear ". Without this extra space API call works as expected.

iivs Ok, sorry then.
CLOSED.

Comment by Ivo Kurzemnieks [ 2014 Aug 19 ]

TESTED.

Note that this works with "unlink and clear". Simple unlinking does not delete items.

Comment by Krists Krigers (Inactive) [ 2014 Aug 20 ]

Fixed and merged to 2.3.4 (trunk) in r48241.

API changelog updated:
https://www.zabbix.com/documentation/2.4/manual/api/changes_2.2_-_2.4?&#host

Generated at Tue Jul 08 07:25:32 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.