当前位置:网站首页>ZABBIX calls API retrieval method
ZABBIX calls API retrieval method
2022-07-26 22:06:00 【Brother Xing plays with the clouds】
Environmental Science
zabbix:172.16.128.16;zabbix_web:172.16.16.16/zabbix
user name :Admin password :zabbix
The data obtained is for reference only , With Linux send out HTTP Of POST Request as an example
a. Login and get authentication token
{ "jsonrpc": "2.0", "method": "user.login", "params": { "user": "Admin", "password": "zabbix" }, "id": 1, "auth": null }
curl -H "Content-Type: application/json-rpc" -d '{"jsonrpc":"2.0","method":"user.login","params":{"user":"Admin","password":"zabbix"},"id":1,"auth":null}' http://172.16.128.16/zabbix/api_jsonrpc.php
If you provide credentials correctly ,API The response returned will contain the user authentication token
{ "jsonrpc": "2.0", #jsonrpc - JSON-RPC Version of protocol "result": "7ef823a58b59c1a17f519fe4d0e3cc44", #result - Method "id": 1 #id - Identifier of the corresponding request }
b. Retrieve all configured hosts ID, Host name and interface
{ "jsonrpc": "2.0", "method": "host.get", "params": { "output": [ "hostid", "host" ], "selectInterfaces": [ "interfaceid", "ip" ] }, "id": 1, "auth": "7ef823a58b59c1a17f519fe4d0e3cc44" #auth - Property is now set to let's call user.login Method }
curl -H "Content-Type: application/json-rpc" -d '{"jsonrpc":"2.0","method":"host.get","params":{"output":["hostid","host"],"selectInterfaces":["interfaceid","ip"]},"id":1,"auth":"7ef823a58b59c1a17f519fe4d0e3cc44"}' http://172.16.128.16/zabbix/api_jsonrpc.php
c. Obtained by hostid utilize item.get obtain itemid And its lastvalue
curl -H 'Content-Type: application/json-rpc' -d '{"jsonrpc": "2.0","method":"host.get","params":{"output":["hostid"],"filter": {"host":"50278791-59ab-2966-e86a-e04cd01eff6a"}},"auth": "7ef823a58b59c1a17f519fe4d0e3cc44","id":1}' http://172.16.128.16/zabbix/api_jsonrpc.php # adopt host name , retrieval hostid
curl -H "Content-Type: application/json-rpc" -d '{"jsonrpc": "2.0","method": "item.get","params": {"output": "extend","hostids": "27789","search": {"key_": "vmware.vm.cpu.usage"},"sortfield": "name"},"id":1,"auth":"7ef823a58b59c1a17f519fe4d0e3cc44"}' http://172.16.128.16/zabbix/api_jsonrpc.php # adopt hostid, obtain itemid And its lastvalue value
curl -H "Content-Type: application/json-rpc" -d '{"jsonrpc": "2.0","method": "item.get","params": {"output": "extend","hostids": "27789","itemids": "1095468","sortfield": "name"},"id":1,"auth":"7ef823a58b59c1a17f519fe4d0e3cc44"}' http://172.16.128.16/zabbix/api_jsonrpc.php # adopt hostid and itemid, retrieval lastvalue value
d. Get historical data of monitoring items
{ "jsonrpc": "2.0", "method": "history.get", "params": { "output": "extend", "history": 3, # object type "itemids": "1095468", "sortfield": "clock", "sortorder": "DESC", "limit": 10 # Number of data }, "auth": "7ef823a58b59c1a17f519fe4d0e3cc44", "id": 1 }
curl -H "Content-Type: application/json-rpc" -d '{"jsonrpc": "2.0","method": "history.get","params": {"output": "extend","history": 3,"itemids": "1095468","sortfield": "clock","sortorder": "DESC","limit":10},"id":1,"auth":"7ef823a58b59c1a17f519fe4d0e3cc44"}' http://172.16.128.16/zabbix/api_jsonrpc.php # Get the latest... From the unsigned digital monitor item 10 Data
e. Retrieve multiple itemid
curl -H "Content-Type: application/json-rpc" -d '{"jsonrpc":"2.0","method":"history.get","params":{"output":"extend","hostids":"1095468","itemids":["26353","26352","26357","26356","26355","26354","26359","26358","25754","25750","25751","25748","25768","25755","25752","25759","25760","25753","25761","26348","26350","26349","26351","25749","25767","25756","25757","25758","25769","25770","25771"],"sortfield":"clock","sortorder":"DESC","limit": 31},"id":1,"auth":"7ef823a58b59c1a17f519fe4d0e3cc44"}' http://172.16.128.16/zabbix/api_jsonrpc.php
边栏推荐
- Logical vulnerability - arbitrary account registration
- Altium Designer 22 中文字符乱码
- Pytorch torch.add() torch.add_() 用法
- Happens-Before原则深入解读
- I successfully landed the automatic testing post, with a maximum monthly salary of 15.4k. I'm great~
- Search Yiwu shopping (PAI Li Tao) API by image
- Just one dependency to give swagger a new skin, which is simple and cool
- Pytorch squeeze() unsqueeze() 用法
- matlab 画短时平均幅度谱
- Triangular wave spectrum of MATLAB excitation model
猜你喜欢

My SQL is OK. Why is it still so slow? MySQL locking rules
![[shutter -- geTx] pop up - dialog, snackBar, bottomsheet](/img/17/af2e45620e96a78235081145b7bb76.png)
[shutter -- geTx] pop up - dialog, snackBar, bottomsheet

matlab 画短时平均幅度谱

MOS 管示意图
![[mysql]substr usage - query the value of specific digits of a field in the table](/img/d5/68658ff15f204dc97abfe7c9e6b354.png)
[mysql]substr usage - query the value of specific digits of a field in the table

彻底搞通服务发现的原理和实现

Altium Designer 22 中文字符乱码

知识库工具 | 微网站、文档中心、形象展示页拖拽即可生成(附模板,直接用)

Thoroughly understand the principle and implementation of service discovery

Join method in JS
随机推荐
知识库工具 | 微网站、文档中心、形象展示页拖拽即可生成(附模板,直接用)
Vb.net chart1 processing
matlab 激励模型 三角波频谱
AFNetworking了解
Ren Zhengfei talked about the suppression of the United States again: to live is to win, and to defeat the United States
Cmake compiling obs-studio-27.2.0
Circular progress bar animation based on cashapelayer and Bezier curve
Highlight the secondary and tertiary columns under the primary column of pbootcms
拼多多获得搜索词推荐 API
MOS 管示意图
matlab 画短时能量图
JDBC operation and entry case of MySQL
Li Kou daily question - day 43 -168. Name of Excel table column
Operating guidelines and suggestions for spot gold (Part 1)
Go ---- variable usage in go language
七月集训(第26天) —— 并查集
虾皮shopee根据关键词取商品列表 API
FreeRTOS personal notes - Events
攻防世界----ics-07
仅需一个依赖给Swagger换上新皮肤,既简单又炫酷~