Your business network needs monitoring. Your servers need monitoring. Your cloud needs monitoring. What do you do? If you happen to have a Linux server sitting around, you can always install Zabbix. Zabbix is an enterprise-class, open source monitor that is capable of monitoring just about anything you need.

I want to walk you through the process of installing the Zabbix server. I’ll demonstrate on Ubuntu Server 16.04. The installation isn’t terribly complicated, so it should be achievable by any Linux admin of moderate skills.

I will assume you already have Apache and MySQL up and running on your Ubuntu server.

SEE: Power checklist: Managing and troubleshooting Linux user accounts (Tech Pro Research)

And with that said, let’s get to work.

Update and upgrade

The first thing we are going to do is update and upgrade the server. Remember, there’s a chance the kernel can wind up being upgraded, so you’ll want to make sure to take care of this at a time when a reboot is possible.

To update and upgrade your server, open a terminal window and issue the following commands:

sudo apt-get update
sudo apt-get upgrade

Once the upgrade completes, reboot if necessary.

Installing dependencies

Next, we must install a few dependencies. From the terminal window, issue the following command:

sudo apt-get install php7.0-xml php7.0-bcmath php7.0-mbstring

Install Zabbix

Then, we must install the repository for Zabbix. Do this with the following commands:

sudo dpkg -i zabbix-release_3.2-1+xenial_all.deb

Re-run the update with the command:

sudo apt-get update

Install the Zabbix server and the web frontend with the command:

sudo apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-agent

Configuring the database

Gain access to the MySQL prompt with the command:

mysql -uroot -p

Create the necessary database and user with the commands:

create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'PASSWORD';
flush privileges;

where PASSWORD is a unique and strong password.

Finally, set up the database schema and import the data with the command:

zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix

We need to configure the password (the one we just created) in the Zabbix configuration file. Issue the command:

sudo nano /etc/zabbix/zabbix_server.conf

In that file, look for the section:

### Option: DBPassword
# Database password. Ignored for SQLite.
# Comment this line if no password is used.
# Mandatory: no
# Default:
# DBPassword=

Change that to:

### Option: DBPassword
# Database password. Ignored for SQLite.
# Comment this line if no password is used.
# Mandatory: no
# Default:

where PASSWORD is the password you created in the grant all command above.

Configure PHP

There’s only one configuration option to be changed for PHP. Issue the command:

sudo nano /etc/zabbix/apache.conf

Look for the line:

# php_value date.timezone Europe/Riga

Uncomment that line (remove the #) and then change the location to match yours (such as America/Chicago).

Save and close that file.

Restart Apache and Zabbix with the following commands:

sudo systemctl restart apache2
sudo systemctl start zabbix-server

Enable Zabbix with the command:

sudo systemctl enable zabbix-server

Fire up your browser

At this point, you can now point a browser to http://SERVER_IP/zabbix (where SERVER_IP is the IP address of your server) and go through the web-based installer (Figure A).

Figure A

The only thing you are required to change in the wizard is the database password (Figure B).

Figure B

When the installation completes, you will be prompted to log into Zabbix. The default credentials are Admin/zabbix.

Add the server as a host

Let’s add the Zabbix Server as a host (so it can monitor itself). To do this, log into Zabbix and then click Configuration | Hosts. In this window click the Create host button. In the resulting window (Figure C), you’ll need to configure the following:

  • Host name: the hostname of your Zabbix Server.
  • Groups: add Zabbix servers by selecting it in the right window and clicking the left-pointing arrow.
  • IP address: add the IP address of your Zabbix server.

Figure C

Click Update and Zabbix will start monitoring your hosting server.

That’s it. You now have a working Zabbix monitor up and running. Congratulations and enjoy this enterprise-class system. Since we’ve installed the Zabbix Agent, the server will start monitoring itself. Next time around, we’ll install the Zabbix Agent on a remote machine and connect it to the server.