|
Installation de l'agent zabbix |
1. Create the ZABBIX account.
This is the user the agent will run as. For production use you should create a dedicated unprivileged account (“zabbix” is commonly used). ZABBIX agents have protection against running under root account.
Untar ZABBIX sources.
shell> gunzip zabbix.tar.gz && tar xvf zabbix.tar
2. Configure and compile the source code for your system.
The sources must be compiled for the client only.
To configure the source for the client:
shell> ./configure --enable-agent
Note: Use flag --enable-static to statically link libraries. If you plan to distribute compiled binaries among different servers, you must use this flag to make these binaries work without required libraries.
3. Build agent:
shell> make
Copy created binaries from bin/ to /opt/zabbix/bin or any other directory Other common directories are /usr/local/bin or /usr/local/zabbix/bin.
4. Configure /etc/services
The step is not real requirement. However, it is recommended.
On the client (monitored) machines, add the following lines to /etc/services:
zabbix_agent 10050/tcp
zabbix_trap 10051/tcp
5. Configure /etc/inetd.conf
If you plan to use zabbix_agent instead of the recommended zabbix_agentd, the following line must be added:
zabbix_agent stream tcp nowait.3600 zabbix /opt/zabbix/bin/zabbix_agent
Restart inetd
shell> killall -HUP inetd
6. Configure /etc/zabbix/zabbix_agent.conf
You need to configure this file for every host having zabbix_agent
installed. The file should contain IP address of ZABBIX server.
Connections from other hosts will be denied. Note, that no end of line
character should present in the file.
You may take misc/conf/zabbix_agent.conf as example.
7. Configure /etc/zabbix/zabbix_agentd.conf
You need to configure this file for every host with zabbix_agentd
installed. The file should contain IP address of ZABBIX server.
Connections from other hosts will be denied. You may take
misc/conf/zabbix_agentd.conf as example.
8. Run zabbix_agentd on all monitored machines
shell> /opt/zabbix/bin/zabbix_agentd
Note that you should not run zabbix_agentd if you have chosen to use zabbix_agent! Extending ZABBIX agents
Using configuration parameter UserParameter can easily extend ZABBIX agents. For example, number of emails waiting for delivery may be defined as:
UserParameter: mailq,echo /var/spool/mail/* | wc -w
See misc/conf/zabbix_agentd.conf for already predefined (but commented) parameters. The used command must return one line. This line is sent back to the ZABBIX server unchanged.
Scripts used for user parameters must have exit status '0' and must not return empty result, otherwise parameters will be treated as unsupported.
Also, the scripts must be as quick as possible. The scripts must not run longer than 0.5 second, otherwise ZABBIX server will block on retrieval on the parameter, thus reducing overall performance. After three consequitive timeouts status of the parameter will be set to unsupported.
|