You are viewing documentation for the development version, it may be incomplete.
Join our translation project and help translate Zabbix documentation into your native language.

maintenance.get

説明

integer/array maintenance.get(object parameters)

このメソッドは、指定されたパラメータに従ってメンテナンスを取得することができます。

このメソッドは、すべてのタイプのユーザーが利用できます。 このメソッドを呼び出す権限は、ユーザーロールの設定で取り消すことができます。 詳細はユーザーロールを参照してください。

パラメータ

(object) 望ましい出力を定義するパラメータ。

このメソッドは以下のパラメータをサポートします。

パラメータ タイプ 説明
groupids ID/array 指定したホストグループに割り当てられているメンテナンスのみを返します。
hostids ID/array 指定したホストに割り当てられているメンテナンスのみを返します。
maintenanceids ID/array 指定したIDのメンテナンスのみを返します。
selectHostGroups query メンテナンスに割り当てられているホストグループを持つhostgroupsプロパティを返します。
selectHosts query メンテナンスに割り当てられているホストを持つhostsプロパティを返します。
selectTags query メンテナンスの問題タグを持つtagsプロパティを返します。
selectTimeperiods query メンテナンスの時間帯を持つtimeperiodsプロパティを返します。
sortfield string/array 指定したプロパティで結果をソートします。

可能な値: maintenanceid, name, maintenance_type, active_since, active_till
countOutput boolean これらのパラメータはリファレンス解説で説明されています。
editable boolean
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

戻り値

(integer/array) 以下のいずれかを返します。

  • オブジェクトの配列
  • countOutputパラメータが使用されている場合は、取得したオブジェクトの数

メンテナンスの取得

すべての設定済みメンテナンス、および割り当てられたホストグループ、定義された時間帯、問題タグに関するデータを取得します。

リクエスト:

{
           "jsonrpc": "2.0",
           "method": "maintenance.get",
           "params": {
               "output": "extend",
               "selectHostGroups": "extend",
               "selectTimeperiods": "extend",
               "selectTags": "extend"
           },
           "id": 1
       }

レスポンス:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "maintenanceid": "3",
                   "name": "Sunday maintenance",
                   "maintenance_type": "0",
                   "description": "",
                   "active_since": "1358844540",
                   "active_till": "1390466940",
                   "tags_evaltype": "0",
                   "hostgroups": [
                       {
                           "groupid": "4",
                           "name": "Zabbix servers",
                           "flags": "0",
                           "uuid": "6f6799aa69e844b4b3918f779f2abf08"
                       }
                   ],
                   "timeperiods": [
                       {
                           "timeperiod_type": "3",
                           "every": "1",
                           "month": "0",
                           "dayofweek": "1",
                           "day": "0",
                           "start_time": "64800",
                           "period": "3600",
                           "start_date": "2147483647"
                       }
                   ],
                   "tags": [
                       {
                           "tag": "service",
                           "operator": "0",
                           "value": "mysqld",
                       },
                       {
                           "tag": "error",
                           "operator": "2",
                           "value": ""
                       }
                   ]
               }
           ],
           "id": 1
       }

参照

ソース

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