1 Extensions dels agents Zabbix
Aquest tutorial ofereix instruccions passa a passa per ampliar la funcionalitat de l'agent Zabbix mitjançant un paràmetre d'usuari.
Passa 1
Escriviu un script o una línia de comandes per recuperar el paràmetre necessari.
Per exemple, podem escriure l'ordre següent per obtindre el nombre total de consultes executades per un servidor MySQL:
mysqladmin -uroot status | cut -f4 -d":" | cut -f1 -d"S"
Quan s'executa, l'ordre retorna el nombre total de consultes SQL.
Passa 2
Afegiu a la comanda de l'arxiu de configuració zabbix_agentd.conf:
UserParameter=mysql.questions,mysqladmin -uroot status | cut -f4 -d":" | cut -f1 -d"S"
mysql.questions és un identificador únic. Pot ser qualsevol identificador de clau vàlid, per exemple, peticions.
Proveu aquesta configuració emprant l'agent Zabbix amb l'opció "-t" (si s'executa com a root, però, tingueu en compte que l'agent pot tindre permisos diferents que quan s'executa com a dimoni):
zabbix_agentd -t mysql.questions
Passa 3
Recarregueu la configuració de l'usuari des del fitxer de configuració executant:
zabbix_agentd -R userparameter_reload
També podeu reiniciar l'agent en lloc de l'ordre d'execució de control.
Proveu la configuració mitjançant la utilitat zabbix_get.
Passa 4
Afegiu un element nou amb Key=mysql.questions a l'equip monitorat. El tipus d'element ha de ser agent Zabbix o agent Zabbix (actiu).
Tingueu en compte que el tipus de valors retornats s'ha de configurar correctament al servidor Zabbix. En cas contrari, Zabbix no els admetrà.
Step 5: Create an item
Create a new item on the monitored host with the mysql.questions item key.
Select the item type: either Zabbix Agent or Zabbix Agent (active).
For Zabbix agent (passive), the Zabbix server or proxy address must be listed in the agent's Server parameter.
For Zabbix agent (active), the ServerActive parameter must specify the Zabbix server or proxy, and the agent's Hostname parameter must match the host name configured in the frontend exactly.
Select the item's Type of information. The agent always returns the value as text; Type of information defines how Zabbix interprets and stores the value after any preprocessing steps.
For the raw cumulative counter, select Numeric (unsigned). To measure the number of statements per second, select Numeric (float) and add the Change per second preprocessing step.