zabbix系列教程-通过api获取相关信息

58次阅读
没有评论

获取组名称

curl -i -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "methon":"hostgroup.get","params":{"output":"extend","sortfield":"name"},"auth":"token","id":1}' http://192.168.1.1/zabbix/api_jsonrpc.php

获取itemid

curl -i -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "methon":"item.get","params":{"output":"itemid","hostids":"10421"},"auth":"token","id":1}' http://192.168.1.1/zabbix/api_jsonrpc.php

获取流量

curl -i -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "methon":"item.get","params":{"output":"extend","hostids":"10421","search":{"name":"sent","name":"receive"}},"auth":"token","id":1}' http://192.168.1.1/zabbix/api_jsonrpc.php

获取发送和接收流量

curl -i -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "methon":"item.get","params":{"output":"extend","hostid":"10421",search:{"key_":"IfInOctets","key_":"IfOutOctets"},"sortfield":"name"},"auth":"token","id":1}' http://192.168.1.1/zabbix/api_jsonrpc.php

获取历史 流量

curl -i -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "methon":"history.get","params":{"history":3,"output":"extend","itemids":"95123","time_from":"1648364400","time_till":"1648450800"},"sortfield":"name"},"auth":"token","id":1}' http://192.168.1.1/zabbix/api_jsonrpc.php

获取主机组

curl -i -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "methon":"hostgroup.get","params":{"history":3,"output":"extend","sortfield":"name"},"auth":"token","id":1}' http://192.168.1.1/zabbix/api_jsonrpc.php
正文完
 
oakcdrom
版权声明:本站原创文章,由 oakcdrom 2022-04-27发表,共计1444字。
转载说明:转载请注明出处。
评论(没有评论)