Ad Widget

Collapse

Zabbix 6.0 API Link template to host

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thomasmunich
    Junior Member
    • May 2023
    • 1

    #1

    Zabbix 6.0 API Link template to host

    I'm using the Zabbix API a lot to setup systems in a fully automated way.

    In Zabbix 5.4 I'm using the API to link a template to a host via template.massadd​. There I'm stating the templateid and the hostid:

    {
    "jsonrpc": "2.0",
    "method": "template.massadd",
    "params": {
    "templates": [
    {
    "templateid": "${templateid}"
    }
    ],
    "hosts": [
    {
    "hostid": "${hostid}"
    }
    ]
    },
    "id": 1,
    "auth": "${auth}"
    }


    That hosts parameter is not available anymore in Zabbix 6.0 API (ZBXNEXT-6867 template.create, template.update, template.massadd, template.massupdate: dropped support of parameter hosts.​​).

    What is the proper way to link an additional template to a host in Zabbbix 6.0 API ?


    There is an option via host.update to state a template ID to link a template. But all existing linked templates are removed.
    So that's not a valid option.
  • akeller
    Junior Member
    • Nov 2022
    • 1

    #2
    I was thrown for a loop by this, but I found that the same functionality is now available through "host.massadd" and "host.massremove". All you need to do is change the method name.

    I assume that, five months after you asked the question, you found the answer, but I will post here in case you didn't, and in case anyone else has this problem.

    Comment

    Working...