这些参数及对应仪表板小组件字段objects的可选属性值允许通过dashboard.create
和dashboard.update
方法配置Web monitoring小组件。
小组件fields
的属性在仪表板创建或update过程中不会被验证。 这使得用户可以修改built-in widgets和create开发模块,但也存在错误创建或更新小组件的风险。 为确保成功创建或updateWeb监测小组件,请参考下文表格中列出的参数要求。
Web监控小部件支持以下参数。
参数 | 仪表板小部件字段 | 名称 | 值 | |
---|---|---|---|---|
Refresh interval | 0 | rf_rate | 0 - 不刷新; 10 - 10秒; 30 - 30秒; 60 - (默认) 1分钟; 120 - 2分钟; 600 - 10分钟; 900 - 15分钟. |
|
Host groups | 2 | groupids | Host group ID. 注意:要配置多个主机组,需为每个主机组 create仪表板小部件字段object。 |
|
Exclude host groups | 2 | exclude_groupids | Host group ID. 注意:要排除多个主机组,需为每个主机组在仪表板小部件字段create一个object。 |
|
Hosts | 3 | hostids | Host ID. 注意:要配置多个主机,需为每个主机创建仪表板小部件字段create object。对于多个主机,参数主机 groups必须完全不配置,或至少配置一个包含这些主机的主机组。 |
|
Tags (the number in the property name (e.g. tags.tag.0) references tag order in the tag evaluation list) | ||||
评估类型 | 0 | evaltype | 0 - (默认) 与/或; 2 - 或. |
|
标签名称 | 1 | tags.tag.0 | 任意string值。 配置Tags时需提供参数Tag name。 |
|
运算符 | 0 | tags.operator.0 | 0 - 包含; 1 - 等于; 2 - 不包含; 3 - 不等于; 4 - 存在; 5 - 不存在. 配置Tags时必须提供Operator参数. |
|
标签值 | 1 | tags.value.0 | 任意string值。 若配置Tags则必须填写Tag value参数。 |
|
Show hosts in maintenance | 0 | maintenance | 0 - 禁用; 1 - (默认) 启用. |
以下示例仅针对Web监控小部件的仪表板小部件字段objects的配置进行说明。 有关配置仪表板的更多信息,请参阅dashboard.create
。
配置一个Web监测小部件,用于显示主机组 "4"的活动Web监测场景状态摘要。
请求:
{
"jsonrpc": "2.0",
"method": "dashboard.create",
"params": {
"name": "My dashboard",
"display_period": 30,
"auto_start": 1,
"pages": [
{
"widgets": [
{
"type": "web",
"name": "Web monitoring",
"x": 0,
"y": 0,
"width": 6,
"height": 3,
"view_mode": 0,
"fields": [
{
"type": 2,
"name": "groupids",
"value": 4
}
]
}
]
}
],
"userGroups": [
{
"usrgrpid": 7,
"permission": 2
}
],
"users": [
{
"userid": 1,
"permission": 3
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
响应: