如何从Zabbix获取图形值API
问题描述:
我只是尝试使用zabbix API。我以下从https://www.zabbix.com/documentation/2.2/manual/api如何从Zabbix获取图形值API
我试图使用GET方法获得从图形值像波纹管步步:
{
"jsonrpc": "2.0",
"method": "graph.get",
"params": {
"output": "extend",
"sortfield": "name",
"hostid": "10084"
},
"auth": "50ba559f6d083aa6454b8b3c4c203baa",
"id": 1
}
然后我得到值像波纹管:
{
"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
}
从该输出I无法获得像Zabbix Dashboard Graph.i上显示的图形上的任何值,也不会在任何显示在json输出上的图上获得任何值。
我怎样才能获得价值CPU负载,如:
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
任何人都可以帮助我解决这个问题?