概述

这些脚本取决于设置的用户权限,之后可以通过单击主机上各个前端位置(Dashboard, Problems, Latest data, Status of triggers, Maps)便可执行,同时也可以用作行动操作来运行。脚本在Zabbix sever或agent上执行。 显示现有脚本及其详细信息的列表

显示的数据:

配置新的脚本,请单击顶部右上角的 Create script 按键。

批量编辑选项

列表下面的按键会提供一些批量编辑选项:

要使用这个选项,请在各个脚本之前标记复选框,然后单击 Delete.

过滤器

因为列表中可能包含许多脚本,所以可能需要通过过滤得到您需要的内容。

Filter过滤器 链接位于脚本列表之上。 如果您点击它,则可以使用过滤器,您可以通过名称过滤媒脚本。

7 脚本 - 图1

配置全局脚本

脚本属性:

脚本的执行和结果

由Zabbix sever运行的脚本由命令执行 部分中描述的顺序执行,包括退出代码检查。 脚本结果将显示在运行脚本后显示在弹窗中。

Note:脚本的返回值是标准输出以及标准错误。

7 Scripts

Overview

In the Administration → Scripts section user-defined global scripts can be configured and maintained.

These scripts, depending on the set user permissions, then become available for execution by clicking on the host in various frontend locations (Dashboard, Problems, Latest data, Maps) and can also be run as an action operation. The scripts are executed on the Zabbix server or agent.

A listing of existing scripts with their details is displayed.

Displayed data:

To configure a new script, click on the Create script button in the top right-hand corner.

Mass editing options

A button below the list offers one mass-editing option:

  • Delete - delete the scripts

To use this option, mark the checkboxes before the respective scripts and click on Delete.

Filter

As the list may contain a number of scripts, it may be needed to filter out the ones you really need.

The Filter link is available above the list of scripts. If you click on it, a filter becomes available where you can filter scripts by name.

Configuring a global script

Script execution and result

Scripts run by Zabbix server are executed by the order described in section including exit code checking. The script result will be displayed in a pop-up window that will appear after the script is run.

Note: The return value of the script is standard output together with standard error.

See example of a script and the result window below:

7 脚本 - 图2

Script timeout

Zabbix agent

You may encounter a situation when timeout occurs while executing a script.

See example of a script running on Zabbix agent and the result window below:

Error message in this case is the following:

In order to avoid such a situation, it is advised to optimize the script itself (instead of adjusting Timeout parameter to a corresponding value (in our case, > ‘5’) by modifying the Zabbix agent configuration and ).

In case still the Timeout parameter is changed in Zabbix agent configuration following error message appears:

It means that modification was made in and it is required to modify Timeout setting also in Zabbix server configuration.

Zabbix server/proxy

See example of a script running on Zabbix server and the result window below: