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

graphitem.get

説明

integer/array graphitem.get(object parameters)

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

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

パラメータ

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

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

パラメータ Type 説明
graphids string/array Return only graph items that belong to the given graphs.
itemids string/array Return only graph items with the given item IDs.
type integer Return only graph items with the given type.

Refer to the graph item object page for a list of supported graph item types.
selectGraphs query Return a graphs property with an array of graphs that the item belongs to.
sortfield string/array Sort the result by the given properties.

Possible values are: gitemid.
countOutput boolean These parameters being common for all get methods are described in detail in the reference commentary page.
editable boolean
limit integer
output query
preservekeys boolean
sortorder string/array

戻り値

(integer/array) のどちらかを返します:

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

グラフからグラフアイテムを取得する

グラフで使用されているすべてのグラフアイテムを、item やホストに関する追加情報とともに取得します。

Request:

{
           "jsonrpc": "2.0",
           "method": "graphitem.get",
           "params": {
               "output": "extend",
               "graphids": "387"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "gitemid": "1242",
                   "graphid": "387",
                   "itemid": "22665",
                   "drawtype": "1",
                   "sortorder": "1",
                   "color": "FF5555",
                   "yaxisside": "0",
                   "calc_fnc": "2",
                   "type": "0",
                   "key_": "system.cpu.util[,steal]",
                   "hostid": "10001",
                   "flags": "0",
                   "host": "Linux"
               },
               {
                   "gitemid": "1243",
                   "graphid": "387",
                   "itemid": "22668",
                   "drawtype": "1",
                   "sortorder": "2",
                   "color": "55FF55",
                   "yaxisside": "0",
                   "calc_fnc": "2",
                   "type": "0",
                   "key_": "system.cpu.util[,softirq]",
                   "hostid": "10001",
                   "flags": "0",
                   "host": "Linux"
               },
               {
                   "gitemid": "1244",
                   "graphid": "387",
                   "itemid": "22671",
                   "drawtype": "1",
                   "sortorder": "3",
                   "color": "009999",
                   "yaxisside": "0",
                   "calc_fnc": "2",
                   "type": "0",
                   "key_": "system.cpu.util[,interrupt]",
                   "hostid": "10001",
                   "flags": "0",
                   "host": "Linux"
               }
           ],
           "id": 1
       }

参照

ソース

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