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.

graphprototype.get

説明

integer/array graphprototype.get(object parameters)

このメソッドは、指定されたパラメータに従ってグラフプロトタイプを取得することができます。

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

パラメーター

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

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

パラメーター タイプ 説明
discoveryids ID/array 指定したディスカバリールールに属するグラフのプロトタイプのみを返します。
graphids ID/array 指定したIDのグラフのプロトタイプのみを返します。
groupids ID/array 指定したホストグループまたはテンプレートグループに属するホストまたはテンプレートのグラフのプロトタイプのみを返します。
hostids ID/array 指定したホストに属するグラフのプロトタイプのみを返します。
inherited boolean trueに設定すると、テンプレートから継承されたグラフのプロトタイプのみを返します。
itemids ID/array 指定したアイテムのプロトタイプを含むグラフのプロトタイプのみを返します。
templated boolean trueに設定すると、テンプレートに属するグラフのプロトタイプのみを返します。
templateids ID/array 指定したテンプレートに属するグラフのプロトタイプのみを返します。
selectDiscoveryData query グラフのプロトタイプディスカバリーオブジェクトデータを持つdiscoveryDataプロパティを返します。グラフのプロトタイプディスカバリーオブジェクトは、検出されたグラフのプロトタイプを、検出元のグラフのプロトタイプにリンクします。

以下のプロパティを持ちます:
parent_graphid - (ID) グラフが作成されたグラフのプロトタイプのID;
status - (int) グラフディスカバリーステータス:
0 - (デフォルト) グラフのプロトタイプが検出されている,
1 - グラフのプロトタイプがこれ以上検出されていない;
ts_delete - (timestamp) もはや検出されていないグラフのプロトタイプが削除される時刻。
selectDiscoveryRule query グラフのプロトタイプが属するLLDルールを持つdiscoveryRuleプロパティを返します。
selectDiscoveryRulePrototype query グラフのプロトタイプが属する親LLDルールプロトタイプを持つdiscoveryRulePrototypeプロパティを返します。
selectGraphItems query グラフのプロトタイプで使用されているグラフアイテムを持つgitemsプロパティを返します。
selectHostGroups query グラフのプロトタイプが属するホストグループを持つhostgroupsプロパティを返します。
selectHosts query グラフのプロトタイプが属するホストを持つhostsプロパティを返します。
selectItems query グラフのプロトタイプで使用されているアイテムおよびアイテムのプロトタイプを持つitemsプロパティを返します。
selectTemplateGroups query グラフのプロトタイプが属するテンプレートグループを持つtemplategroupsプロパティを返します。
selectTemplates query グラフのプロトタイプが属するテンプレートを持つtemplatesプロパティを返します。
filter object 指定したフィルターに完全一致する結果のみを返します。

オブジェクトを受け入れ、キーはプロパティ名、値は一致させる単一の値または値の配列です。

textデータ型のプロパティはサポートされません。

追加プロパティをサポートします:
host - グラフのプロトタイプが属するホストの技術名;
hostid - グラフのプロトタイプが属するホストのID。
sortfield string/array 指定したプロパティで結果をソートします。

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

戻り値

(integer/array) 次のいずれかを返します:

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

LLD ルールから graph prototypes を取得する

LLD ルールからすべての graph prototypes を取得します。

Request:

{
           "jsonrpc": "2.0",
           "method": "graphprototype.get",
           "params": {
               "output": "extend",
               "discoveryids": "27426"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "graphid": "1017",
                   "parent_itemid": "27426",
                   "name": "Disk space usage {#FSNAME}",
                   "width": "600",
                   "height": "340",
                   "yaxismin": "0.0000",
                   "yaxismax": "0.0000",
                   "templateid": "442",
                   "show_work_period": "0",
                   "show_triggers": "0",
                   "graphtype": "2",
                   "show_legend": "1",
                   "show_3d": "1",
                   "percent_left": "0.0000",
                   "percent_right": "0.0000",
                   "ymin_type": "0",
                   "ymax_type": "0",
                   "ymin_itemid": "0",
                   "ymax_itemid": "0",
                   "discover": "0"
               }
           ],
           "id": 1
       }

LLDルールからグラフプロトタイプを取得する

LLDルールからすべてのグラフプロトタイプを取得します。

リクエスト:

{
           "jsonrpc": "2.0",
           "method": "graphprototype.get",
           "params": {
               "output": "extend",
               "discoveryids": "27426"
           },
           "id": 1
       }

レスポンス:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "graphid": "1017",
                   "name": "Disk space usage {#FSNAME}",
                   "width": "600",
                   "height": "340",
                   "yaxismin": "0.0000",
                   "yaxismax": "0.0000",
                   "templateid": "442",
                   "show_work_period": "0",
                   "show_triggers": "0",
                   "graphtype": "2",
                   "show_legend": "1",
                   "show_3d": "1",
                   "percent_left": "0.0000",
                   "percent_right": "0.0000",
                   "ymin_type": "0",
                   "ymax_type": "0",
                   "ymin_itemid": "0",
                   "ymax_itemid": "0",
                   "flags": "2"
                   "discover": "0"
               }
           ],
           "id": 1
       }

参考

ソース

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