Ad Widget

Collapse

<ask> how to get any value from graph using API ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anwar
    Junior Member
    • May 2013
    • 2

    #1

    <ask> how to get any value from graph using API ?

    Hi All,

    I just try to using zabbix API. I following step by step from https://www.zabbix.com/documentation/2.2/manual/apihttps://www.zabbix.com/documentation/2.2/manual/api

    i trying to using get method to get value from graph like bellow :

    Code:
    {
        "jsonrpc": "2.0",
        "method": "graph.get",
        "params": {
            "output": "extend",
            "sortfield": "name",
             "hostid": "10084"
        },
        "auth": "50ba559f6d083aa6454b8b3c4c203baa",
        "id": 1
    }
    Then i get value like bellow :

    Code:
    {
        "jsonrpc": "2.0",
        "result": [
            ...
    	
            {
                "graphid": "481",
                "name": "CPU load",
                "width": "900",
                "height": "200",
                "yaxismin": "0.0000",
                "yaxismax": "100.0000",
                "templateid": "0",
                "show_work_period": "1",
                "show_triggers": "1",
                "graphtype": "0",
                "show_legend": "1",
                "show_3d": "0",
                "percent_left": "0.0000",
                "percent_right": "0.0000",
                "ymin_type": "1",
                "ymax_type": "0",
                "ymin_itemid": "0",
                "ymax_itemid": "0",
                "flags": "0"
            },
            {
                "graphid": "463",
                "name": "CPU load",
                "width": "900",
                "height": "200",
                "yaxismin": "0.0000",
                "yaxismax": "100.0000",
                "templateid": "0",
                "show_work_period": "1",
                "show_triggers": "1",
                "graphtype": "0",
                "show_legend": "1",
                "show_3d": "0",
                "percent_left": "0.0000",
                "percent_right": "0.0000",
                "ymin_type": "1",
                "ymax_type": "0",
                "ymin_itemid": "0",
                "ymax_itemid": "0",
                "flags": "0"
            },
            {
                "graphid": "457",
                "name": "CPU load",
                "width": "900",
                "height": "200",
                "yaxismin": "0.0000",
                "yaxismax": "100.0000",
                "templateid": "0",
                "show_work_period": "1",
                "show_triggers": "1",
                "graphtype": "0",
                "show_legend": "1",
                "show_3d": "0",
                "percent_left": "0.0000",
                "percent_right": "0.0000",
                "ymin_type": "1",
                "ymax_type": "0",
                "ymin_itemid": "0",
                "ymax_itemid": "0",
                "flags": "0"
            },
            {
                "graphid": "495",
                "name": "CPU load",
                "width": "900",
                "height": "200",
                "yaxismin": "0.0000",
                "yaxismax": "100.0000",
                "templateid": "0",
                "show_work_period": "1",
                "show_triggers": "1",
                "graphtype": "0",
                "show_legend": "1",
                "show_3d": "0",
                "percent_left": "0.0000",
                "percent_right": "0.0000",
                "ymin_type": "1",
                "ymax_type": "0",
                "ymin_itemid": "0",
                "ymax_itemid": "0",
                "flags": "0"
            },
            {
                "graphid": "469",
                "name": "CPU load",
                "width": "900",
                "height": "200",
                "yaxismin": "0.0000",
                "yaxismax": "100.0000",
                "templateid": "0",
                "show_work_period": "1",
                "show_triggers": "1",
                "graphtype": "0",
                "show_legend": "1",
                "show_3d": "0",
                "percent_left": "0.0000",
                "percent_right": "0.0000",
                "ymin_type": "1",
                "ymax_type": "0",
                "ymin_itemid": "0",
                "ymax_itemid": "0",
                "flags": "0"
            },
            {
                "graphid": "433",
                "name": "CPU load",
                "width": "900",
                "height": "200",
                "yaxismin": "0.0000",
                "yaxismax": "100.0000",
                "templateid": "0",
                "show_work_period": "1",
                "show_triggers": "1",
                "graphtype": "0",
                "show_legend": "1",
                "show_3d": "0",
                "percent_left": "0.0000",
                "percent_right": "0.0000",
                "ymin_type": "1",
                "ymax_type": "0",
                "ymin_itemid": "0",
                "ymax_itemid": "0",
                "flags": "0"
            },
            {
                "graphid": "524",
                "name": "CPU load",
                "width": "900",
                "height": "200",
                "yaxismin": "0.0000",
                "yaxismax": "100.0000",
                "templateid": "433",
                "show_work_period": "1",
                "show_triggers": "1",
                "graphtype": "0",
                "show_legend": "1",
                "show_3d": "0",
                "percent_left": "0.0000",
                "percent_right": "0.0000",
                "ymin_type": "1",
                "ymax_type": "0",
                "ymin_itemid": "0",
                "ymax_itemid": "0",
                "flags": "0"
            },
            {
                "graphid": "534",
                "name": "CPU load",
                "width": "900",
                "height": "200",
                "yaxismin": "0.0000",
                "yaxismax": "100.0000",
                "templateid": "495",
                "show_work_period": "1",
                "show_triggers": "1",
                "graphtype": "0",
                "show_legend": "1",
                "show_3d": "0",
                "percent_left": "0.0000",
                "percent_right": "0.0000",
                "ymin_type": "1",
                "ymax_type": "0",
                "ymin_itemid": "0",
                "ymax_itemid": "0",
                "flags": "0"
            },
            {
                "graphid": "475",
                "name": "CPU load",
                "width": "900",
                "height": "200",
                "yaxismin": "0.0000",
                "yaxismax": "100.0000",
                "templateid": "0",
                "show_work_period": "1",
                "show_triggers": "1",
                "graphtype": "0",
                "show_legend": "1",
                "show_3d": "0",
                "percent_left": "0.0000",
                "percent_right": "0.0000",
                "ymin_type": "1",
                "ymax_type": "0",
                "ymin_itemid": "0",
                "ymax_itemid": "0",
                "flags": "0"
            },
            {
                "graphid": "487",
                "name": "CPU load",
                "width": "900",
                "height": "200",
                "yaxismin": "0.0000",
                "yaxismax": "100.0000",
                "templateid": "0",
                "show_work_period": "1",
                "show_triggers": "1",
                "graphtype": "0",
                "show_legend": "1",
                "show_3d": "0",
                "percent_left": "0.0000",
                "percent_right": "0.0000",
                "ymin_type": "1",
                "ymax_type": "0",
                "ymin_itemid": "0",
                "ymax_itemid": "0",
                "flags": "0"
            }
         
           ...
    
        ],
        "id": 1
    }
    From that output i can't get any value which like on graph which show on Zabbix Dashboard Graph.i also don't get any value on any graph which show on json output.

    How i can get value CPU Load like :

    processor load (1 min average per core) [avg] last:0.23 min:0.02 avg:017 max:0.74

    processor load (5 min average per core) [avg] last:0.17 min:0.02 avg:017 max:0.4

    etc



    Anyone could help me to solve this ?
  • anwar
    Junior Member
    • May 2013
    • 2

    #2
    It's happen on almost graps on zabbix graph.

    I've client on windows as zabbix agent.Inside these client there is disk space usage graph which tell me that :

    15.61 GB (color: green)
    21.49 GB (color: red)

    But on json graph method i just found :

    Code:
     "hosts": [
                    {
                        "hostid": "10085"
                    }
                ],
                "graphid": "540",
                "name": "Disk space usage C:",
                "width": "600",
                "height": "340",
                "yaxismin": "0.0000",
                "yaxismax": "0.0000",
                "templateid": "0",
                "show_work_period": "0",
                "show_triggers": "0",
                "graphtype": "2",
                "show_legend": "1",
                "show_3d": "1",
                "percent_left": "0.0000",
                "percent_right": "0.0000",
                "ymin_type": "0",
                "ymax_type": "0",
                "ymin_itemid": "0",
                "ymax_itemid": "0",
                "flags": "4"
            }
    There is no value which reprensented 15.61 GB or 21.49 GB.

    Anyone could help me how i can get these value ?

    Thanks

    Comment

    • Heilig
      Senior Member
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Mar 2013
      • 366

      #3
      If you need a history value, use history.get method.

      Comment

      • Pavels
        Member
        • Oct 2011
        • 83

        #4
        Currently there is no way to retrieve the aggregated values displayed on a graph. But, like Heilig said, you can access "raw" history values via the history API.

        Comment

        Working...