Zabbix Documentation 2.4

2.23.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.43.23.4

User Tools

Site Tools


manual:appendix:command_execution

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:appendix:command_execution [2014/09/26 11:26]
sasha Links adapted because of a move operation
manual:appendix:command_execution [2015/11/17 06:16] (current)
martins-v UNIX -> Unix
Line 1: Line 1:
-===== 8 Command execution ​=====+==== 8 Command execution ====
  
-Zabbix uses common functionality to execute user parameters, remote commands, system.run[] items without "​nowait"​ flag, scripts (alert, external and global) and some internal commands. The command/​script is executed similarly on both UNIX and Windows platforms:+Zabbix uses common functionality to execute user parameters, remote commands, system.run[] items without ​the "​nowait"​ flag, scripts (alert, external and global) and some internal commands. ​ 
 + 
 +The command/​script is executed similarly on both Unix and Windows platforms:
   - Zabbix (the parent process) creates a pipe for communication   - Zabbix (the parent process) creates a pipe for communication
   - Zabbix sets the pipe as the output for the to-be-created child process   - Zabbix sets the pipe as the output for the to-be-created child process
   - Zabbix creates the child process (runs the command/​script)   - Zabbix creates the child process (runs the command/​script)
-  - A new process group (in UNIX) or a job (in Windows) is created for the child process +  - A new process group (in Unix) or a job (in Windows) is created for the child process 
-  - Zabbix reads from the pipe till timeout occurs or no one is writing to the other end (ALL handles/​file descriptors have been closed). Note that the child process can create more processes and exit before they exit or close the handle/file descriptor. +  - Zabbix reads from the pipe until timeout occurs or no one is writing to the other end (ALL handles/​file descriptors have been closed). Note that the child process can create more processes and exit before they exit or close the handle/file descriptor. 
-  - If the timeout has not been reached, Zabbix waits till the initial child process exits or timeout occurs+  - If the timeout has not been reached, Zabbix waits until the initial child process exits or timeout occurs
   - At this point it is assumed that everything is done and the whole process tree (i.e. the process group or the job) is terminated   - At this point it is assumed that everything is done and the whole process tree (i.e. the process group or the job) is terminated
-<note important>​Please note that Zabbix assumes that a command/​script has done processing when the initial child process has exited AND no other process is still keeping the output handle/file descriptor open. When processing is done, ALL created processes are terminated.</​note>​ 
-<note tip>Read more about [[manual:​config:​items:​userparameters|user parameters]],​ [[manual:​config:​notifications:​action:​operation:​remote_command|remote commands]], [[manual:​config:​notifications:​media:​script|alert scripts]].</​note>​ 
-<note tip>All double quotes and backslashes in the command are escaped with backslashes and the command is enclosed in double quotes.</​note>​ 
  
 +<note important>​Steps 5-7 do not refer to remote commands as they are executed with a "​nowait"​ flag.</​note>​
 +
 +<note important>​Zabbix assumes that a command/​script has done processing when the initial child process has exited AND no other process is still keeping the output handle/file descriptor open. When processing is done, ALL created processes are terminated.</​note>​
 +
 +All double quotes and backslashes in the command are escaped with backslashes and the command is enclosed in double quotes.
 +
 +Read more about [[manual:​config:​items:​userparameters|user parameters]],​ [[manual:​config:​notifications:​action:​operation:​remote_command|remote commands]], [[manual:​config:​notifications:​media:​script|alert scripts]].