Ad Widget

Collapse

get graph data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lukaszg
    Junior Member
    • Jun 2012
    • 2

    #1

    get graph data

    Hello,

    I am using Zabbix Api. I have some defined graphs and I want to retrieve all graph data to draw them in my application: graph parameters and all points on the graph.

    What functions I need to use to achieve this. I used graph.get to get descriptions of the graph and graphitem.get to get items of the given graph. In graphitem objects I have no x nor y...

    I want to draw graph by myself not retrieve redered graph from zabbix.

    I post:
    {"method":"graph.get", "auth":"a1835c9b608e7003c22bdb3fa340656a", "jsonrpc":"2.0", "params":{"search":{"name":"CPU Loads"}, "output":"extend"}, "id":"1dc45f68261e4fd29af53a6e83321f75"}

    and get

    {"jsonrpc":"2.0","result":[{"graphid":"2","name":"CPU Loads","width":"900","height":"200","yaxismin":"0. 0000","yaxismax":"100.0000","templateid":"0","show _work_period":"1","show_triggers":"1","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"}],"id":"1dc45f68261e4fd29af53a6e83321f75"}

    then I post
    {"method":"graphitem.get", "auth":"a1835c9b608e7003c22bdb3fa340656a", "jsonrpc":"2.0", "params":{"graphids":[ "2" ], "output":"extend"}, "id":"caf9445fd46e419498ec2348b82c4f40"}

    and recieve only 3 points, where in zabbix I see whole data. Also where can I find values of the graph? It seems there is only some unusefull data:

    {"jsonrpc":"2.0","result":[{"graphs":[{"graphid":"2"}],"gitemid":"2","graphid":"2","itemid":"18467","dra wtype":"0","sortorder":"0","color":"990000","yaxis side":"1","calc_fnc":"2","type":"0","periods_cnt": "5"},{"graphs":[{"graphid":"2"}],"gitemid":"3","graphid":"2","itemid":"18468","dra wtype":"0","sortorder":"0","color":"009900","yaxis side":"1","calc_fnc":"2","type":"0","periods_cnt": "5"},{"graphs":[{"graphid":"2"}],"gitemid":"4","graphid":"2","itemid":"18469","dra wtype":"0","sortorder":"0","color":"999900","yaxis side":"1","calc_fnc":"2","type":"0","periods_cnt": "5"}],"id":"caf9445fd46e419498ec2348b82c4f40"}
  • ghoz
    Senior Member
    • May 2011
    • 204

    #2
    you may have some luck retriving recent data with "history.get" .
    or you could directly ask your database...
    relevent table : history* for recent data and the trends* for longuer term history.

    should be way faster too...

    Comment

    Working...