Sometimes we want to let the monitored side perform a zabbix without a pre-top detection, Zabbix's user-defined parameters feature provides this method, which we can configure in the client Profile zabbix_agentd.conf Userparameter
Userparameter=key,command
User-defined parameters include a key and a command, the key must be the entire system unique, configured well, restart the client.
Then configure the item and fill in the key's location with our custom key. The script specified by the user's custom parameter is executed by the Zabbix agent, which can return up to 512kb of data
User-defined Key
Userparameter=ping,echo 1
If you call ping this key, you will receive a return value of 1
More complex commands
Userparameter=mysql.ping,mysqladmin-uroot Ping|grep-c Alive
Returning 1 means that MySQL is alive, and returning 0 means MySQL is dead.
Flexible key definition
Userparameter=key[*],command
* Indicates that multiple parameters can be passed
Command needs to execute the script, key [] inside the parameter one by one corresponds to the $1-$9,$0 represents the script command
Userparameter=ping[*],echo $
Ping[0]-will always return 0
PING[AAA]-will always return ' AAA '
If you have special characters, you need to turn on unsafe parameters
Execution requires permission to execute a command
Add Item
Type: Zabbix client-side Active
Key-Value: Key
This article from "Eight Miles" blog, declined reprint!
Zabbix Learning Note 5-custom user key and parameter userparameters