Monitoring Linux Servers with zabbix

Installing the Zabbix Agent on a Linux Server

1. Before we install the agent, let’s start by setting up the host in Zabbix.

In the Zabbix web-interface, go to Configuration –> Hosts –> Create Host.

Let’s call our new host: Mail_Server
DNS name: ms1-ny.mydomain.net [example dns name only]
IP address: 192.168.16.2 [example ip address]
Port: 10050
Status: Not Monitored [We will change this after installing the agent]
Link with Template: Template_Linux

then Save.

Now go to Configuration –> Triggers –> Host: Mail_Server and disable all the triggers, otherwise they will trigger as soon as you enable the host.

2. Install the Zabbix-Agent on the Linux server that you want to monitor. Follow the steps to install agent on linux server:

# Download the source code

wget http://prdownloads.sourceforge.net/zabbix/zabbix-1.1beta8.tar.gz?download

#  Create zabbix user and group

groupadd zabbix

useradd -c ‘Zabbix’ -d /home/zabbix -g zabbix -s /bin/bash zabbix

chown -R zabbix.zabbix /home/zabbix

# Untar the sources

tar -zxvf zabbix-1.1beta8.tar.gz

mv zabbix-1.1beta8 zabbix

cd zabbix

chown -R zabbix.zabbix .

# Configure compile and install the agent

./configure –prefix=/usr –with-mysql –with-net-snmp –enable-agent

make

make install

mkdir /etc/zabbix

cp misc/conf/zabbix_agentd.conf /etc/zabbix/

# Point to Zabbix server on the client machine config file

echo ‘Server=192.200.1.200’ >> /etc/zabbix/zabbix_agentd.conf

# Prepare the rest of the system

echo ‘zabbix_agent 10050/tcp’ >> /etc/services

echo ‘zabbix_trap 10051/tcp’ >> /etc/services

# Prepare startup of zabbix client on bootup

cp /opt/zabbix/misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/zabbix_agentd

echo ‘# chkconfig: 345 95 95’ >> /etc/init.d/zabbix_agentd

echo ‘# description: Zabbix Agentd’ >> /etc/init.d/zabbix_agentd

echo ‘BASEDIR=/usr’ >> /etc/init.d/zabbix_agentd

chkconfig zabbix_agentd on

# Start the zabbix services

service  zabbix_agentd start

Posted in: Linux.
Last Modified: January 12, 2017

One thought on “How to monitor Linux Servers with zabbix

  1. Pingback: The National Security Agency’s Guide to Securing a Linux Server | Lost Packets

Leave a reply