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

Docs/protocols/global scripts/2.0

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","nodeid":0,"scriptid":"1","hostid":"10093"}
Note: This approach is used since Zabbix 1.6.8 - older versions sent actual command to be executed. See ZBX-1030 for more detail.

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.

If the host with that ID does not exist:

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

If the node with that ID does not exist:

{
        "response":"failed",
        "value":"NODE 0: Unknown Node ID [1]"}

If the script with that ID does not exist:

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