当前位置:网站首页>ZABBIX deployment and monitoring
ZABBIX deployment and monitoring
2022-07-29 00:42:00 【Palm nine】
One 、 Deploy zabbix service
operating system ——RockyLinux8.6
Configure domestic yum Source and backup the original yum Source
http://t.zoukankan.com/wswind-p-15469768.html
Close the firewall and selinux
Install common software
[[email protected] ~]# yum install lrzsz wget vim net-tools tree psmisc bash-completion dos2unix -y
Time synchronization
[[email protected] ~]# yum install chrony -y
[[email protected] ~]# vim /etc/chrony.conf
[[email protected] ~]# systemctl restart chronyd
[[email protected] ~]# systemctl enable chronyd
[[email protected] ~]# chronyc sources
Shutdown for snapshot
RPM Package installation
1. configuration setup yum Source
[[email protected] ~]# dnf localinstall https://repo.huaweicloud.com/zabbix/zabbix/5.4/rhel/8/x86_64/zabbix-release-5.4-1.el8.noarch.rpm
[[email protected] yum.repos.d]# vim zabbix.repo
[[email protected] yum.repos.d]# cat zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://repo.zabbix.com/zabbix/5.4/rhel/8/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://repo.zabbix.com/non-supported/rhel/8/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
>>>>>>>>>>>>>> modify url<<<<<<<<<<<<<<
[[email protected] yum.repos.d]# sed -i 's#https://repo.zabbix.com#https://repo.huaweicloud.com/zabbix#' /etc/yum.repos.d/zabbix.repo
[[email protected] yum.repos.d]# cat zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://repo.huaweicloud.com/zabbix/zabbix/5.4/rhel/8/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://repo.huaweicloud.com/zabbix/non-supported/rhel/8/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
2. install zabbix server
Filter to see zabbix
[[email protected] ~]# dnf install -y zabbix-server-mysql
3. install zabbix agent
[[email protected] ~]# dnf install -y zabbix-agent2
4. install zabbix web
[[email protected] ~]# dnf install -y zabbix-web-mysql httpd zabbix-apache-conf zabbix-sql-scripts.noarch
5. mount this database
[[email protected] ~]# dnf install -y mariadb-server
6. Deploy database
Start database
[[email protected] ~]# systemctl enable --now mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
-----------------------------------------------------
Configuration database
[[email protected] ~]# mysql -e "create database zabbix character set utf8 collate utf8_bin;"
[[email protected] ~]# mysql -e "create user 'zabbix'@'localhost' identified by 'zabbix';"
[[email protected] ~]# mysql -e "grant all privileges on zabbix.* to 'zabbix'@'localhost';"
[[email protected] ~]# mysql
mysql mysqld_multi mysql_fix_extensions mysql_setpermission
mysqlaccess mysqld_safe mysqlhotcopy mysqlshow
mysqladmin mysqld_safe_helper mysqlimport mysqlslap
mysqlbinlog mysqldump mysql_install_db mysql_tzinfo_to_sql
mysqlcheck mysqldumpslow mysql_plugin mysql_upgrade
mysql_convert_table_format mysql_find_rows mysql_secure_installation mysql_waitpid
[[email protected] ~]# 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!
All selection in the back YES
--------------------------------------------
Log in to the database
[[email protected] ~]# mysql -uroot -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.3.32-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> grant all privileges on zabbix.* to [email protected] identified by 'zabbix';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> \q
Bye
Import data
[[email protected] ~]# rpm -ql zabbix-sql-scripts
/usr/share/doc/zabbix-sql-scripts
/usr/share/doc/zabbix-sql-scripts/AUTHORS
/usr/share/doc/zabbix-sql-scripts/COPYING
/usr/share/doc/zabbix-sql-scripts/ChangeLog
/usr/share/doc/zabbix-sql-scripts/NEWS
/usr/share/doc/zabbix-sql-scripts/README
/usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz
/usr/share/doc/zabbix-sql-scripts/mysql/double.sql
/usr/share/doc/zabbix-sql-scripts/mysql/schema.sql.gz
/usr/share/doc/zabbix-sql-scripts/postgresql/create.sql.gz
/usr/share/doc/zabbix-sql-scripts/postgresql/double.sql
/usr/share/doc/zabbix-sql-scripts/postgresql/schema.sql.gz
/usr/share/doc/zabbix-sql-scripts/postgresql/timescaledb.sql.gz
/usr/share/doc/zabbix-sql-scripts/sqlite3/schema.sql.gz
[[email protected] ~]# cd /usr/share/doc/zabbix-sql-scripts/mysql/
[[email protected] mysql]# ll
total 2492
-rw-r--r-- 1 root root 2529922 Apr 4 20:17 create.sql.gz
-rw-r--r-- 1 root root 282 Apr 4 20:17 double.sql
-rw-r--r-- 1 root root 14827 Apr 4 20:17 schema.sql.gz
[[email protected] mysql]# zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -uzabbix -pzabbix zabbix
[[email protected] mysql]# mysql -uzabbix -pzabbix zabbix
MariaDB [zabbix]> show tables;
+----------------------------+
| Tables_in_zabbix |
+----------------------------+
| acknowledges |
| actions |
..........................
| valuemap_mapping |
| widget |
| widget_field |
+----------------------------+
166 rows in set (0.001 sec)
MariaDB [zabbix]> \q
Bye
7. by zabbix server Configuration database
[[email protected] ~]# vim /etc/zabbix/zabbix_server.conf
Just modify the next two items
### Option: DBHost
# Database host name.
# If set to localhost, socket is used for MySQL.
# If set to empty string, socket is used for PostgreSQL.
# If set to empty string, the Net Service Name connection method is used to connect to Oracle database; also see
# the TNS_ADMIN environment variable to specify the directory where the tnsnames.ora file is located.
#
# Mandatory: no
# Default:
DBHost=localhost
### Option: DBPassword
# Database password.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword=zabbix
Filter to see
[[email protected] ~]# grep ^DB /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
8. Start the service ,web Interface installation
[[email protected] ~]# systemctl enable --now httpd.service php-fpm.service zabbix-server.service zabbix-agent2.service
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service → /usr/lib/systemd/system/zabbix-server.service.
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service → /usr/lib/systemd/system/zabbix-agent2.service.
[[email protected] ~]# ll /usr/share/zabbix/assets/fonts/
total 0
lrwxrwxrwx 1 root root 33 Jul 28 19:33 graphfont.ttf -> /etc/alternatives/zabbix-web-font
[[email protected] ~]# ll /etc/alternatives/zabbix-web-font
lrwxrwxrwx 1 root root 38 Jul 28 19:33 /etc/alternatives/zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf
[[email protected] ~]# cd /usr/share/fonts/dejavu
Go to the local computer C:\Windows\Fonts Used in this paper “ Imitation song routine “ Copy to the desktop and then xshell Pass on
[[email protected] dejavu]# rz -E
rz waiting to receive.
[[email protected] dejavu]# ll
total 15848
-rw-r--r-- 1 root root 641716 May 17 2015 DejaVuSans-BoldOblique.ttf
-rw-r--r-- 1 root root 704128 May 17 2015 DejaVuSans-Bold.ttf
-rw-r--r-- 1 root root 610260 May 17 2015 DejaVuSansCondensed-BoldOblique.ttf
-rw-r--r-- 1 root root 663468 May 17 2015 DejaVuSansCondensed-Bold.ttf
-rw-r--r-- 1 root root 597708 May 17 2015 DejaVuSansCondensed-Oblique.ttf
-rw-r--r-- 1 root root 679256 May 17 2015 DejaVuSansCondensed.ttf
-rw-r--r-- 1 root root 355204 May 17 2015 DejaVuSans-ExtraLight.ttf
-rw-r--r-- 1 root root 633836 May 17 2015 DejaVuSans-Oblique.ttf
-rw-r--r-- 1 root root 756072 May 17 2015 DejaVuSans.ttf
-rw-r--r-- 1 root root 10578152 Oct 15 2019 simfang.ttf
[[email protected] dejavu]# mv DejaVuSans.ttf{,.bak}
[[email protected] dejavu]# mv simfang.ttf DejaVuSans.ttf
Two 、 install zabbix-agent monitor linux and windows.
monitor linux
client
Turn on one centos7
Close the firewall and selinux
[[email protected] ~]# getenforce
Disabled
[[email protected] ~]# firewall-cmd --state
not running
download 7 Version of zabbix
[[email protected] ~]# yum localinstall https://repo.huaweicloud.com/zabbix/zabbix/5.4/rhel/7/x86_64/zabbix-agent2-5.4.0-8.el7.x86_64.rpm
[[email protected] ~]# vim /etc/zabbix/zabbix_agent2.conf
### Option: Server
# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies.
# Incoming connections will be accepted only from the hosts listed here.
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
# and '::/0' will allow any IPv4 or IPv6 address.
# '0.0.0.0/0' can be used to allow any IPv4 address.
# Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
#
# Mandatory: yes, if StartAgents is not explicitly set to 0
# Default:
# Server=
Server=192.168.43.116
-------------------------------------------------------------------------------------------------------------------------------------------------------------
### Option: ServerActive
# List of comma delimited IP:port (or DNS name:port) pairs of Zabbix servers and Zabbix proxies for active checks.
# If port is not specified, default port is used.
# IPv6 addresses must be enclosed in square brackets if port for that host is specified.
# If port is not specified, square brackets for IPv6 addresses are optional.
# If this parameter is not specified, active checks are disabled.
# Example: ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
#
# Mandatory: no
# Default:
# ServerActive=
ServerActive=192.168.43.116
-------------------------------------------------------------------------------------------------------------------------------------------------------------
### Option: Hostname
# List of comma delimited unique, case sensitive hostnames.
# Required for active checks and must match hostnames as configured on the server.
# Value is acquired from HostnameItem if undefined.
#
# Mandatory: no
# Default:
# Hostname=
Hostname=localhost
==========================================================================================
Start the service and set it to start from
[[email protected] ~]# systemctl enable --now zabbix-agent2.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service to /usr/lib/systemd/system/zabbix-agent2.service.
[[email protected] ~]# netstat -lnupt | grep 10050
tcp6 0 0 :::10050 :::* LISTEN 1489/zabbix_agent2
Server side
[[email protected] ~]# dnf install zabbix-get.x86_64
monitor windows
A little
边栏推荐
- 动态规划问题(四)
- PTA (daily question) 7-72 calculate the cumulative sum
- Download the latest version of visual studio code and connect to the server remotely (very detailed)
- What does the expression > > 0 in JS mean
- PTA (daily question) 7-75 how many people in a school
- The 30th day of question brushing
- @Detailed explanation of postconstruct annotation
- @Detailed explanation of the use of transactional annotation
- How to solve Oracle not available
- rk3399 9.0驱动添加Powser按键
猜你喜欢
Oracle实例无法启动的问题如何解决
[development tutorial 10] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - Bluetooth ble transceiver
Google browser, no installation required
【微服务~Nacos】Nacos服务提供者和服务消费者
2022DASCTF7月赋能赛(复现)
动态规划问题(五)
PTA (daily question) 7-70 diamond
数仓搭建——DWT层
【开发教程11】疯壳·开源蓝牙心率防水运动手环-整机功能代码讲解
Table custom style row class name in elemenui
随机推荐
Cause analysis of 12 MySQL slow queries
I was asked several questions about string in the interview. Can you answer them?
MySQL事务(transaction) (有这篇就足够了..)
Soft test --- database (4) SQL statement
Advanced area of attack and defense world web masters unserialize3
Alibaba code index technology practice: provide reading experience of local IDE for code review
刷题的第三十天
vulnhub:BTRSys2
PTA (daily question) 7-74 yesterday
vulnhub:SolidState
Longest ascending subsequence
Flask sends verification code in combination with Ronglian cloud
芯驰科技发布G9系列最新旗舰产品,配备6个1.8Ghz主频的A55核心
Solutions such as failed plug-in installation and slow speed of linking remote server under vscode
Attack and defense world web master advanced area web_ php_ include
2022dasctfjuly empowerment competition (reappearance)
Oracle实例无法启动的问题如何解决
@Detailed explanation of postconstruct annotation
Nftscan and nftplay have reached strategic cooperation in the field of NFT data
1331. Array sequence number conversion: simple simulation question