Table of Contents

8 JS

概述

zabbix_js 是一个可用于嵌入式脚本测试的命令行工具。

该工具将使用 string 参数 execute 用户脚本并打印结果。 脚本通过嵌入式 Zabbix 脚本引擎执行。

若出现编译或执行错误,zabbix_js 会将错误信息输出至 stderr 并以代码 1 退出。

使用

zabbix_js -s script-file -p input-param [-l log-level] [-t timeout]
       zabbix_js -s script-file -i input-file [-l log-level] [-t timeout]
       zabbix_js -h
       zabbix_js -V

zabbix_js 接受以下命令行参数:

-s, --script script-file          Specify the file name of the script to execute. If '-' is specified as file name, the script will be read from stdin.
       -i, --input input-file            Specify the file name of the input parameter. If '-' is specified as file name, the input will be read from stdin.
       -p, --param input-param           Specify the input parameter.
       -l, --loglevel log-level          Specify the log level.
       -t, --timeout timeout             Specify the timeout in seconds. Valid range: 1-600 seconds (default: 10 seconds).
       -h, --help                        Display help information.
       -V, --version                     Display the version number.
       -w <webdriver url>                Enables browser monitoring.

示例:

zabbix_js -s script-file.js -p example