Ad Widget

Collapse

graph.get wrong graphid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marsipulami
    Junior Member
    • May 2012
    • 18

    #1

    graph.get wrong graphid

    I have a lot of hosts in zabbix. all of these hosts share the same template and graphs.

    When i use the api function graph.get i expect the actual graphid of the specific host instead of the graphid of the template. I get the "templatepgraphid" for every host.

    What is wrong with my code? thanx in advance

    Code:
    {
    						   "jsonrpc":"2.0",
    						   "method":"graph.get",
    						   "params":{
    							  "output":"extend",
    							"filter":{
    								 "hostids":[{
    									"hostid":"'.$array[$i].'"
    								 }],
    								 "templateids":
    										[{"templateid":"100100000000402"}]
    							  },
    							  "limit":1
    						   },
    						   "auth":"'.$auth.'",
    						   "id":2
    						}
    Last edited by marsipulami; 05-06-2012, 10:54. Reason: graph.get graphid wrong
  • mmarkwitzz
    Senior Member
    • Jan 2011
    • 106

    #2
    Hostids and Templateids should be directly in params (not in filters) and the type should be array (not hash list), like below. I tested it with hostids with my own scripts and works as expected. Dunno about templateids, but it should follow the same rules.

    Code:
    {
    				   "jsonrpc":"2.0",
    				   "method":"graph.get",
    				   "params":{
    					  "output":"extend",
    					  "hostids":[	"'.$array[$i].'" ],
    					  "templateids":[ "100100000000402" ]
    					  "limit":1
    				   },
    				   "auth":"'.$auth.'",
    				   "id":2
    				}

    Now, if I only knew how to specify the parent hostid for graph.create...

    Comment

    Working...