这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.
2022 Zabbix中国峰会
2022 Zabbix中国峰会

报告.获取

说明

integer/array report.get(object parameters)

该方法帮助用户根据所提供的参数来检索定时报表。

该方法可供所有类型的用户使用。 用户可以在用户职责设置中对该方式的使用权限进行设定修改。请参考 用户角色以获取更多信息。

参数

(object) 定义了需求输出的参数。

该方法支持如下参数。

参数 类型 说明
reportids 字符串/数组 根据设定的ID号返回对应定时报表。
expired 布尔值 若设定为true则只返回失效的定时报表,若设定为false,则只返回有效的定时报表。
selectUsers 搜索请求 返回报告所设定的发送目标的用户属性。
selectUserGroups 搜索请求 返回报告所定的发送目标的用户组 属性。
sortfield 字符串/数组 设定属性参数用来分类返回数据。

可设定的参数包括:reportid, name, status.
countOutput 布尔值 该类参数在所有的get方法中应用广泛,用户可以参考引用评论 页面来获取更多详细信息。
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

返回值

(integer/array) 返回下列两种数值之一:

  • 一组对象;
  • countOutput参数应用的情况下,返回检索对象的数量。

参考示例

检索报告数据

请求:

{
           "jsonrpc": "2.0",
           "method": "report.get",
           "params": [
               "output": "extend",
               "selectUsers": "extend",
               "selectUserGroups": "extend",
               "reportids": ["1", "2"]
           ],
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

响应:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "reportid": "1",
                   "userid": "1",
                   "name": "Weekly report",
                   "dashboardid": "1",
                   "period": "1",
                   "cycle": "1",
                   "start_time": "43200",
                   "weekdays": "31",
                   "active_since": "2021-04-01",
                   "active_till": "2021-08-31",
                   "subject": "Weekly report",
                   "message": "Report accompanying text",
                   "status": "1",
                   "description": "Report description",
                   "state": "1",
                   "lastsent": "1613563219",
                   "info": "",
                   "users": [
                       {
                           "userid": "1",
                           "access_userid": "1",
                           "exclude": "0"
                       },
                       {
                           "userid": "2",
                           "access_userid": "0",
                           "exclude": "1"
                       }
                   ],
                   "user_groups": [
                       {
                           "usrgrpid": "7",
                           "access_userid": "0"
                       }
                   ]
               },
               {
                   "reportid": "2",
                   "userid": "1",
                   "name": "Monthly report",
                   "dashboardid": "2",
                   "period": "2",
                   "cycle": "2",
                   "start_time": "0",
                   "weekdays": "0",
                   "active_since": "2021-05-01",
                   "active_till": "",
                   "subject": "Monthly report",
                   "message": "Report accompanying text",
                   "status": "1",
                   "description": "",
                   "state": "0",
                   "lastsent": "0",
                   "info": "",
                   "users": [
                       {
                           "userid": "1",
                           "access_userid": "1",
                           "exclude": "0"
                       }
                   ],
                   "user_groups": []
               }
           ],
           "id": 1
       }

另请参考

参考来源

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