manual:config:items:userparameters:extending_agent

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
manual:config:items:userparameters:extending_agent [2014/09/25 14:42]
manual:config:items:userparameters:extending_agent [2014/09/26 11:31] (current)
sasha Links adapted because of a move operation
Line 1: Line 1:
 +==== 1 Extending Zabbix agents ====
 +
 +This tutorial provides step-by-step instructions on how to extend the functionality of Zabbix agent with the use of a [[manual:​config:​items:​userparameters|user parameter]].
 +
 +== Step 1 ==
 +
 +Write a script or command line to retrieve required parameter.
 +
 +For example, we may write the following command in order to get total number of queries executed by a MySQL server:
 +
 +  mysqladmin -uroot status|cut -f4 -d":"​|cut -f1 -d"​S"​
 +
 +When executed, the command returns total number of SQL queries.
 +
 +== Step 2 ==
 +
 +Add this command to agent'​s configuration file.
 +
 +Add the command to zabbix_agentd.conf:​
 +
 +  UserParameter=mysql.questions,​mysqladmin -uroot status|cut -f4 -d":"​|cut -f1 -d"​S"​
 +
 +**mysql.questions** is an unique identifier. It can be any string, for example, queries.
 +
 +Test this parameter by using [[manual:​concepts:​get|zabbix_get]] utility.
 +
 +== Step 3 ==
 +
 +Restart Zabbix agent.
 +
 +Agent will reload configuration file.
 +
 +== Step 4 ==
 +
 +Add new item for monitoring.
 +
 +Add new item with Key=mysql.questions to the monitored host. Type of the item must be either Zabbix Agent or Zabbix Agent (active).
 +
 +Be aware that type of returned values must be set correctly on Zabbix server. Otherwise Zabbix won't accept them.