Home » Linux » CentOS » Install and configure Zabbix 4.0

Install and configure Zabbix 4.0

On October 1, 2018, a new version of the free monitoring system was released, which I constantly use. I will talk in detail about the installation and initial configuration of Zabbix 4.0 using the example of CentOS, Debian, Ubuntu systems with screenshots and explanations. In this version there are many interesting and useful innovations, so it is definitely worth looking at it.

Introduction

Today, in my opinion, of the free monitoring systems, Zabbix is ​​the most popular and functional. I constantly see references to it in technical articles of specialists of various sizes and organizations. For example, SberTech uses Zabbix as a single monitoring platform. The IT department of the Magnit chain stores also uses zabbix as the main monitoring system. A couple of years ago I was watching a speech by an IT representative from Magnit, where he described in detail the structure of the system. At that time, it was the largest installation of zabbiks with thousands of proxy servers for collecting data from stores across the country. I met references to monitoring Zabbiks from specialists from 1C, Krok, Yandex.Money and others. Listed only what was remembered.

You need to understand that Zabbix is ​​a general-purpose monitoring system. She has no specialization in microservices, network, hardware, etc. In this regard, there can always be a tool that can perform a particular task more conveniently and more efficiently than zabbix. But this does not implore the rest of the advantages of the system. I see them first of all in that it is possible to set up monitoring of everything, anything. The main thing is to learn to submit values ​​to the system. And for this there are a lot of tools – both the agents themselves and the scripts that can be connected to the data collection.

Zabbix monitoring system allows you to somehow get all the serviced services on it. Somewhere it may not be very simple, but in any case, one universal tool is more convenient than several. I always managed to set up the desired monitoring with the help of zabbiks. If there were no ready-made templates or suitable agents for collection, write scripts and transfer the data to the agent. You can get acquainted with my (and not only) monitoring solutions in a separate section of zabbix.

What else bothers me is zabbix – good documentation and a large community. Many speeches from various experts with the description of introductions. All this facilitates the work with the system. It is easier to decide what to do in a given situation. The developers themselves constantly hold meetings, invite speakers, and then upload videos. In general, the system on all sides leaves a favorable impression.

I will install and configure the work of the zabbix server on nginx, which is somewhat different from the default installation, which includes the apache web server. In this regard, we will need to prepare.

Preparing the CentOS server for installation

First of all, you need to install and configure a CentOS 7 server. Before installing the Zabbix server, we also need to prepare a Web server. I have a separate article on setting up a web server centos. There everything is described in detail. Now, I will, briefly and without unnecessary comments, perform the minimum necessary actions for the work of the zabbiks. Also, I will not stop at configuring iptables. This is a separate topic and I do not want to touch it in this article. Either configure it yourself according to my instructions, or simply disable the firewall:

# systemctl stop firewalld
# systemctl disable firewalld

Connect the nginx repository and install it:

# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
# yum install nginx

Start nginx and add to autostart.

# systemctl start nginx
# systemctl enable nginx

Check if it works. To do this, open in the browser the link http://192.168.13.117/, where 192.168.13.117 is the ip address of the server being configured.

Nginx start page

If nginx does not work for you, sort it out before moving on. First check the firewall settings.

Next install php-fpm. To do this, connect the remi repository and epel-release.

# yum install epel-release
# rpm -Uhv http://rpms.remirepo.net/enterprise/remi-release-7.rpm

We activate the remi-php71 repository, for this we execute the commands:

# yum install yum-utils
# yum-config-manager --enable remi-php71

Install php 7.1 and modules for it.

# yum install php71 php-fpm php-cli php-mysql php-gd php-ldap php-odbc php-pdo php-pecl-memcache php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap php-bcmath

Run php-fpm and add it to autoload.

# systemctl start php-fpm
# systemctl enable php-fpm

Check if it started.

# netstat -tulpn | grep php-fpm
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      13261/php-fpm: mast

All right, running on port 9000. Run it through a unix socket. To do this, open the config /etc/php-fpm.d/www.conf and comment on the line:

# mcedit /etc/php-fpm.d/www.conf
;listen = 127.0.0.1:9000

Instead, add a few others:

listen = /var/run/php-fpm/php-fpm.sock
listen.mode = 0660
listen.owner = nginx
listen.group = nginx

At the same time, change the user from whom php-fpm will work. Instead of apache, specify nginx by editing the corresponding parameters.

user = nginx
group = nginx

Restart php-fpm.

# systemctl restart php-fpm

Check if the specified socket has started.

# ll /var/run/php-fpm/php-fpm.sock 
srw-rw----. 1 nginx nginx 0 Oct  4 15:08 /var/run/php-fpm/php-fpm.sock

To date, with the setting of php-fpm finished. We are continuing to prepare the server for installing zabbix.

Install the latest version of MariaDB. We connect the repository. To do this, create the file /etc/yum.repos.d/mariadb.repo with the following content.

# mcedit /etc/yum.repos.d/mariadb.repo
# MariaDB 10.3 CentOS repository list - created 2018-10-04 12:10 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Install the latest version of mariadb on centos.

# yum install MariaDB-server MariaDB-client

Run mariadb and add to autoload.

# systemctl start mariadb
# systemctl enable mariadb

Run the mysql initial configuration script and set the password for root. Everything else can be left as default.

# /usr/bin/mysql_secure_installation

Let’s make some changes to the standard mariadb config. To do this, open the config mysql /etc/my.cnf.d/server.cnf and bring it to the following form.

# mcedit /etc/my.cnf.d/server.cnf
[client]
port		= 3306
socket		= /var/lib/mysql/mysql.sock
default-character-set=utf8

[mysqld]
character_set_server=utf8
collation-server=utf8_bin
init_connect="SET NAMES utf8 collate utf8_bin"
port		= 3306
socket		= /var/lib/mysql/mysql.sock

innodb_file_per_table=1
innodb_buffer_pool_size = 768M # attention to the parameter! set about 2 times less than the amount of server RAM
innodb_buffer_pool_instances=1 # increase by 1 each GB innodb_buffer_pool_size
innodb_flush_log_at_trx_commit = 0
innodb_log_file_size = 512M
innodb_log_files_in_group = 3

[server]

[galera]

[embedded]

[mariadb]

[mariadb-10.3]

I added a minimum of settings other than default. In the article about mysql optimization, they are given much more, but over time I realized that I did nothing. Really, I don’t have much experience in tweaking mysql. I did not do any tests and checks, and took data on the basis of other articles on the Internet. Not the fact that there were no errors. As a result, now there are only certain important parameters for innodb, in particular the instruction to store each table in a separate file, the size and number of binary logs and a couple of settings that will clearly be relevant (innodb_buffer_pool_size, innodb_buffer_pool_instances and innodb_flush_log_at_trx_comm) If you wish, you can do the mysql tuning yourself. In general, the current settings will suffice.

Restart mariadb and make sure that it starts.

# systemctl restart mariadb
# systemctl status mariadb.service

The mysql database server for our zabbix server is ready. This completes the preliminary server settings. We start the installation.

Installing Zabbix 4.0 server on CentOS

In order to install Zabbix Server 4.0, you need to connect the repository of the current version.

# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.fCWryx: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-release-4.0-1.el7         ################################# [100%]

Install zabbix server:

# yum install zabbix-server-mysql zabbix-web-mysql

Package dependencies will be httpd, which we don’t need, since we will have nginx and php7.1, but I didn’t understand how to install without it. After installing the packages, create a database, create a zabbix user, and fill the database.

# mysql -uroot -p
Enter password:
> create database zabbix character set utf8 collate utf8_bin;
> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabpassword';
exit
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

Edit the zabbix server configuration file. We set the data to connect to the database, disable ipv6 and increase the standard timeout.

# mcedit /etc/zabbix/zabbix_server.conf

Change the specified lines, do not touch the rest:

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabpassword
ListenIP=0.0.0.0
Timeout=10

These minimum settings are enough for the server to work. I recommend increasing the Timeout parameter, as it is responsible for waiting for a response from an agent, a snmp device, or an external check. Sometimes a standard value of 4 seconds is not enough. In particular, when using some kind of script that takes a long time to get a metric. Set 10 seconds.

Run zabbix and add to startup.

# systemctl start zabbix-server
# systemctl enable zabbix-server

Check the log file for errors.

# cat /var/log/zabbix/zabbix_server.log

Zabbix Server Startup Log

Configuring SELinux with zabbix

If you have SELinux enabled, you will get an error.

cannot start preprocessing service: Cannot bind socket to "/var/run/zabbix/zabbix_server_preprocessing.sock": [13] Permission denied.

This is normal, now we will configure SELinux for normal Zabbix operation. To do this, install the package policycoreutils-python, download the finished module for SELinux and use it.

# yum install policycoreutils-python
# cd ~
# curl https://support.zabbix.com/secure/attachment/53320/zabbix_server_add.te > zabbix_server_add.te
# checkmodule -M -m -o zabbix_server_add.mod zabbix_server_add.te
# semodule_package -m zabbix_server_add.mod -o zabbix_server_add.pp
# semodule -i zabbix_server_add.pp

Now we need to restart zabbix-server.

# systemctl restart zabbix-server

If you can’t do this through the systemctl, then the service is frozen. We complete it forcibly and run it again.

# kill -9 `pidof zabbix_server`
# systemctl start zabbix-server

Check the log file again. Now there should be no mistakes. As I said, if you have disabled SELinux, then you do not need to do the above manipulations with the module.

With the server part finished. We need to make a nginx config for the zabbix web interface to work. If you have nginx running on the same server where zabbix itself and no other virtual hosts exist, then edit the default one at once – /etc/nginx/conf.d/default.conf. We bring it to the following form:

# mcedit /etc/nginx/conf.d/default.conf
server {
    listen       80;
    server_name  localhost;
    root /usr/share/zabbix;

    location / {
	index index.php index.html index.htm;
    }

    location ~ \.php$ {
	fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
	fastcgi_index index.php;
	fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
	include fastcgi_params;
	fastcgi_param PHP_VALUE "
	max_execution_time = 300
	memory_limit = 128M
	post_max_size = 16M
	upload_max_filesize = 2M
	max_input_time = 300
	date.timezone = Europe/Moscow
	always_populate_raw_post_data = -1
	";
	fastcgi_buffers 8 256k;
	fastcgi_buffer_size 128k;
	fastcgi_intercept_errors on;
	fastcgi_busy_buffers_size 256k;
	fastcgi_temp_file_write_size 256k;
        }
}

Check the config for errors and if everything is in order, restart nginx.

# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# nginx -s reload

Small but important nuance. We need to change the permissions on some folders. Assign nginx owner.

# chown -R nginx:nginx /var/lib/php/session
# chown -R nginx:nginx /etc/zabbix/web

This step will need to be done after each update of php or zabbix. This is due to the fact that by default zabbix comes bundled with apache and is designed to work with it. Therefore, after installation or upgrade, it makes it the owner of the directory /etc/zabbix/web.

We give SELinux permissions for zabbix to work with a web server and database.

# setsebool -P httpd_can_connect_zabbix on
# setsebool -P httpd_can_network_connect_db on

I do not know how the last setting is relevant if the connection to the database is local. The developers in the instructions said that in the case of postgresql, even if you connect through 127.0.0.1, you need to issue permission. There are no comments about mysql.

With the server part finished. To continue the installation of the zabbix server, go to the configuration of Zabbix Frontend.

Installing Zabbix 4.0 server in Ubuntu, Debian

Installing Zabbix on a server with Ubuntu or Debian is simpler, since you can use them in the standard repositories for the fresher versions of the software. We connected repositories of zabbix 4.0.

Ubuntu 18:

# wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.deb
# dpkg -i zabbix-release_4.0-2+bionic_all.deb

Debian 9:

# wget https://repo.zabbix.com/zabbix/4.0/debian/pool/main/z/zabbix-release/zabbix-release_4.0-2+stretch_all.deb
# dpkg -i zabbix-release_4.0-2+stretch_all.deb

If you have other versions of the systems, then just find the package links for your version in the official repository – https://repo.zabbix.com/zabbix/4.0/ Further installation will not differ from the current one.

We update information about the repositories, and at the same time we will install the latest updates:

# apt update && apt upgrade

Install the zabbix server:

# apt install zabbix-server-mysql zabbix-frontend-php

It is installed by default with apache, which immediately starts. Stop it and disable it:

# systemctl stop apache2
# systemctl disable apache2

We install separately nginx and php-fpm:

# apt install nginx php-fpm

Run the mysql initial configuration script and set the password for root. Everything else can be left as default.

# /usr/bin/mysql_secure_installation

Edit some Mariadb parameters in the /etc/mysql/mariadb.conf.d/50-server.cnf config. Add it to the [mysqld] section:

# mcedit /etc/mysql/mariadb.conf.d/50-server.cnf
innodb_file_per_table=1
innodb_buffer_pool_size = 768M # attention to the parameter! set about 2 times less than the amount of server RAM
innodb_buffer_pool_instances=1 # increase by 1 each GB innodb_buffer_pool_size
innodb_flush_log_at_trx_commit = 0
innodb_log_file_size = 512M
innodb_log_files_in_group = 3

Restart mariadb and make sure that it starts.

# systemctl restart mariadb
# netstat -tulnp | grep mysqld
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      16753/mysqld

Create a database, user zabbix, and fill the database.

# mysql -uroot -p
Enter password:
> create database zabbix character set utf8 collate utf8_bin;
> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabpassword';
exit
# zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix

Now we edit the server configuration file zabbix. We set the data to connect to the database, disable ipv6 and increase the standard timeout.

# mcedit /etc/zabbix/zabbix_server.conf

Change the specified lines, do not touch the rest:

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabpassword
ListenIP=0.0.0.0
Timeout=10

These minimum settings are enough for the server to work. I recommend increasing the Timeout parameter, as it is responsible for waiting for a response from an agent, a snmp device, or an external check. Sometimes a standard value of 4 seconds is not enough. In particular, when using some kind of script that takes a long time to get a metric. Set 10 seconds.

Run zabbix and add to startup.

# systemctl start zabbix-server
# systemctl enable zabbix-server

Check if it started.

# netstat -tulnp | grep zabbix_server
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      16847/zabbix_server

Everything is good. Run nginx, which we will act as a web server.

# systemctl start nginx
# systemctl enable nginx

Make sure that nginx works as a web server.

# netstat -tulnp | grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      17075/nginx: master 
tcp6       0      0 :::80                   :::*                    LISTEN      17075/nginx: master 

We need to make a nginx config for the zabbix web interface to work. If your nginx is running on the same server where zabbix itself and there are no other virtual hosts, then edit the default one at once – /etc/nginx/sites-available/default. We bring it to the following form:

# mcedit /etc/nginx/sites-available/default
server {
    listen       80;
    server_name  localhost;
    root /usr/share/zabbix;

    location / {
    index index.php index.html index.htm;
    }

    location ~ \.php$ {
    fastcgi_pass unix:/run/php/php7.2-fpm.sock; # check this path, for different versions of php it will be different
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include fastcgi_params;
    fastcgi_param PHP_VALUE "
    max_execution_time = 300
    memory_limit = 128M
    post_max_size = 16M
    upload_max_filesize = 2M
    max_input_time = 300
    date.timezone = Europe/Moscow
    always_populate_raw_post_data = -1
    ";
    fastcgi_buffers 8 256k;
    fastcgi_buffer_size 128k;
    fastcgi_intercept_errors on;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
        }
}

Check the config for errors and if everything is in order, restart nginx.

# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# nginx -s reload

With the server part finished. To continue the installation of the zabbix server, go to the configuration of Zabbix Frontend.

Configuring Zabbix Frontend

Go to the browser and open the address http://192.168.13.117. You should see the Zabbix 4.0 installer.

Installing Zabbix server

Click Next step and start setting up the web interface. On the next page there will be a check of requirements. You must meet all requirements. Depending on the system and version of php, the information will vary in each case.

Checking zabbix system requirements

In the next step, we specify the parameters of access to the database, then Zabbix server details. There you can not specify anything, but leave the default settings. Then there will be a page with verification of the entered data. If everything is in order, then complete the installation. At the end you will see the message: Congratulations! You have successfully installed Zabbix frontend.

Completing the installation of zabbix server

After clicking on Finish, you will see the authorization window of the Zabbix server.

Completing the installation of zabbix server

The standard account for logging into the zabbix web interface is as follows:

  • User Admin
  • Password zabbix

After login you will see a standard dashboard.

Completing the installation of zabbix server

This completes the installation of the free zabbix monitoring server. You can begin to configure.

Configure Zabbix Server

Create account and change password

The first thing to do is change the standard login credentials. You can simply change the password of the user admin, but it is better to create a new account with superuser rights, and remove the admin. To do this, go to the section Administration -> Users and click Create User.

Add new user to zabbix

Fill in all the required fields. You can choose the Russian language. I usually try to work in English, but in the case of Zabbix, an exception can be made. It is very well located and there are no problems. Do not forget to go to the Permissions tab and select the User type – Zabbix Super Admin.

Now you can log in as a new user and delete Admin. But the system will not allow to delete it, since it owns some objects:

  • map – Local Network
  • screen Zabbix server
  • dashboards Global view and Zabbix server health

They are created automatically when installing zabbix. You need to change their owner to a new user. After this standard admin can be removed.

Setting up email alerts

Next you need to configure a very important part of the monitoring system – email notifications. Without it, the monitoring system does not look complete and complete. Zabbix server supports sending mail through third-party smtp servers. Set up one of them. To do this, go to the Administration -> Media types and click on Email.

Setting email alerts in zabbix

I will show on the example of the box settings with Gmail.

Gmail mailbox settings for sending notifications

We set up the shipping address. Now the user needs to add an address to receive alerts. To do this, go to Administration -> Users, select your user. Go to the Alerts tab and click Add. Add your box and click Update.

Add a recipient email address

Log in to your account again and make sure the email is added.

User profile with alert email connected

Next you need to activate the sending of notifications on events. To do this, go to Configuration -> Actions and click on Disabled so that it becomes Enabled.

Enable alerts in zabbix

That’s all, we have configured sending notifications, it is necessary to wait triggering of the trigger to check. We will do this later when we connect the host to the monitoring.

If you need alerts in a telegram, then read a separate article on this topic. I also recommend that you familiarize yourself with the material on the setting of duplicate notifications in zabbix. For many triggers can be a very useful feature. For example, you can be reminded every day about the end of the domain delegation time until it is renewed.

Also zabbix can call through asterisk for notification of events.

Modify standard alert template

I usually change the standard zabbix notification template. It is located in the Configuration -> Alerts section, called Report problems to Zabbix administrators.

Setting up a email template

I make the following changes. I am changing the pattern of the letter subject during the problem and recovery. In the standard template in the subject line there is no information about the host name. In some trigger templates, the host name is indicated, but there are those where this information is not available. As a result, the notification does not immediately show which host we are talking about. In my own template, the host name, status, and then everything else will be indicated in the subject immediately. Here is an example of an old and a new alert:

Difference in notification letter templates

My view seems more visible to me. The template changes to the following:

{HOST.NAME} - {TRIGGER.STATUS}: {TRIGGER.NAME}

Setting up a subject in zabbix letters

It is the same for both the problem and the recovery.

Modify standard monitoring templates

On my monitoring servers, I change some of the parameters of the standard templates so that there are fewer useless and non-informative positives. Here is a list of what I’m doing.

  1. In the Template App Zabbix Agent disables the trigger of Version of zabbix_agent (d) was changed on {HOST.NAME}. If you leave it, then after each update zabbix agent you will receive a notification. I personally do not need this information.
  2. In the Template OS Linux, I change the value in the Disk I/O trigger overloaded on {HOST.NAME} from standard 20% to 50%. I think that to start to worry and look at the server should be at this value. But you can choose to fit your needs.
  3. In the same template, in the Mounted filesystem discovery detection rule, I add another prototype of the trigger by copying Free disk space is less than 20% on volume {#FSNAME}. The new template is completely identical to the copied one, only instead of 20% I indicate 5% and put the importance from “Warning” to “High”. I add another alert if the free space on the drives remains less than 5%. Standard 20% is very high threshold, especially if the disk is large. Prompt resolution of the problem is not required. Because of this, you often postpone cleaning the disk for later and forget about it. Now there will be another safety trigger, after which you just have to go and deal with the place right now. In the trigger for 20% of free space I put permission to close the trigger manually.
  4. In the same pattern in the Lack of free swap space on {HOST.NAME} trigger, I change the trigger threshold from 50% to 20%, or disable it altogether. Now a lot of servers are working without swap. Although personally, I always create and connect it.
  5. In the Template OS Windows, I disable the Windows service discovery rule. In the default version, it generates a lot of unnecessary items and alerts. If monitoring of some windows service is needed, I make a separate template for this.

General settings

In the general settings of the zabbix server, which are located in the Administration -> General section, I change the following parameters:

  1. In the section Working time I set the current working hours.
  2. In the Trigger displaying options section, I change the values Display OK triggers for
    and On status change triggers blink for for 1 minute. This is just my preference. I do not like it when the triggers blink for a long time, or the already closed ones hang.
  3. In the Other section, I update the Refresh unsupported items for 1 minute. This is relevant while debugging new templates.

Install Zabbix Agent on Linux

If you want to install zabbix-agent on the monitoring server itself, then nothing needs to be done, except for the installation agent. For other systems, you need to add the zabbix repositories that we used during the server installation. You can see them in the sections for your system.

Installing zabbix agent in Centos:

# yum install zabbix-agent

Installing zabbix agent in Ubuntu/Debian:

# apt install zabbix-agent

To work with a server that is installed locally on the same server, no other settings need to be made. If you install the zabbix agent on another server, you will need to set the following parameters in the agent configuration file /etc/zabbix/zabbix_agentd.conf:

# mcedit /etc/zabbix/zabbix_agentd.conf
Server=192.168.13.117
ServerActive=192.168.13.117
Hostname=srv10 # the name of your monitoring node, which will be specified on the zabbix server, Zabbix server if it is the zabbix server itself

Start the agent and add it to autostart:

# systemctl start zabbix-agent
# systemctl enable zabbix-agent

Check the log file.

# cat /var/log/zabbix/zabbix_agentd.log
 14154:20181004:201307.800 Starting Zabbix Agent [Zabbix server]. Zabbix 4.0.0 (revision 85308).
 14154:20181004:201307.800 **** Enabled features ****
 14154:20181004:201307.800 IPv6 support:          YES
 14154:20181004:201307.800 TLS support:           YES
 14154:20181004:201307.800 **************************
 14154:20181004:201307.800 using configuration file: /etc/zabbix/zabbix_agentd.conf
 14154:20181004:201307.800 agent #0 started [main process]
 14157:20181004:201307.801 agent #3 started [listener #2]
 14159:20181004:201307.802 agent #5 started [active checks #1]
 14155:20181004:201307.804 agent #1 started [collector]
 14158:20181004:201307.806 agent #4 started [listener #3]
 14156:20181004:201307.810 agent #2 started [listener #1]

Everything is good. Go to the web interface and check the data. To do this, go to the section Monitoring -> Latest Data. Specify in the Hosts Zabbix Server section and wait for the receipt of the first data. They should go 2-3 minutes after starting the agent.

View incoming data

Now we will try to stop the agent and check whether the notification will arrive in the mail. Go to the console and turn off the agent:

# systemctl stop zabbix-agent

Wait for at least 5 minutes. This interval is specified by default for the trigger on agent unavailability. After that, check the main Dashboard, the Problems widget.

Verify that problem notifications are sent

Check email box. There should come a notification from the zabbix server.

Installing zabbix agent on Windows

Let’s add one agent installed on the windows server and configure its monitoring. To do this, go to the download page https://www.zabbix.com/download_agents and download the latest version of the agent for Windows.

Unpack the archive. Create on disk C: zabbix folder and copy the following files there:

  • zabbix_agentd.exe
  • zabbix_get.exe
  • zabbix_sender.exe
  • zabbix_agentd.win.conf

Executable files take the bit that you have in the system. In the original archive there are both x32 and x64. Next, open the command prompt with administrator rights and execute the following command to install the zabbix agent on windows:

c:/zabbix/zabbix_agentd.exe --config c:/zabbix/zabbix_agentd.win.conf --install

Installing zabbix agent on Windows

Open the zabbix_agentd.win.conf file with any text editor and change the following parameters:

LogFile=c:\zabbix\zabbix_agentd.log
LogFileSize=1
Server=192.168.13.117
ServerActive=192.168.13.117
Hostname=win10-01

Open a snap-in with services, look for a service with the name Zabbix agent and start it.

Starting Zabbix Agent service on Windows

Do not forget to create a permissive rule in the Firewall, if you have it enabled. To do this, go to Control Panel \ System and Security \ Windows Firewall – Advanced settings – Rule for incoming connections – Create a rule.

  • Rule type: For port;
  • Protocols and ports: TCP; Specific local ports: 10050;
  • Action: Allow the connection;
  • Profile (tick): Domain, Private, Public;
  • Name: Zabbix Agent;

In order for the windows monitoring of the machine to work, you need to add a host with the same hostname to the monitoring server that we specified in the agent config. To do this, go to the web panel, open the Configuration -> Hosts section and click Create Host.

Adding a new Windows host to Zabbix

On the first tab, specify the host name, the same as on the client, add to any existing group and set the ip address of the computer.

Host options

Then go to the Templates tab and click Select. Select Template Windows OS and click the small Add link, then the large Add.

Connect template to host

A new monitoring host has been added, it remains to wait for a few minutes of fresh data. You can check them where, before, in the Latest data, by selecting a new host.

Receipt of data from windows server

This completes the installation and setup of windows monitoring using the zabbix agent. You can add new computers with different versions of windows. The same version of the agent is suitable for all, and desktop, and server systems.

Conclusion

This completes the installation and basic setup of the zabbix 4.0 monitoring server. Tips, comments, corrections please leave in the comments.

The Zabbix team is closely monitoring the backward compatibility of their products. Due to this, the transition to new versions is painless. There is no need to reconfigure or correct old practices. In new versions, the functionality is only added, the old one most often does not change, it can be used further. There are, of course, exceptions, but rarely.

Materials on setting up monitoring of various systems and services are not out of date and remain relevant for the newest releases. Here is an example of monitoring the various services and services listed on my site. Perhaps some of this will be interesting and useful.

Video

One comment

  1. thanks. It’s so useful and fixed my problem

Leave a Reply

Your email address will not be published.

Нажимая кнопку "Отправить комментарий" Я даю согласие на обработку персональных данных.