This is a translation of the original English documentation page. Help us make it better.

sla.get

説明

integer/array sla.get(object parameters)

このメソッドを使用すると、指定されたパラメーターに従ってSLAオブジェクトを取得できます。

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

パラメータ

(object) 目的の出力を定義するパラメーター

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

パラメータ タイプ 説明
slaids string/array 指定されたIDを持つSLAのみを返します
serviceids string/array 特定のサービスに一致するSLAのみを返します
selectSchedule query SLAスケジュールを含むscheduleプロパティを返します。

countをサポートします。
selectExcludedDowntimes query SLAが除外されたダウンタイムを含むexcluded_downtimesプロパティを返します。

countをサポートします。
selectServiceTags query SLAサービスタグを含むservice_tagsプロパティを返します。

countをサポートします。
sortfield string/array 指定されたプロパティで結果を並べ替えます。

可能な値はslaid,name,periodslo,effective_date,timezone,status,descriptionです
countOutput boolean すべてのgetメソッドに共通するこれらのパラメーターについてはリファレンス解説ページで詳しく説明されています。
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パラメータが使用されている場合、取得されたオブジェクトの数

すべてのSLAを取得する

すべてのSLAとそのプロパティに関するすべてのデータを取得します

Request:

{
           "jsonrpc": "2.0",
           "method": "sla.get",
           "params": {
               "output": "extend",
               "selectSchedule": ["period_from", "period_to"],
               "selectExcludedDowntimes": ["name", "period_from", "period_to"],
               "selectServiceTags": ["tag", "operator", "value"],
               "preservekeys": true
           },
           "auth": "85dd04b94cbfad794616eb923be13c71",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "1": {
                   "slaid": "1",
                   "name": "Database Uptime",
                   "period": "1",
                   "slo": "99.9995",
                   "effective_date": "1672444800",
                   "timezone": "America/Toronto",
                   "status": "1",
                   "description": "Provide excellent uptime for main SQL database engines.",
                   "service_tags": [
                       {
                           "tag": "Database",
                           "operator": "0",
                           "value": "MySQL"
                       },
                       {
                           "tag": "Database",
                           "operator": "0",
                           "value": "PostgreSQL"
                       }
                   ],
                   "schedule": [
                       {
                           "period_from": "0",
                           "period_to": "601200"
                       }
                   ],
                   "excluded_downtimes": [
                       {
                           "name": "Software version upgrade rollout",
                           "period_from": "1648760400",
                           "period_to": "1648764900"
                       }
                   ]
               }
           },
           "id": 1
       }

ソース

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