Ad Widget

Collapse

Zabbix API Apply Multiple Templates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jmart
    Junior Member
    • Jun 2016
    • 8

    #1

    Zabbix API Apply Multiple Templates

    As the name suggests, I am trying to apply 3 standard templates to one server through the API.
    I see where I can clear specific templates, and add one template in the documentation, but is it possible to add more than template to a host?

    I tried both of these:

    { "jsonrpc": "2.0", "method": "host.update", "params": { "hostid": "HOSTID", "templates": [ { "templateid": "13845", "templateid": "10001", "templateid": "10050" } ] },

    { "jsonrpc": "2.0", "method": "template.massadd", "params": { "hosts": [ { "hostid": "13844" } ], "templates": [ { "templateid": "13845", "templateid": "10001", "templateid": "10050" } ] },


    Both did the same thing, removed all templates and added just one of the templates to the server.

    Any help would be greatly appreciated, I have searched the documentation and the internet and couldn't find any solution.
  • Jmart
    Junior Member
    • Jun 2016
    • 8

    #2
    I just realized I was missing {} around the other template id's.
    So problem is fixed.

    Comment

    • ken_dpsk
      Junior Member
      • May 2022
      • 1

      #3
      Like this .
      {"jsonrpc": "2.0", "method": "host.update", "params": {
      "hostid": "HOSTID",
      "templates": [ { "templateid": "13845" }, {"templateid": "10001"}, {"templateid": "10050" } ]},



      Comment

      Working...