Zabbix Documentation 1.8

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


Sidebar

api:event:get

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 counted as ON, except if parameter is equal to NULL.

Parameters

ParameterTypeDescriptionDetails
nodeidsarrayNode IDs
groupidsarrayHost group IDs
hostidsarrayHost IDs
triggeridsarrayTrigger IDs
eventidsarrayEvent IDs
editableintegeronly with read-write permission. Ignored for SuperAdmins
objectintegerEvent object
valueintegerEvent status
sourceintegerEvent source
acknowledgedintegerAcknowledged events
hide_unknownintegerHide unknown events
time_fromintegerEvents since specified date Unix timestamp
time_tillintegerEvents till specified date Unix timestamp
eventid_fromintegerEvents with IDs greater or equal than specified
eventid_tillintegerEvents with IDs less or equal than specified
outputstringOutput options Values: shorten, refer, extend
select_hostsstringSelect hosts Values: shorten, refer, extend
select_itemsstringSelect items Values: shorten, refer, extend
select_triggersstringSelect event triggers Values: shorten, refer, extend
countOutputintegerCount events, return the number of events found
preservekeysintegerReturn hash instead of array Keys of hash are object IDs
sortfieldstringSort by event field Values: eventid,clock
sortorderstringSort order Values: ASC, DESC
limitintmax number of event 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": 10
},
"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"
},{
	"eventid": "100100000884383",
	"source": "0",
	"object": "0",
	"objectid": "100100000064661",
	"clock": "1284910089",
	"value": "1",
	"acknowledged": "0"
},{
	"eventid": "100100000884385",
	"source": "0",
	"object": "0",
	"objectid": "100100000064661",
	"clock": "1284910118",
	"value": "0",
	"acknowledged": "0"
},{
	"eventid": "100100000884384",
	"source": "0",
	"object": "0",
	"objectid": "100100000064507",
	"clock": "1284910119",
	"value": "0",
	"acknowledged": "0"
},{
	"eventid": "100100000884386",
	"source": "0",
	"object": "0",
	"objectid": "100100000064661",
	"clock": "1284910176",
	"value": "1",
	"acknowledged": "0"
},{
	"eventid": "100100000884387",
	"source": "0",
	"object": "0",
	"objectid": "100100000064661",
	"clock": "1284910206",
	"value": "0",
	"acknowledged": "0"
},{
	"eventid": "100100000884388",
	"source": "0",
	"object": "0",
	"objectid": "100100000064661",
	"clock": "1284910326",
	"value": "1",
	"acknowledged": "0"
},{
	"eventid": "100100000884389",
	"source": "0",
	"object": "0",
	"objectid": "100100000064509",
	"clock": "1284910351",
	"value": "1",
	"acknowledged": "0"
},{
	"eventid": "100100000884390",
	"source": "0",
	"object": "0",
	"objectid": "100100000064546",
	"clock": "1284910351",
	"value": "1",
	"acknowledged": "0"
},{
	"eventid": "100100000884391",
	"source": "0",
	"object": "0",
	"objectid": "100100000012788",
	"clock": "1284910353",
	"value": "1",
	"acknowledged": "0"
}],
"id": 2
}