Zabbix Documentation 2.0

3.04.04.2 (current)| In development:4.4 (devel)| Unsupported:1.82.02.22.43.23.4Guidelines

User Tools

Site Tools


Sidebar

manual:appendix:api:event:get

This is an old revision of the document!


Table of Contents

get()

Available since version: 1.8
This function allows you to retrieve event details based on filtering options. All parameters are optional. If parameter is set in query, this option is considered as being ON, except if parameter is equal to NULL.

Parameters

ParameterTypeDescriptionDetails
nodeidsarrayNode IDs
groupidsarrayHostGroup IDs
hostidsarrayHost IDs
triggeridsarrayTrigger IDs
eventidsarrayEvent IDs
editableintegeronly with read-write permission. Ignored for SuperAdmins
showUnknownintegerShow unknown events
time_fromintegerEvents since specified date Unix timestamp
time_tillintegerEvents till specified date Unix timestamp
outputstringOutput options Values: shorten, refer, extend
select_hostsstringSelect hosts Values: shorten, refer, extend
select_triggersstringSelect event triggers Values: shorten, refer, extend
countOutputintegerCount hosts, returned number of found hosts
groupOutputintegerGroup result by passed IDs
preservekeysintegerReturn hash instead of array Keys of hash are object IDs
sortfieldstringSort by host field Values: eventid,clock
sortorderstringSort order Values: ASC, DESC
limitintmax number of host objects to return

Returns

ParameterDescription
resultOperation successful. Result will contain array of Event objects.
errorIn case of any errors

Example

Get last 10 events for specified period:

{
"jsonrpc":"2.0",
"method":"event.get",
"params":{
	"time_from":"1284910040",
	"time_till": "1284991200",
	"output": "extend",
	"sortfield": "clock",
	"sortorder": "desc",
	"limit": 5
},
"auth":"6f38cddc44cfbb6c1bd186f9a220b5a0",
"id":2
}

Retrieved events details:

{
"jsonrpc":"2.0",
"result":[{
	"eventid":"100100000884382",
	"source":"0",
	"object":"0",
	"objectid":"100100000064507",
	"clock":"1284910089",
	"value":"1",
	"acknowledged":"0",
	"ns":"0",
	"value_changed":"1"
},{
	"eventid":"100100000884383",
	"source":"0",
	"object":"0",
	"objectid":"100100000064661",
	"clock":"1284910089",
	"value":"1",
	"acknowledged":"0",
	"ns":"0",
	"value_changed":"1"
},{
	"eventid":"100100000884385",
	"source":"0",
	"object":"0",
	"objectid":"100100000064661",
	"clock":"1284910118",
	"value":"0",
	"acknowledged":"0",
	"ns":"0",
	"value_changed":"1"
},{
	"eventid":"100100000884384",
	"source":"0",
	"object":"0",
	"objectid":"100100000064507",
	"clock":"1284910119",
	"value":"0",
	"acknowledged":"0",
	"ns":"0",
	"value_changed":"1"
},{
	"eventid":"100100000884386",
	"source":"0",
	"object":"0",
	"objectid":"100100000064661",
	"clock":"1284910176",
	"value":"1",
	"acknowledged":"0",
	"ns":"0",
	"value_changed":"1"
}],
"id":2
}