Featured image of post Zabbix server on FreeBSD

Zabbix server on FreeBSD

Install a zabbix server on a FreeBSD server

Zabbix is an enterprise open source monitoring solution for networks and applications.

Example of a processor monitoring
Example of a processor monitoring

The Zabbix monitoring system is divided in 3 sub-systems :

  • Zabbix server : Collect and store data from the devices.
  • Zabbix frontend : Render the data and manage the web UI.
  • Zabbix agent : Run locally on the different devices to be monitored.

In this post, we’ll install everything on a FreeBSD 10.1 running on a Kimsufi KS-1 server.

Note : The Zabbix server is able to monitor devices and services such as routers, shared hosting, cloud services even if they are not running a Zabbix agent.

In this post, we assume that you already have a server with Ngnix, PHP and MySQL running.

Zabbix server

Install :

pkg install zabbix24-server-2.4.7 nmap

Launch a MySQL shell :


And create a MySQL user and database for our Zabbix server :

mysql -uroot -p
mysql> create database zabbix character set utf8;
mysql> CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'MyPassword';
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost' IDENTIFIED BY 'MyPassword';
mysql> quit

Install the database :

cd /usr/local/share/zabbix24/server/database
mysql -uzabbix -p zabbix < mysql/schema.sql
mysql -uzabbix -p zabbix < mysql/images.sql
mysql -uzabbix -p zabbix < mysql/data.sql

Create and edit a new configuration based on the sample :

cp /usr/local/etc/zabbix24/zabbix_server.conf.sample /usr/local/etc/zabbix24/zabbix_server.conf
vi /usr/local/etc/zabbix24/zabbix_server.conf

Change the following parameters :


Create the log folder as defined earlier in the configuration file :

mkdir /var/log/zabbix/
chown zabbix:zabbix /var/log/zabbix/

Edit the rc.conf :

vi /etc/rc.conf

And add the Zabbix server for automatic startup :


Start the server :

service zabbix_server start

And check in the logs if everything went well :

tail /var/log/zabbix/zabbix_server.log

Zabbix Frontend

Install :

pkg install zabbix24-frontend-2.4.7

Configure a vhost of your choice. With this “alias” configuration, we’ll be able to access the zabbix frontend using mydomain.tld/zabbix.

location /zabbix{
        alias /usr/local/www/zabbix24/;
        auth_basic "Restricted";
        auth_basic_user_file /usr/local/www/mydomain.tld/www/zabbix/.htpasswd;
        autoindex on;

I choose to protect access by htpasswd, so I created an user/password :

echo "monitoring:`perl -le 'print crypt("MyMonitoringPassword","salt")'`" > /usr/local/www/mydomain.tld/www/zabbix/.htpasswd

Then I just restarted my Nginx server:

service nginx restart

Zabbix frontend UI should be reachable using mydomain.tld/zabbix for web based setup.

The installation requires to change some PHP parameters. Open the php.ini configuration file :

vi /usr/local/etc/php.ini

And change the following :

post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = "Europe/Paris"
always_populate_raw_post_data = -1

And finally restart the PHP service :

service php-fpm restart

You will need to give the permission to Nginx to write files :

chown -R www:www /usr/local/www/zabbix24/

Zabbix agent

Install :

pkg install zabbix24-agent-2.4.7

cd /usr/local/etc/zabbix24/

Create and edit a new configuration based on the sample :

cp /usr/local/etc/zabbix24/zabbix_agentd.conf.sample /usr/local/etc/zabbix24/zabbix_agentd.conf
vi /usr/local/etc/zabbix24/zabbix_agentd.conf

Change the following :

Hostname=Kimsufi #Use the same hostname (case-sensitive) when declaring the host on the web UI

Edit the rc.conf :

vi /etc/rc.conf

And add the Zabbix agentd for automatic startup :


Start the Zabbix agent service :

service zabbix_agentd start

And check that everything went fine :

tail /var/log/zabbix/zabbix_agentd.log

Then you can use the web UI to configure everything !

comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy