-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUser guide.txt
45 lines (35 loc) · 3.64 KB
/
User guide.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# RESTful API Usage
The RESTful API allows you currently only to get monitoring information about exiting metrics. This can be done by posting a request to
http://<monitoring_server_ip>/calledMethod?
by identifying the calledMethod. You will then get a response including the results.
Table 1 shows metrics already supported with their corresponding function calls in RESTful APIs.
Before requesting information data you need first to get an authentication token using your credentials. This can be done using curl or GET, as follow:
GET “http://localhost:8080/authentication?username=admin&password=zabbix”
where the username=admin and password=zabbix are the default settings, the local host is used as server_ip, but if Zabbix server is set to any IP, please use that one
You get the following response:
{"result":"4dcdcda6fec4cdf077445298d555fe60"}
You use the token that you have got as result in further requests. For example if you need to get the host ID, you post the following request:
GET “http://localhost:8080/hosts?authentication=4dcdcda6fec4cdf077445298d555fe60”
You get the following response:
{"hostList":[{"hostid":"10093","hostName":"Monitor"}]}
Table 1 - Monitoring Metrics and Operations in RESTful API
Metric/Operation Name RESTful_call
getUserAuthenticationToken http://<server_ip>:<port>/authentication?username=<user_name>&password=<password>
getHostID http://<server_ip>:<port>/hosts?authentication=<authenticationResult>
getCPUidleTime http://<server_ip>:<port>/cpu?hostid=<host_id>&authentication=<authenticationResult>&metricType=idle
getCPUiowaitTime http://<server_ip>:<port>/cpu?hostid=<host_id>&authentication=<authenticationResult>&metricType=iowait
getCPUniceTime http://<server_ip>:<port>/cpu?hostid=<host_id>&authentication=<authenticationResult>&metricType=nice
getCPUsystemTime http://<server_ip>:<port>/cpu?hostid=<host_id>&authentication=<authenticationResult>&metricType=system
getCPUuserTime http://<server_ip>:<port>/cpu?hostid=<host_id>&authentication=<authenticationResult>&metricType=user
getCachedMemory http://<server_ip>:<port>/memory?hostid=<host_id>&authentication=<authenticationResult>&metricType=cachedMemory
getFreeMemory http://<server_ip>:<port>/memory?hostid=<host_id>&authentication=<authenticationResult>&metricType=freeMemory
getSharedMemory http://<server_ip>:<port>/memory?hostid=<host_id>&authentication=<authenticationResult>&metricType=sharedMemory
getTotalMemory http://<server_ip>:<port>/memory?hostid=<host_id>&authentication=<authenticationResult>&metricType=totalMemory
getBufferMemory http://<server_ip>:<port>/memory?hostid=<host_id>&authentication=<authenticationResult>&metricType=bufferedMemory
getFreeSwapMemory http://<server_ip>:<port>/memory?hostid=<host_id>&authentication=<authenticationResult>&metricType=freeSwap
getIngoingTrafficOnInterface X e.g. interface eth0, http://<server_ip>:<port>/network?hostid=<value>&authentication=<authenticationResult>&metricType=eth0In
getOutgoingTrafficOnInterface X e.g. interface eth0, http://<server_ip>:<port>/network?hostid=<host_id>&authentication=<authenticationResult>&metricType=eth0Out
getNetworkLatency http://<server_ip>:<port>/network?hostid=<host_id>&authentication=<authenticationResult>&metricType=lateny
getPacketLoss http://<server_ip>:<port>/network?hostid=<host_id>&authentication=<authenticationResult>&metricType=packetloss
getServiceAvailability http://<server_ip>:<port>/service?hostid=<host_id>&authentication=<authenticationResult>&metricType=availability
getGraphs http://<server_ip>:<port>/graphs?hostid=<host_id>&authentication=[authenticationResult]