当前位置:网站首页>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
边栏推荐
- Pytoch squeeze() unsqueeze() usage
- Pytoch -- used by visdom
- Supplement - nonlinear programming
- Leetcode exercise - Sword finger offer II 005. maximum product of word length
- 逻辑漏洞----任意账号注册
- Search Yiwu shopping (PAI Li Tao) API by image
- Vb.net chart1 processing
- Pytorch squeeze() unsqueeze() 用法
- npm, npm中文文档, npm学习使用
- Triangular wave spectrum of MATLAB excitation model
猜你喜欢

一篇让小百彻底搞懂性能调优

Oppo self-developed large-scale knowledge map and its application in digital intelligence engineering

cmake编译obs-studio-27.2.0

day07-

In depth analysis of the source code, why is the string class immutable? (hit me before you understand)

Basic operation of (C language) files

也谈数据治理

matlab 基音周期估计后处理

Thoroughly understand the principle and implementation of service discovery

Attack and defense world ----- ics-07
随机推荐
Let Xiaobai thoroughly understand performance tuning
进程的概念和分类
matlab 基音周期估计后处理
Shrimp Shope takes the commodity list API according to keywords
Implementation of MATLAB short-time autocorrelation
day07-
虾皮shopee根据关键词取商品列表 API
I successfully landed the automatic testing post, with a maximum monthly salary of 15.4k. I'm great~
09 expr 命令
My SQL is OK. Why is it still so slow? MySQL locking rules
Is it safe to open an account on flush? How to choose a securities firm for opening an account
Circular progress bar animation based on cashapelayer and Bezier curve
Pinduoduo gets search term recommendation API
LDAP——实现用户统一登录管理
VB.net Chart1的处理
xshell7个人免费下载,使用
Join method in JS
Kalibr calibration realsensed435i -- multi camera calibration
Flink's real-time data analysis practice in iFLYTEK AI marketing business
Can you use redis? Then come and learn about redis protocol