This is a translation of the original English documentation page. Help us make it better.

1 Estensione degli agenti Zabbix

Questo tutorial fornisce istruzioni dettagliate su come estendere le funzionalità dell'agente Zabbix con l'uso di un file user parametro.

Passo 1

Scrivi uno script o una riga di comando per recuperare il parametro richiesto.

Ad esempio, potremmo scrivere il seguente comando per ottenere il totale numero di query eseguite da un server MySQL:

mysqladmin -uroot stato | cut -f4 -d":" | cut -f1 -d"S"

Quando viene eseguito, il comando restituisce il numero totale di query SQL.

Step 2

Add the command to zabbix_agentd.conf:

UserParameter=mysql.questions,mysqladmin -uroot status | cut -f4 -d":" | cut -f1 -d"S"

mysql.questions is a unique identifier. It can be any valid key identifier, for example, queries.

Test this parameter by using Zabbix agent with "-t" flag (if running under root, however, note that the agent may have different permissions when launched as a daemon):

zabbix_agentd -t mysql.questions
Passaggio 3

Ricarica i parametri utente dal file di configurazione eseguendo:

zabbix_agentd -R userparameter_reload

È inoltre possibile riavviare l'agente invece del comando di controllo di runtime.

Testare il parametro utilizzando l'utilità zabbix_get.

Step 4

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.