Ad Widget

Collapse

Create a graph vinculated to a template using the API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jann_f
    Junior Member
    • Sep 2023
    • 1

    #1

    Create a graph vinculated to a template using the API

    Hello, I trying to use the api to create graphs for a template, but in the api documentation there is not mention of it(at least I didn't see) and when i try to add the param hostid and pass on it the templateid, instead of creating a graph for the template, it's creating a graph for the host that it's using the template of that id, and if I try passing a templateid on the request, all i get is a error saying there is no param with that name, does anyone know how to make this work or if it's possible to use the api to do it?

    the request body that I'm using is:

    {
    "jsonrpc": "2.0",
    "method": "graph.create",
    "params": {
    "name": "test",
    "width": 900,
    "height": 200,
    "hostid": 10602,
    "gitems": [
    {
    "itemid": "45718",
    "color": "00AA00"
    }
    ]
    },
    "auth": "28d221196ed601869054d32de449cc62",
    "id": 1
    }

    the templateid is 10602, while the host that is using this template has the hostid as 10604, but even so the ​graph is created only for the host, not for the template.​ I'm using zabbix 6.0.
Working...