graphprototype.get

説明

integer/array graphprototype.get(object parameters)

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

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

パラメータ

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

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

Parameter Type Description
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 指定したテンプレートに属するグラフプロトタイプのみを返します。
selectDiscoveryRule query グラフプロトタイプが属するLLDルールを含む discoveryRule プロパティを返します。
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
selectGroups
(deprecated)
query このパラメータは非推奨です。代わりに selectHostGroups または selectTemplateGroups を使用してください。
グラフプロトタイプが属するホストグループおよびテンプレートグループを含む groups プロパティを返します。

戻り値

(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",
            "discover": "0"
        }
    ],
    "id": 1
}

関連項目

ソース

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