2022 Zabbix中国峰会
2022 Zabbix中国峰会


Description 说明

integer/array maintenance.get(object parameters)

The method allows to retrieve maintenances according to the given parameters.该方法允许根据给定的参数检索维护。

Parameters 参数

(object) Parameters defining the desired output.定义所需输出的参数。

The method supports the following parameters.该方法支持以下参数。

属性 类 说明
groupids string/array Return only maintenances that are assigned to the given host groups.
hostids string/array Return only maintenances that are assigned to the given hosts.
maintenanceids string/array Return only maintenances with the given IDs.
selectGroups query Return host groups assigned to the maintenance in the groups property.
selectHosts query Return hosts assigned to the maintenance in the hosts property.
selectTimeperiods query Return the maintenance's time periods in the timeperiods property.
sortfield string/array Sort the result by the given properties.

Possible values are: maintenanceid, name and maintenance_type.
countOutput flag These parameters being common for all get methods are described in detail in the reference commentary.
editable boolean
excludeSearch flag
filter object
limit integer
output query
preservekeys flag
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch flag

Return values返回值

(integer/array) Returns either:

  • an array of objects;
  • the count of retrieved objects, if the countOutput parameter has been used.

Examples 示例

Retrieving maintenances

Retrieve all configured maintenances, and the data about the assigned host groups, hosts and defined time periods.


           "jsonrpc": "2.0",
           "method": "maintenance.get",
           "params": {
               "output": "extend",
               "selectGroups": "extend",
               "selectTimeperiods": "extend"
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1


           "jsonrpc": "2.0",
           "result": [
                   "maintenanceid": "3",
                   "name": "Sunday maintenance",
                   "maintenance_type": "0",
                   "description": "",
                   "active_since": "1358844540",
                   "active_till": "1390466940",
                   "groups": [
                           "groupid": "4",
                           "name": "Zabbix servers",
                           "internal": "0"
                   "timeperiods": [
                           "timeperiodid": "4",
                           "timeperiod_type": "3",
                           "every": "1",
                           "month": "0",
                           "dayofweek": "1",
                           "day": "0",
                           "start_time": "64800",
                           "period": "3600",
                           "start_date": "2147483647"
           "id": 1

See also 参见

Source 来源

CMaintenance::get() in frontends/php/include/classes/api/services/CMaintenance.php.