以下objects与script
API直接相关。
脚本 object 具有以下属性.
属性 | 数据类型 | 描述 |
---|---|---|
scriptid | ID | 脚本的ID. 属性行为: - 只读 - 进行 update 操作时必填 |
name | string | 脚本名称. 属性行为: - 进行 create 操作时必填 |
type | integer | 脚本类型. 当 scope 设置为"action operation"时的可能值:0 - 脚本; 1 - IPMI; 2 - SSH; 3 - TELNET; 5 - Webhook. 当 scope 设置为"manual 主机 action"或"manual event action"时的可能值:6 - URL. 属性行为: - 进行 create 操作时必填 |
command | string | 要run的命令. 属性行为: - 当 type 设置为"Script"、"IPMI"、"SSH"、"TELNET"或"Webhook"时必填 |
scope | integer | 脚本作用域. 可能值: 1 - 动作操作; 2 - 手动主机操作; 4 - 手动事件操作. 属性行为: - 进行 create 操作时必填 |
execute_on | integer | 脚本run的位置. 可能值: 0 - 在Zabbix agent上run; 1 - 在Zabbix server上run. 仅在Zabbix server上启用全局脚本执行时支持; 2 - (默认) 在Zabbix server或proxy上run. 属性行为: - 当 type 设置为"Script"时支持 |
menu_path | string | 用斜杠分隔的文件夹,在前端点击主机或事件时形成类似菜单的导航. 属性行为: - 当 scope 设置为"manual 主机 action"或"manual event action"时支持 |
authtype | integer | SSH脚本类型使用的认证方法. 可能值: 0 - 密码; 1 - 公钥. 属性行为: - 当 type 设置为"SSH"时支持 |
username | string | 用于认证的用户名. 属性行为: - 当 type 设置为"SSH"或"TELNET"时必填 |
password | string | 用于密码认证的SSH脚本和TELNET脚本的密码. 属性行为: - 当 type 设置为"SSH"且 authtype 设置为"password",或 type 设置为"TELNET"时支持 |
publickey | string | 用于公钥认证的SSH脚本的公钥file名称. 属性行为: - 当 type 设置为"SSH"且 authtype 设置为"public key"时必填 |
privatekey | string | 用于公钥认证的SSH脚本的私钥file名称. 属性行为: - 当 type 设置为"SSH"且 authtype 设置为"public key"时必填 |
port | string | 用于SSH和TELNET脚本的端口号. 属性行为: - 当 type 设置为"SSH"或"TELNET"时支持 |
groupid | ID | 可以run脚本的主机组ID. 如果设置为"0",脚本将在所有主机组中可用. 默认: 0. |
usrgrpid | ID | 允许run脚本的用户组ID. 如果设置为"0",脚本将对所有用户组可用. 默认: 0. 属性行为: - 当 scope 设置为"manual 主机 action"或"manual event action"时支持 |
host_access | integer | run脚本所需的主机权限. 可能值: 2 - (默认) 读; 3 - 写. 属性行为: - 当 scope 设置为"manual 主机 action"或"manual event action"时支持 |
confirmation | string | 确认弹窗文本. 当从Zabbix前端尝试run脚本时会出现弹窗. 属性行为: - 当 scope 设置为"manual 主机 action"或"manual event action"时支持 |
timeout | string | Webhook脚本执行超时时间(秒). 支持时间后缀(例如30s, 1m). 可能值: 1-60s. 默认: 30s. 属性行为: - 当 type 设置为"Webhook"时必填 |
parameters | array | webhook参数的array. 属性行为: - 当 type 设置为"Webhook"时支持 |
description | string | 脚本描述. |
url | string | 用户定义的URL. 属性行为: - 当 type 设置为"URL"时必填 |
new_window | integer | 在新窗口打开URL. 可能值: 0 - 否; 1 - (默认) 是. 属性行为: - 当 type 设置为"URL"时支持 |
manualinput | integer | 指示脚本是否接受用户提供的输入. 可能值: 0 - (默认) 禁用; 1 - 启用; 属性行为: - 当 scope 设置为"manual 主机 action"或"manual event action"时支持 |
manualinput_prompt | string | 手动输入提示文本. 属性行为: - 当 manualinput 设置为"Enabled"时必填 |
manualinput_validator | string | 用于验证用户提供输入的字符string字段. string由正则表达式或逗号分隔的值集合组成. 属性行为: - 当 manualinput 设置为"Enabled"时必填 |
manualinput_validator_type | integer | 确定预期的用户输入类型. 可能值: 0 - (默认) string. 表示manualinput_validator将被视为正则表达式; 1 - 列表. 表示manualinput_validator将被视为逗号分隔的可能输入值列表. 属性行为: - 当 manualinput 设置为"Enabled"时支持 |
manualinput_default_value | string | 自动填充用户输入的默认值. 属性行为: - 当 manualinput_validator_type 设置为"string"时支持 |
当调用webhook脚本时传递的参数具有以下属性。
已执行的webhook脚本调试信息。该调试object具有以下属性。
日志条目 object 具有以下属性。
属性 | 数据类型 | 描述 |
---|---|---|
level | integer | 日志级别。 |
ms | string | 自脚本run到添加日志条目之间经过的时间(毫秒)。 |
message | string | 日志消息。 |