Zabbix Documentation 3.4

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


Sidebar

zh:manual:api:reference:graphitem:get

graphitem.get

Description 描述

integer/array graphitem.get(object parameters)

The method allows to retrieve graph items according to the given parameters. 此方法接受以下参数

Parameters 参数

(object) Parameters defining the desired output. (关联数组) 定义所需输出的参数

The method supports the following parameters. 此方法支持以下参数:

Parameter参数 Type类型 Description描述
图形项目ID gitemids string/array 字符串型/数组 Return only graph items with the given IDs. 只返回指定ID的图形项目。
图形ID graphids string/array 字符串型/数组 Return only graph items that belong to the given graphs.只返回属于指定图形的图形项目。
监控项ID itemids string/array 字符串型/数组 Return only graph items with the given item IDs.只返回指定监控项ID的图形项目
类型 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 the graph that the item belongs to as an array in the graphs property.返回graphs参数正确的图像
排序条件 sortfield string/array 字符串型/数组 Sort the result by the given properties. 按指定的参数排序

Possible values are: gitemid.可用值为: gitemid
countOutput flagThese parameters being common for all get methods are described in detail in the reference commentary page.这些参数对于所有get方法都是通用的,在附录1:参考中,查看详细描述。
editable boolean
limit integer
output query
preservekeys flag
sortorder string/array

Return values 返回值

(integer/array) Returns either: 返回整数或数组:

  • an array of objects返回一个对象数组;
  • the count of retrieved objects, if the countOutput parameter has been used.如果countOutput被使用,返回检索对象的计数。

Examples示例

Retrieving graph items from a graph 从图形中检索图形项目

Retrieve all graph items used in a graph with additional information about the item and the host.检索被图形使用的所有图形项目包含监控项和主机的额外信息

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": "Template OS 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": "Template OS 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": "Template OS Linux"
        }
    ],
    "id": 1
}

See also 参见

Source来源

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