Sidebar

api:graph:get

This is an old revision of the document!


Table of Contents

get()

Available since version: 1.8
This method allows you to retrieve graph details based on filtering options. All parameters are optional. If parameter is set in query this option counted as ON, except if parameter is equal to NULL.

Parameters

ParameterTypeDescriptionDetails
nodeidsarrayNode IDs
groupidsarrayHostGroup IDs
templateidsarrayTemplate IDs
hostidsarrayHost IDs
graphidsarrayGraph IDs
itemidsarrayItem IDs
typeintegerGraph type
inheritedintegerInherited from templates “0” - not inherited, “1” - inherited
templatedintegerTemplated items “0” - belongs to hosts, “1” - belongs to templates
editableintegeronly with read-write permission. Ignored for SuperAdmins
filterarrayOptional filter by graph fields
searcharrayReturn graphs by any given object field pattern
startSearchintegerSearch graphs field pattern only in start of the field
excludeSearchintegerExclude from result, graphs by given field pattern
searchWildcardsEnabledintegerSearch pattern in whole field using wildcards 1 - enable, 0 - disable
outputstringOutput options Values: shorten, refer, extend
select_groupsstringSelect host groups Values: shorten, refer, extend
select_templatesstringSelect host templates Values: shorten, refer, extend
select_hostsstringSelect hosts Values: shorten, refer, extend
select_itemsstringSelect host items Values: shorten, refer, extend
select_graph_itemsstringSelect graph items Values: shorten, refer, extend
countOutputintegerCount graphs, return the number of graphs found
groupCountintegerReturn the number of results grouped by given IDs
preservekeysintegerReturn hash instead of array Keys of hash are object IDs
sortfieldstringSort by graph field Values: graphid, name
sortorderstringSort order Values: ASC, DESC
limitintmax number of graph objects to return

Returns

ParameterDescription
resultOperation successful. Result will contain array of Graph objects.
errorIn case of any errors

Example

Get graphs details for graphs containing “CPU” in their names for host “ZABBIX-Server” and limit output to two graphs:

{
   "jsonrpc":"2.0",
   "method":"graph.get",
   "params":{
      "output":"extend",
      "search":{
         "name":"CPU"
      },
      "filter":{
         "host":[
            "Zabbix-server"
         ]
      },
      "limit":2
   },
   "auth":"6f38cddc44cfbb6c1bd186f9a220b5a0",
   "id":2
}

Retrieved graph details:

{
   "jsonrpc":"2.0",
   "result":[
      {
         "graphid":"100100000000589",
         "name":"CPU Loads 2",
         "width":"900",
         "height":"400",
         "yaxismin":"0.0000",
         "yaxismax":"100.0000",
         "templateid":"0",
         "show_work_period":"1",
         "show_triggers":"0",
         "graphtype":"0",
         "show_legend":"0",
         "show_3d":"0",
         "percent_left":"0.0000",
         "percent_right":"0.0000",
         "ymin_type":"0",
         "ymax_type":"0",
         "ymin_itemid":"0",
         "ymax_itemid":"0"
      },
      {
         "graphid":"100100000006093",
         "name":"CPU Loads",
         "width":"900",
         "height":"400",
         "yaxismin":"0.0000",
         "yaxismax":"100.0000",
         "templateid":"0",
         "show_work_period":"1",
         "show_triggers":"0",
         "graphtype":"0",
         "show_legend":"0",
         "show_3d":"0",
         "percent_left":"0.0000",
         "percent_right":"0.0000",
         "ymin_type":"0",
         "ymax_type":"1",
         "ymin_itemid":"0",
         "ymax_itemid":"0"
      }
   ],
   "id":2
}