First of all, we need to download the source code from the Zabbix web site and decompress it inside the server. We must have installed too the build-essential package, so as to be able to compile the Zabbix client.
root@ubuntu-server:~# aptitude install build-essential
root@ubuntu-server:~/zabbix-1.8.7# ./configure --enable-agent
root@ubuntu-server:~/zabbix-1.8.7# make ; make install
Once we have correctly compiled and installed the Zabbix agent, next step is to create the appropiate directories, copy the configuration files and add a new user to the system called zabbix.
root@ubuntu-server:~/zabbix-1.8.7# mkdir -p /etc/zabbix/alert.d /var/log/zabbix /var/run/zabbix
root@ubuntu-server:~/zabbix-1.8.7# cp -a misc/conf/zabbix_agentd.conf /etc/zabbix/
root@ubuntu-server:~/zabbix-1.8.7# cp misc/init.d/ubuntu/zabbix-agent.conf /etc/init/
root@ubuntu-server:~/zabbix-1.8.7# useradd -r -d /var/run/zabbix -s /sbin/nologin zabbix
root@ubuntu-server:~/zabbix-1.8.7# chown zabbix:zabbix /var/run/zabbix /var/log/zabbix
Afterwards, we must edit the minimum information required for the Zabbix agent configuration file and in addition, it is also neccesary to establish an Upstart file for starting up and stopping the Zabbix agent service.
root@ubuntu-server:~# cat /etc/zabbix/zabbix_agentd.conf
...
# Zabbix client PID file
PidFile=/var/run/zabbix/zabbix_agentd.pid
# Zabbix client log file
LogFile=/var/log/zabbix/zabbix_agentd.log
# Allow remote commands from zabbix server
EnableRemoteCommands=1
# Maximum time for processing
Timeout=10
# System hostname
Hostname=ubuntu
# Zabbix server IP
Server=192.168.1.100
root@ubuntu-server:~# cat /etc/init/zabbix-agent.conf
# Start zabbix agent
pre-start script
if [ ! -d /var/run/zabbix ]; then
mkdir -p /var/run/zabbix
chown zabbix:zabbix /var/run/zabbix
fi
end script
start on filesystem
stop on starting shutdown
respawn
expect daemon
exec /usr/local/sbin/zabbix_agentd
The last point is to register the ports used by Zabbix into the services file and run the agent.
root@ubuntu-server:~# echo "zabbix-agent 10050/tcp Zabbix Agent" >> /etc/services
root@ubuntu-server:~# echo "zabbix-agent 10050/udp Zabbix Agent" >> /etc/services
root@ubuntu-server:~# echo "zabbix-trapper 10051/tcp Zabbix Trapper" >> /etc/services
root@ubuntu-server:~# echo "zabbix-trapper 10051/udp Zabbix Trapper" >> /etc/services
root@ubuntu-server:~# start zabbix-agent
No comments:
Post a Comment