See www.zabbix.com for the official Zabbix site.

Docs/protocols/global scripts/3.4

From Zabbix.org
Jump to: navigation, search

Zabbix global scripts

Request

Zabbix global scripts are executed by the Zabbix server. When they are invoked from the frontend, frontend sends the following request to the server:

{"request":"command","scriptid":"1","hostid":"10093","sid":"c51ff60a695eff8cb97d3ec068da08b3"}
Note: This approach is used since Zabbix 1.6.8 - older versions sent actual command to be executed. See ZBX-1030 for more detail.
Note: "sid" parameter is ID of session (authentication token in frontend) and it is used to check the user permissions to execute scripts.


Successful response

{
        "response":"success",
        "value":"PING 192.168.13.13 (192.168.13.13) 56(84) bytes of data
64 bytes from 192.168.13.13: icmp_seq=1 ttl=64 time=0.280 ms
64 bytes from 192.168.13.13: icmp_seq=2 ttl=64 time=0.354 ms
64 bytes from 192.168.13.13: icmp_seq=3 ttl=64 time=0.349 ms

--- 192.168.13.13 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min\/avg\/max\/mdev = 0 280\/0.327\/0.354\/0.039 ms
"}

Failures

Note: As of Zabbix 2.0.5, non-numeric symbols in any ID and incorrect values are silently discarded. See ZBX-6227 for more detail.
Note: As of Zabbix 2.0.5, if any of nodeid, scriptid or hostid is missing, connection is immediately closed without any message. See ZBX-6227 for more detail.
Note: As of Zabbix 2.4.0, nodeid is not used anymore.
Note: As of Zabbix 3.4.0, sid is required. See ZBX-9425 for more detail.

If the host with that ID does not exist:

{
        "response":"failed",
        "value":"Unknown Host ID [10094]"}

If the script with that ID does not exist:

{
        "response":"failed",
        "value":"Unknown Script ID [111]"}

If provided sid is not valid:

{
        "response":"failed",
        "value":"Active session identifier is missing."}

If sid is not provided:

{
        "response":"failed",
        "value":"Failed to parse command request tag: sid."}