The solution to the warning “Lack of Free Swap Space on Zabbix Server”

Put somehow on a new Linux server Zabbix and immediately began to display the following warning:

Lack of Free Swap Space on Zabbix Server

The warning says that there is no place in the Swap section, having seen that there is no Swap partition at all, it’s strange that when installing Ubuntu 14.04 LTS with the option to use the entire disk it was not created automatically, there was only 6 GB of RAM on the server.

On this solution of the problem in my case was the creation of the Swap partition, after which the warning disappeared.
Look another my article on this – How to create SWAP in Linux

Well, if there is a lot of RAM and it’s free basically, then Swap can make no sense, so you can simply turn off the trigger for this server creating a notification. To do this, open the Zabbix panel, go to the “Settings” tab – “Network nodes”, in front of this server, click “Triggers” and deactivate the trigger creating this warning.


Configuring email notifications in Zabbix via iRedMail

On the test I will use Zabbix 3.0.3 and iRedMail 0.9.4 installed in Ubuntu Server 14.04.4 LTS.

First, in the Zabbix panel, activate the action by opening the tab “Configuration” – “Actions” and activate “Report problems to Zabbix administrators“. In it I also, to see the names of the hosts, changed both topics of the letter with:




In Zabbix, the email notification method was initially added, but depending on the settings of the mail server it can work or not work. You can find it by going to Zabbix under the administrator and opening the tab “Administration” – “Media types” – “Email“.

When configuring with iRedMail, I specified the following parameters:

Name: Email
Type: Email
SMTP server:
SMTP server port: 25
SMTP helo:
SMTP email:
Connection security: STARTTLS
Checkboxes for “SSL verify peer” and “SSL verify host” did not put
Authentication: Username and password
Password: PASSWORD
check for “Enabled”

If the mail server is in the same system as the Zabbix server, you can try to configure both the above, but where “Connection security” and “Authentication” select “None”.

Also in the user profile, in the tab “Media” need to add:

Type: Email
Send to: mail for notifications
When active: time when it is allowed to be alerted
Use if severity: what importance of notification to send
check for “Enabled”


Zabbix installation on Ubuntu from distribution packages

On the test, I installed Zabbix 3.4 in Ubuntu 14.04 LTS, Ubuntu 16.04 LTS, Ubuntu 18.04 LTS.
Links to other versions of Zabbix can be found on the official website or
For example, Zabbix 3.4 for Ubuntu is located here

After installing Zabbix, transferred the data from the old Zabbix 2.2 server to it, simply exporting the templates first, then network nodes, set cards and complex screens.

Let’s proceed to installation, add the official source of packages to the system (example for Ubuntu 14.04 LTS (trusty)):

sudo dpkg -i zabbix-release_3.4-1+trusty_all.deb
sudo apt update

For Ubuntu 16.04 LTS (xenial):

sudo dpkg -i zabbix-release_3.4-1+xenial_all.deb
sudo apt update

For Ubuntu 18.04 (Bionic Beaver):

sudo dpkg -i zabbix-release_3.4-1+bionic_all.deb
sudo apt-get update

Perform the installation of Zabbix:

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

Connect to the MySQL server and create a database:

mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'ПАРОЛЬ';

We import the standard data into the created database:

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

For example, open the Zabbix server configuration file in the nano text editor (in nano, press Ctrl+X to exit, y/n to save or cancel changes):

sudo nano /etc/zabbix/zabbix_server.conf

Specify the MySQL database name, user name and password:


Run the Zabbix server process:

sudo service zabbix-server start

You need to fix the PHP configuration for Zabbix. The Apache configuration file for the Zabbix web interface is located in /etc/apache2/conf.d/zabbix or /etc/apache2/conf-enabled/zabbix.conf. Some minimal PHP configuration parameters have already been set there:

php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date.timezone Europe/Kiev

Restart the web server to apply the changes:

sudo service apache2 restart
sudo service zabbix-server restart

Make sure that the Zabbix agent and the Zabbix server are started at system startup and, if necessary, enable:

sudo systemctl is-enabled zabbix-agent.service
sudo systemctl is-enabled zabbix-server.service
sudo systemctl enable zabbix-agent.service
sudo systemctl enable zabbix-server.service

The Zabbix web interface is available through a browser at http://HOST/zabbix.
By default, the user name for logging in through the web interface is admin or Admin, the password is zabbix.

See also:
Installing and Configuring Zabbix Agent in Ubuntu

Why Zabbix does not always draw graphics

There are times when some of the information on the graphs in Zabbix is missing, so to say it is displayed partially and with interruptions.

I will describe possible reasons for interruptions and their solution:

1) There may be a bad connection to the network node, you need to check the ping from the Zabbix server to the network node.
For example, the first PING command with large packages from Windows, and the second from Linux:

ping -t -l 1024
ping -i 0.2 -s 1024

2) The device is slow to work and stops responding when there are a large number of requests, in order to solve this problem it is necessary to uncheck “Use mass requests” in the settings of the Zabbix network node.

3) 32-bit counters are used to obtain data from the network node, and when loading device interfaces, for example, above 400 megabits, the data on the graph may not be displayed; in order to solve this problem, in the data elements, they must be replaced with 64-bit ones and the node’s network history is cleared in order there were no leaps.
For example, if traffic is received from the first network interface via the ifInOctets.1 MIB (32-bit), then it must be replaced with ifHCInOctets.1 (64-bit).

Configuring SSH checks in Zabbix

It took somehow some Linux servers to configure SSH checks to not install Zabbix-agent on them.
Zabbix-server itself is installed on Ubuntu Server.

Below in order I will describe how to configure SSH checks in Zabbix.

Authorization for SSH will be configured by key instead of password, for this we stop zabbix-agent and zabbix-server:

sudo service zabbix-agent stop
sudo service zabbix-server stop

Create a Zabbix user home directory (for storing ssh keys):

sudo usermod -m -d /home/zabbix zabbix
sudo chown zabbix:zabbix /home/zabbix
sudo chmod 700 /home/zabbix

Run back zabbix-agent and zabbix-server:

sudo service zabbix-agent start
sudo service zabbix-server start

Open the configuration file /etc/zabbix/zabbix_server.conf (in the nano editor, press Ctrl+O and Enter means save, Ctrl+X to exit):

sudo nano /etc/zabbix/zabbix_server.conf

Uncomment the string SSHKeyLocation and specify the path to the directory with the keys:


Restart zabbix-server:

sudo service zabbix-server restart

Generate the ssh key:

sudo -u zabbix ssh-keygen -t rsa

Press Enter if the path is /home/zabbix/.ssh/id_rsa
On the offer to encrypt the key file, press Enter to not encrypt it or enter twice any password (it will encrypt the key file and you will have to specify it when connecting it)

Copy the generated key to the server we will be watching:

sudo -u zabbix ssh-copy-id -i /home/zabbix/.ssh/ -p 22 root@

If an error occurs while copying the key, you can manually copy the line from to the remote server in the authorized_keys file.

And we will try to connect to the remote server without entering the password with the command:

sudo -u zabbix ssh -p 22 root@

Now in Zabbix we add the data element to the template or host:
Name: any
Type: SSH agent
Key:[description,ip,port,encoding] (eg[cpu,,22,utf8]
Authentication method: Public key
User name (on remote host): root
Public key file:
Private key file: id_rsa
Phrase key password: leave blank if you did not encrypt the key with a password
Executed script: command running on a remote server, examples below

Below is an example of commands for Linux that you can execute and get various information.
CPU load for 1min / 5min / 15min:

cat /proc/loadavg |cut -d " " -f1
cat /proc/loadavg |cut -d " " -f2
cat /proc/loadavg |cut -d " " -f3

Number of currently running processes of the specified program:

pgrep apache2|wc -l
pgrep -c sshd

Free space at the mount point “/” (in megabytes):

df -m|grep "/$"|awk '{print $4}'

Occupied space at the mount point “/” (in percent):

df|grep "/$"|awk '{print $5}'|tr -d "%"

Received byte on the network interface eth0:

cat /proc/net/dev|grep eth0|awk '{print $2}'

Bytes sent to the network interface eth0:

cat /proc/net/dev|grep eth0|awk '{print $10}'

Amount of free RAM:

free |grep "Memory:"|awk '{print $4}'
free |grep "Mem:"|awk '{print $4}'

See also:
Connect to SSH using the keys

Monitoring BGP in Zabbix

I’ll give an example of a simple check whether something is running on TCP port 179 which uses BGP.

Create the following data item with the name Zabbix in the new Zabbix template or right in the network node “Template App BGP Service” (where is the address of the host on which the performance of the BGP is checked):

Name: BGP service is running
Type: Zabbix agent
Key: net.tcp.service[tcp,,179]
Type of information: Numeric (positive integer)
Data type: Decimal
Displaying the value: Service state

If Zabbix-agent is installed on the node, then we will create two data elements and in the field “Key:” we will indicate:


If the data element reports 0, then BGP does not work, or the port is closed, if 1 is OK.

Accordingly, we will add a trigger that will notify about the idle BGP:

Name: BGP does not work on {HOST.NAME}
Expression: {Template App BGP Service:net.tcp.service[tcp,,179].max(#3)}=0


Monitoring Samba in Zabbix

I will give an example of monitoring the number of running Samba processes, as well as creating a triggering trigger when there are no running processes.
In a system with Samba, a Zabbix agent must be installed.
See my popular articles about Zabbix.

Create a template, for example, with a name “Template Service Samba” and add the following data item to it:

Name: Number of processes nmbd
Type: Zabbix agent
Key: proc.num[nmbd]

Similarly, we create for smbd.
You can also create data items that represent the amount of memory used by the process, in which case the key will look like this:


And also add graphics for them.

Now add a trigger for each process to see when the process is not running:

Name: Does not work nmbd on {HOST.NAME}
Expression: {Template Service Samba:proc.num[nmbd].max(1)}<1