Установка и настройка Zabbix: Difference between revisions

From wiki.baghirzade.pro
Jump to navigation Jump to search
Created page with "'''INSTALL ZABBIX''' zabbix version: 7.0 os: CentOS version: 9 stream zabbix component: Server, Frontend, Agent database: mysql webserver: apache<pre> # 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 mariad..."
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''INSTALL ZABBIX'''
'''<big>INSTALL ZABBIX</big>'''


zabbix version: 7.0
zabbix version: 7.0
Line 32: Line 32:


</pre><pre>
</pre><pre>
# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
#zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
</pre><pre>
</pre><pre>
# mysql -uroot -p
# mysql -uroot -p
Line 57: Line 57:
default login password: Admin zabbix
default login password: Admin zabbix


'''INSTALL ZABBIX Agent on client vm'''<pre>
'''<big>INSTALL ZABBIX Agent on client vm</big>'''<pre>
# rpm -Uvh https://repo.zabbix.com/zabbix/7.0/centos/9/x86_64/zabbix-release-latest-7.0.el9.noarch.rpm
# 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
# sudo yum install zabbix-agent
Line 74: Line 74:
$HOST=example.com
$HOST=example.com
$PORT=443
$PORT=443
</pre>'''Config Telegram alerts'''
</pre>'''<big>Config Telegram alerts</big>'''


Create user: sadmin
Create user: sadmin
Line 101: Line 101:


then click '''''/getgroupid'''''
then click '''''/getgroupid'''''
[[File:Zabbix1.jpg|center|thumb|1099x1099px]]
[[File:Zabbix2.jpg|center|thumb|1097x1097px]]
'''Paste Token and GroupID''' :
P.S. in new version Zabbix 7.0 template was change. For issue download telegram template this:
<nowiki>https://github.com/zabbix/zabbix/tree/release/6.0/templates/media/telegram</nowiki>
Choose 6.0 version or
[https://git.initmax.cz/zabbix/zabbix/-/blob/78774f702f8d222235c6e5a8b27db9490386c2e9/templates/media/telegram/media_telegram.yaml Zabbix Telegram Template]
[[File:Zabbix3.jpg|center|thumb|941x941px]]
Create user, set password:
[[File:Zabbix4.jpg|center|thumb|972x972px]]
and set role:
[[File:Zabbix5.jpg|center|thumb|988x988px]]
Open Alerts => Actions => Add Conditions (Host group)
[[File:Zabbix6.jpg|center|thumb|992x992px]]
[[File:Zabbix7.jpg|center|thumb|995x995px]]
[[File:Zabbix8.jpg|center|thumb|952x952px]]
Users => Users => select user => Media => Add
Send to: <groupID>
[[File:Zabbix9.jpg|center|thumb|1000x1000px]]

Latest revision as of 06:07, 14 October 2025

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 download telegram template this:

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

Choose 6.0 version or

Zabbix Telegram Template

Create user, set password:

and set role:

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

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

Send to: <groupID>