Sidebar

api:maintenance:get

Table of Contents

get()

Available since version: 1.8
This method allows you to retrieve maintenance 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
groupidsarrayHostGroup IDs
hostidsarrayHost IDs
maintenanceidsarrayMaintenance IDs
editableintegeronly with read-write permission. Ignored for SuperAdmins
filterarrayOptional filter by maintenance fields
searcharrayReturn maintenances by any given maintenance object field pattern
startSearchintegerSearch maintenances field pattern only in start of the field
excludeSearchintegerExclude from result, maintenances by given field pattern
searchWildcardsEnabledintegerSearch pattern in whole field using wildcards 1 - enable, 0 - disable
outputstringOutput options Values: shorten, refer, extend
select_groupsstringSelect host groups Values: shorten, refer, extend
select_hostsstringSelect hosts Values: shorten, refer, extend
countOutputintegerCount maintenances, return the number of maintenances found
groupCountintegerReturn the number of results grouped by given IDs
preservekeysintegerReturn hash instead of array Keys of hash are object IDs
sortfieldstringSort by maintenance field Values: maintenanceid, name
sortorderstringSort order Values: ASC, DESC
limitintmax number of maintenance objects to return

Returns

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

Example

Get maintenances details by maintenance name pattern “server” and limit output to two maintenances:

{
"jsonrpc":"2.0",
"method":"maintenance.get",
"params":{
	"search": {
		"name":"server"
	} 
	"output": "extend",
	"select_hosts": "refer",
	"select_groups": "refer",
	"limit": 2
},
"auth":"6f38cddc44cfbb6c1bd186f9a220b5a0",
"id":2
}

Retrieved maintenance details:

{
"jsonrpc":"2.0",
"result":[{
	"groups":[],
	"hosts":[{
		"hostid":"100100000010229",
		"maintenanceid":"100100000000005"
	}],
	"maintenanceid":"100100000000005",
	"name":"Zabbix server maintenance",
	"maintenance_type":"0",
	"description":"",
	"active_since":"1276163035",
	"active_till":"1307698980"
}],
"id":2
}
,