In CentOS7 Zabbix is in 2.2 version. To install the lastest version (2.4) we have to create a new repo file for Zabbix 2.4
1 |
# nano /etc/yum.repos.d/zabbix.repo |
and insert those information:
1 2 3 4 5 |
[Zabbix] name=Zabbix baseurl=http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/ gpgcheck=1 gpgkey=http://repo.zabbix.com/zabbix-official-repo.key |
Ok, now we can install Zabbix
1 |
# yum install mariadb-server mariadb zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway |
Now we have to setup MariaDB (MySQL fork)
1 2 |
# systemctl start mariadb # systemctl enable mariadb |
and install it
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# mysql_secure_installation /usr/bin/mysql_secure_installation: line 379: find_mysql_client: nie znaleziono polecenia 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): ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 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! |
Now we have to log into mysql and create database for zabbix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 11 Server version: 5.5.44-MariaDB MariaDB Server Copyright (c) 2000, 2015, Oracle, 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_user@localhost identified by 'secretpassword'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye |
Ok, we have now installed and configured mysql server for Zabbix. Now we have to create database schema for Zabbix
1 2 3 |
# mysql -u root -p zabbix </usr/share/doc/zabbix-server-mysql-2.4.7/create/schema.sql # mysql -u root -p zabbix </usr/share/doc/zabbix-server-mysql-2.4.7/create/images.sql # mysql -u root -p zabbix </usr/share/doc/zabbix-server-mysql-2.4.7/create/data.sql |
After that we have to reconfigure zabbix.conf file which is located in /etc/httpd/conf.d/. Original file looks like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# # Zabbix monitoring system php web frontend # Alias /zabbix /usr/share/zabbix <Directory "/usr/share/zabbix"> Options FollowSymLinks AllowOverride None Require all granted <IfModule mod_php5.c> 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 date.timezone Europe/Riga </IfModule> </Directory> <Directory "/usr/share/zabbix/conf"> Require all denied </Directory> <Directory "/usr/share/zabbix/include"> Require all denied </Directory> |
I have modified those parameters:
1 2 3 4 5 6 |
php_value max_execution_time 600 php_value memory_limit 256M php_value post_max_size 32M php_value upload_max_filesize 16M php_value max_input_time 600 php_value date.timezone Europe/Warsaw |
Now it’s time to change some parameteres in zabbix_server.conf. We have to change CacheSize and StartPingers like this:
1 2 |
CacheSize=32M StartPingers=5 |
Now we have to open port 10050 for Zabbix Agent
1 |
# firewall-cmd --zone=public --add-port=10050/tcp --permanent |
And for SNMP (for devices that cannot have Zabbix Agent installed like switches etc )
1 |
# firewall-cmd --zone=public --add-port=161/udp --permanent |
Last thing is to start httpd service, zabbix server and agent and enable it during system restarts
We are done! Now go to your browser and point t your zabbix server
http://zabbix-server-ip/zabbix/