Установка и настройка Zabbix

From wiki.baghirzade.pro
Revision as of 05:47, 29 September 2025 by Sadmin (talk | contribs)
Jump to navigation Jump to search

INSTALL ZABBIX

zabbix version: 7.0

os: CentOS

version: 9 stream

zabbix component: Server, Frontend, Agent

database: mysql

webserver: apache

# rpm -Uvh https://repo.zabbix.com/zabbix/7.0/centos/9/x86_64/zabbix-release-latest-7.0.el9.noarch.rpm
# dnf clean all
# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
# dnf install mariadb
# dnf install mariadb-server
# systemctl start mariadb
# mysql_secure_installation
set password
all answer: Y

  1. mysql -uroot -p

password mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin; mysql> create user zabbix@localhost identified by 'Password54321'; mysql> grant all privileges on zabbix.* to zabbix@localhost; mysql> set global log_bin_trust_function_creators = 1; mysql> quit;

  1. zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
  1. mysql -uroot -p

password mysql> set global log_bin_trust_function_creators = 0; mysql> quit;

Edit file /etc/zabbix/zabbix_server.conf

DBPassword=password

  1. systemctl restart zabbix-server zabbix-agent httpd php-fpm
  2. systemctl enable zabbix-server zabbix-agent httpd php-fpm

Открыть порт Zabbix server

  1. sudo firewall-cmd --zone=public --add-port=10051/tcp --permanent

Открыть порт Zabbix agent

  1. sudo firewall-cmd --zone=public --add-port=10050/tcp --permanent

Открыть веб-интерфейс (если используется)

  1. sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
  2. sudo firewall-cmd --zone=public --add-port=443/tcp --permanent

Применить изменения

  1. sudo firewall-cmd --reload
  2. sudo firewall-cmd --zone=public --list-ports

open: //ip_address/zabbix

default login password: Admin zabbix

INSTALL ZABBIX Agent on client vm

# rpm -Uvh https://repo.zabbix.com/zabbix/7.0/centos/9/x86_64/zabbix-release-latest-7.0.el9.noarch.rpm
# sudo yum install zabbix-agent
# vim /etc/zabbix/zabbix_agentd.conf

change ip add

ServerActive=127.0.0.1

  1. sudo systemctl restart zabbix-agent.service

{$MACRO} =  variable For check SSL certificate. (run script on VM)

Item:
Key = system.run[command,<mode>]
Key = system.run[/opt/check_cert.sh]
./check_cert.sh
$HOST=example.com
$PORT=443

Config Telegram alerts

Create user: sadmin

Groups: Zabbix administrators

Set password: ********

Permissions => Role (Super admin role)

copy telegram from media type and “enable”

Open telegram:

Bot Father

/newbot

Choose name: azsmart

Username: azsmartm_bot

Copy Token: 8111611674:AAGW9ylV8qj0OV2ehmezV_kB6Qv8ICjRoak

Create group and add IDBot azsmartm_bot and you

then click /getgroupid

Paste Token and GroupID :

P.S. in new version Zabbix 7.0 template was change. For issue downSload telegram template this:

https://github.com/zabbix/zabbix/tree/release/6.0/templates/media/telegram

Choose 6.0 version

Create user, set password:

and set role:

Open Alerts => Actions => Add Conditions (Host group)

Users => Users => select user => Media => Add

Send to: <groupID>