Zabbix Documentation 3.2

2.23.04.0 (current)In development:4.2 (devel)Unsupported:1.82.02.43.23.4

User Tools

Site Tools


manual:config:items:userparameters

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:config:items:userparameters [2015/11/19 12:29]
martins-v moving similar content together
manual:config:items:userparameters [2018/01/25 13:02] (current)
martins-v removing reference to a table that is absent in 3.2
Line 1: Line 1:
-==== - #4 User parameters ====+==== 4 User parameters ====
  
 === Overview === === Overview ===
Line 15: Line 15:
 Then, when [[item|configuring an item]], enter the key to reference the command from the user parameter you want executed. Then, when [[item|configuring an item]], enter the key to reference the command from the user parameter you want executed.
  
-User parameters are commands executed by Zabbix agent. Up to 512KB of data can be returned. ​**/bin/sh** is used as a command line interpreter under UNIX operating systems. User parameters obey the agent check timeout; if timeout is reached ​the forked user parameter process ​is terminated.+User parameters are commands executed by Zabbix agent. Up to 512KB of data can be returned. ​Note, however, that the text value that can be eventually stored in database ​is limited to 64KB on MySQL.
  
-See also [[manual:​config:​items:​userparameters:​extending_agent|step-by-step tutorial]] on making use of user parameters.+**/bin/sh** is used as a command line interpreter under UNIX operating systems. User parameters obey the agent check timeout; if timeout is reached the forked user parameter process is terminated. 
 + 
 +See also
 + 
 +  * [[manual:​config:​items:​userparameters:​extending_agent|Step-by-step tutorial]] on making use of user parameters 
 +  * [[manual/​appendix/​command_execution|Command execution]]
  
 == Examples of simple user parameters == == Examples of simple user parameters ==
Line 29: Line 34:
 A more complex example: A more complex example:
  
-  UserParameter=mysql.ping,​mysqladmin -uroot ping|grep -c alive+  UserParameter=mysql.ping,​mysqladmin -uroot ping | grep -c alive
  
 The agent will return '​1',​ if MySQL server is alive, '​0'​ - otherwise. The agent will return '​1',​ if MySQL server is alive, '​0'​ - otherwise.
Line 45: Line 50:
 |**Command**|Command to be executed to evaluate value of the key.\\ //For flexible user parameters only//:\\ You may use positional references $1…$9 in the command to refer to the respective parameter in the item key.\\ Zabbix parses the parameters enclosed in [ ] of the item key and substitutes $1,...,$9 in the command accordingly.\\ $0 will be substituted by the original command (prior to expansion of $0,...,$9) to be run.\\ Positional references are interpreted regardless of whether they are enclosed between double (") or single (') quotes.\\ To use positional references unaltered, specify a double dollar sign - for example, awk '​{print $$2}'. In this case ''​$$2''​ will actually turn into ''​$2''​ when executing the command. ​ | |**Command**|Command to be executed to evaluate value of the key.\\ //For flexible user parameters only//:\\ You may use positional references $1…$9 in the command to refer to the respective parameter in the item key.\\ Zabbix parses the parameters enclosed in [ ] of the item key and substitutes $1,...,$9 in the command accordingly.\\ $0 will be substituted by the original command (prior to expansion of $0,...,$9) to be run.\\ Positional references are interpreted regardless of whether they are enclosed between double (") or single (') quotes.\\ To use positional references unaltered, specify a double dollar sign - for example, awk '​{print $$2}'. In this case ''​$$2''​ will actually turn into ''​$2''​ when executing the command. ​ |
  
-<note important>​Positional references with the $ sign are interpreted ​by Zabbix agent only for user parameters ​that accept arguments.</​note>​+<note important>​Positional references with the $ sign are searched for and replaced ​by Zabbix agent only for flexible user parameters. For simple ​user parameters, such reference processing is skipped and, therefore, any $ sign quoting is not necessary.</​note>​
  
 <note important>​Certain symbols are not allowed in user parameters by default. See [[manual:​appendix:​config:​zabbix_agentd|UnsafeUserParameters]] documentation for a full list.</​note>​ <note important>​Certain symbols are not allowed in user parameters by default. See [[manual:​appendix:​config:​zabbix_agentd|UnsafeUserParameters]] documentation for a full list.</​note>​