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

graphprototype.get

説明

integer/array graphprototype.get(object parameters)

このメソッドは、与えられたパラメータに従って、グラフの graph prototypes を取得することができます

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

パラメータ

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

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

パラメータ Type 説明
discoveryids string/array Return only graph prototypes that belong to the given discovery rules.
graphids string/array Return only graph prototypes with the given IDs.
groupids string/array Return only graph prototypes that belong to hosts in the given host groups.
hostids string/array Return only graph prototypes that belong to the given hosts.
inherited boolean If set to true return only graph prototypes inherited from a template.
itemids string/array Return only graph prototypes that contain the given item prototypes.
templated boolean If set to true return only graph prototypes that belong to templates.
templateids string/array Return only graph prototypes that belong to the given templates.
selectDiscoveryRule query Return a discoveryRule property with the LLD rule that the graph prototype belongs to.
selectGraphItems query Return a gitems property with the graph items used in the graph prototype.
selectGroups query Return a groups property with the host groups that the graph prototype belongs to.
selectHosts query Return a hosts property with the hosts that the graph prototype belongs to.
selectItems query Return an items property with the items and item prototypes used in the graph prototype.
selectTemplates query Return a templates property with the templates that the graph prototype belongs to.
filter object Return only those results that exactly match the given filter.

Accepts an array, where the keys are property names, and the values are either a single value or an array of values to match against.

Supports additional filters:
host - technical name of the host that the graph prototype belongs to;
hostid - ID of the host that the graph prototype belongs to.
sortfield string/array Sort the result by the given properties.

Possible values are: graphid, name and graphtype.
countOutput boolean These parameters being common for all get methods are described in detail in the reference commentary.
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 ルールから 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
       }

参照

ソース

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