php监听接收数据,zabbix Curl API获取监控数据

获取auth

curl -i -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0","method": "user.login","params": {"user": "Admin","password": "passwd"},"id": 1}' http://192.168.1.1/api_jsonrpc.php

得到结果:{"jsonrpc":"2.0","result":"b599fd1f528fa28vu09983d1e5748d64","id":1}

获取group信息

curl -i -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0","method": "hostgroup.get","params": {"output": ["groupid","name"]},"auth":"b599fd1f528fa28vu09983d1e5748d64","id":0}' http://zabbix.test.net:8800/api_jsonrpc.php

获取group下host信息

curl -i -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0","method": "host.get","params": {"output": ["hostid","name"],"groupsid":"8"},"auth":"b599fd1f528fa28vu09983d1e5748d64","id":0}' http://zabbix.test.net:8800/api_jsonrpc.php

获取host的item

curl -i -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0","method": "item.get","params": {"output": "itemids","hostids":"10370","search":{"key_":"net.if.out[em1]"}},"auth":"b599fd1f528fa28vu09983d1e5748d64","id":0}' http://zabbix.test.net:8800/api_jsonrpc.php

获取item的历史数据

curl -i -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0","method": "history.get","params": {"history": 3,"itemids":"43535","time_form":"1418659201","time_till":"1418745599","output":"extend"},"auth":"b599fd1f528fa28vu09983d1e5748d64","id":0}' http://zabbix.test.net:8800/api_jsonrpc.php

查看帮助文档https://www.zabbix.com/documentation/2.4/manual/api

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值