Are you looking for a monitoring tool to keep an eye on the server? Then installing Zabbix is a good option.
Here we have open-source software for networks and applications to track the server actions.
At Bobcares, we often get requests from our customers to install Zabbix as part of our Server Management Services.
Today, we’ll see how our Support Engineers install Zabbix on Ubuntu and fix its related errors.
How we install Zabbix on ubuntu 16.04
Let’s now go through the steps that our Support Engineers follow to install Zabbix on Ubuntu 16.04
1. Initially, we log into the Zabbix server as a root user.
2. Then, we make sure to update the system’s list of available packages with the following command.
apt-get update
3. Next, we install the PHP modules that Zabbix needs.
apt-get install php7.0-xml php7.0-bcmath php7.0-mbstring
4. Here, we use the official Zabbix repository to install the latest stable version.
wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb
dpkg -i zabbix-release_3.2-1+xenial_all.deb
5. We update the package index so the new repository is included.
apt-get update
6. Also, we install the Zabbix server and web frontend with MySQL database support.
apt-get install zabbix-server-mysql zabbix-frontend-php
7. Again, we install the Zabbix agent.
apt-get install zabbix-agent
8. We create a MySQL database for Zabbix and assign the permissions.
mysql -u root -p
mysql > create database zabbix character set utf8 collate utf8_bin;
mysql > create user 'zabbix'@'localhost' identified by 'password';
mysql > grant all privileges on zabbix.* to zabbix@localhost identified by 'your_password'
mysql > flush privileges;
mysql > quit;
Also, we load the Zabbix database schema to the database created.
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u zabbix -p zabbix
9. After that, we configure the Zabbix server to use the database as follows.
nano /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=<your_zabbix_mysql_password>
10. Next, we configure PHP For Zabbix by editing /etc/zabbix/apache.conf.
11. Now, we start and enable the Zabbix server using the below commands.
systemctl start zabbix-server
systemctl enable zabbix-server
12. For further configuration, we can access the web interface via http://your_zabbix_server_ip_address/zabbix/.
Also, we need to configure the agent software that will send monitoring data to the Zabbix server.
13. So, we login to the second server, which needs to be monitored.
14. Again, we run the following commands to install the repository configuration package:
wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb
dpkg -i zabbix-release_3.2-1+xenial_all.deb
15. Then, we update the package index.
apt-get update
16. Next, we install the Zabbix agent.
apt-get install zabbix-agent
17. After that, we open /etc/zabbix/zabbix_agentd.conf and edit the IP address of the Zabbix server.
Server= <Zabbix_server ip>
Hostname= <New server name>
18. After adding Zabbix server IP in the configuration file, now we start agent service using the below command.
systemctl start zabbix-agent
systemctl enable zabbix-agent
Finally, the agent is now ready to send data to the Zabbix server.
That’s it.
Zabbix install ubuntu 16.04 – Related errors and fixes
At Bobcares, where we have more than a decade of expertise in managing servers, we see many customers face problems while installing Zabbix
Now, let’s see the major reasons for this Zabbix installation-related errors and how our Support Engineers fix the top errors.
Missing database
Recently, one of our customers had a problem while installing the Zabbix on the Ubuntu server. When he tried to start the Zabbix server service, he received the following error.
Nov 29 19:13:28 Zabbix systemd[1]: zabbix-server.szabbixervice: Control process exited, code=exited status=1
Nov 29 19:13:28 Zabbix systemd[1]: Failed to start Zabbix Server.
Nov 29 19:13:28 Zabbix systemd[1]: zabbix-server.service: Unit entered failed state.
Nov 29 19:13:28 Zabbix systemd[1]: zabbix-server.service: Failed with result 'exit-code'.
On checking /var/log/zabbix/zabbix_server.log, our Support Engineers found the following entry.
13714:20191129:165512.416 [Z3005] query failed: [1146] Table 'zabbixdb.users' doesn't exist [select userid from users limit 1]
13714:20191129:165512.416 cannot use database "zabbixdb": database is not a Zabbix database.
Here, the customer forgot to create the Zabbix database. That’s why this error occurred on the server.
Therefore, we created a database with UTF-8 character support.
mysql > create database zabbix character set utf8 collate utf8_bin;
After that, we had to import initial schema and data for the server with MySQL:
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql zabbixdb -u zabbixuser -p zabbixpassword
Also, we granted all needed privileges to the Zabbix user on that DB.
Also, increasing the CacheSize configuration parameter in the /etc/zabbix/zabbix_server.conf solve the error.
CacheSize=32M
This is how we fixed the error.
Incorrect user name and password
Sometimes, customers may face problems while logging into the Zabbix frontend at http://zabbix-frontend-hostname/zabbix in the browser. Often, it occurs when customers use the incorrect login password for accessing the Zabbix. They may use the login password in the config file for Zabbix server-internal purposes (to connect to MySQL DB).
To access the web frontend, customers should use login passwords which are then stored in this ZabbixDB users table.
Firewall restriction
Most of the customers may use a firewall to restrict unauthenticated access to the server. So, if there is any firewall like UFW, it is necessary to configure it to allow connections to port 10050.
ufw allow 10050/tcp
[Having trouble with Zabbix installation? We’ll help you.]
Conclusion
In short, Zabbix is an open-source software for networks and applications for monitoring purposes. Today, we saw how our Supported Engineers install Zabbix on ubuntu 16.04 and fix related errors.
0 Comments