Installation and configuration of Zabbix monitoring. Centos7

In this post, we install and configure a server-zabbix 4.0 LTS and add him to one agent. Zabbix configuration is one of the basic things that a good admin should be able to.

Zabbix is ​​a solution (do not be afraid to say) enterprise-class monitoring service problems. Is used to collect, analysis and data visualization. The software is also able to detect any anomalies in our infrastructure and to notify the user accordingly.

Installing zabbix
Install repositories EPEL, webtatic i zabbix:

yum -y install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

Install php version 7.2

yum -y install mod_php72w php72w-cli php72w-common php72w-devel php72w-pear php72w-gd php72w-mbstring php72w-mysql php72w-xml php72w-bcmath

Install httpd server:

yum install httpd

Clean the iptables rules

iptables -F

Edit the php.ini file and change the configuration as follows:

 nano /etc/php.ini
max_execution_time = 600
max_input_time = 600
memory_limit = 256M
post_max_size = 32M
upload_max_filesize = 16M
date.timezone = Europe/Warsaw

Instaujemy MariaDB and configure the root password:

yum -y install mariadb-server mariadb
service mariadb start
mysql_secure_installation
[root@zabbix /]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y / N] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y / N] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y / N] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y / N] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y / N] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Zabbix create a database and user zabbix ( alternatively add access to a server mysql from outside; password change on their own , difficult password dictionary):

m# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 5.5.56-MariaDB MariaDB Server
 
Copyright (c) 2000, 2017, Adminer, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> create database zabbix; 
Query OK, 1 row affected (0.00 sec)
 
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'mojetajnehaslo';
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'%' identified by 'mojetajnehaslo';
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> 
MariaDB [(none)]> quit
Bye

Install the server and its agent zabbix:

yum -y install zabbix-get zabbix-server-mysql zabbix-web-mysql zabbix-agent

We import a database Zabbix:

cd /usr/share/doc/zabbix-server-mysql-4.0.0/
gunzip 

We configure the server zabbix giving the details in our database created:
Edit your /etc/zabbix/zabbix_server.conf

nano /etc/zabbix/zabbix_server.conf

I give the following data:

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=haslo

Start the server zabbix, We add to startup and check if it works:

systemctl start zabbix-server
systemctl enable zabbix-server
systemctl status zabbix-server
● zabbix-server.service - Zabbix Server
   Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2018-10-05 09:47:06 UTC; 14s ago
  Process: 1789 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
 Main PID: 1791 (zabbix_server)
   CGroup: /system.slice/zabbix-server.service
           └─1791 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf

Oct 05 09:47:06 zabbix systemd[1]: Starting Zabbix Server...
Oct 05 09:47:06 zabbix systemd[1]: zabbix-server.service: Supervising proce...s.
Oct 05 09:47:06 zabbix systemd[1]: Started Zabbix Server.
Hint: Some lines were ellipsized, use -l to show in full

We run the agent in a similar manner.

systemctl start zabbix-agent 
systemctl enable zabbix-agent
systemctl status zabbix-agent
 zabbix-agent.service - Zabbix Agent
   Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2018-10-05 09:48:43 UTC; 30s ago
 Main PID: 1821 (zabbix_agentd)
   CGroup: /system.slice/zabbix-agent.service
           ├─1821 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
           ├─1822 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
           ├─1823 /usr/sbin/zabbix_agentd: listener #1 [waiting for connectio...
           ├─1824 /usr/sbin/zabbix_agentd: listener #2 [waiting for connectio...
           ├─1825 /usr/sbin/zabbix_agentd: listener #3 [waiting for connectio...
           └─1826 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]

Oct 05 09:48:43 zabbix systemd[1]: Starting Zabbix Agent...
Oct 05 09:48:43 zabbix systemd[1]: PID file /run/zabbix/zabbix_agentd.pid n...t.
Oct 05 09:48:43 zabbix systemd[1]: Started Zabbix Agent.
Hint: Some lines were ellipsized, use -l to show in full.

We do restart httpd command:

service httpd restart

We go to the browser and enter the address:

http://IP_SERWERA/zabbix/

If instead we have a window installer bug 500 , and in the error log the error "Can not start session" must be empowered to Session Directory:

chmod 777 /var/lib/php/session

We start the installer window.

go further, where they should be satisfied all requirements.
In the next step, we enter data into our database.
Data and configure the server name zabbix

we receive confirmation:

Congratulations! You have successfully installed Zabbix frontend.
Configuration file “/etc/zabbix/web/zabbix.conf.php” created.

We are directed to the panel zabbix - The default username is admin and the password is zabbix

After logging in, we can change the language to Polish that we were comfortable in it to operate - in this order on the right side at the top, select the icon, and then change the human language.

Ready - now we monitor our server!
For testing, we can install such a stress load and perform artificial:

yum install stress -y
# stress --cpu  3 --timeout 70
stress: info: [3497] dispatching hogs: 3 cpu, 0 io, 0 vm, 0 hdd
stress: info: [3497] successful run completed in 70s

Aby sprawdzić czy serwer poprawnie monitoruje obciążenie przechodzimy do Monitorowanie–> Wykresy , and the Chart choose "CPU Utilization":

Linux

Zobacz komentarze

Udostępnij
Opublikowane przez
Linux

Recent posts

KeePass2 2.52 w Ubuntu 22.04

The guide below describes how to install KeePass on Ubuntu. Całość wykonamy za pomocą kilku poleceń

2 years temu

Installing Master PDF editor in Ubuntu 22.04

Master PDF Editor is a comprehensive PDF program, which includes many features. Oprócz tworzenia i edycji

2 years temu

iotop - memory monitoring

Iotop jest prostym narzędziem dla systemów Uniksowych umożliwiającym monitorowanie użycia dowolnego nośnika pamięci flash/hdd/ssd w

2 years temu

Run multiple commands in one cron job

You can separate two or more commands with semicolons (;), Semicolon (;): służy do oddzielania

2 years temu

Changing the exif data of a photo in the Linux terminal

Poniższy poradnik opisuje w jaki sposób za pomocą konsoli możemy dokonać edycji danych zdjęcia exif.

2 years temu

Installing Rocket.Chat Server on Rocky Linux 8

The following guide describes how to install Rocket.Chat on Rocky Linux 8 Całość bardzo prosto zainstalujemy

2 years temu