Zabbix

2023-09-18 23:25:30


前言

暂无


一、内网离线安装

1.下载离线RPM包

可在自己电脑双网虚拟机上或者双网linux服务器上下载好离线包。

1.1配置国内镜像源

#使用国内镜像源——阿里云源
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
 
#更改使用国内镜像源
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
 
#清除所有缓存
yum clean all

1.2下载zabbix所需rpm包

--yum --downloadonly参数代表只下载不安装
--下载zabbix-server和zabbix-agent
yum install zabbix-server-mysql zabbix-agent --downloadonly --downloaddir=/tmp/offline_rpm
 
#如报没有downloadonly功能,下载即可
yum install yum-plugin-downloadonly

--下载 Red Hat Software Collections:方便php高版本的安装。
yum install centos-release-scl --downloadonly --downloaddir=/tmp/offline_rpm
 
#安装 Software Collections。
yum install centos-release-scl -y
 
#将[zabbix-frontend]下的 enabled 改为 1.
vi /etc/yum.repos.d/zabbix.repo

[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

--下载 Zabbix前端web软件包。
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl --downloadonly --downloaddir=/tmp/offline_rpm

--下载mariadb
yum install mariadb-server.x86_64 --downloadonly --downloaddir=/tmp/offline_rpm

--创建本地yum源
# 使用createrepo来创建repository仓库
createrepo /tmp/offline_rpm
如报错-bash:createrepo:command not found,则先yum install createrepo -y,运行成功后在/tmp/offline_rpm下会出现repodata文件夹

在这里插入图片描述

2.内网服务器安装zabbix

2.1内网服务器环境准备

将在双网服务器上下载的离线rpm文件夹offline_rpm拷贝到内网服务器/tmp下
修改主机名、关闭防火墙、修改selinux

2.2修改yum源

将原yum源备份,配置本地离线yum源

[root@grafana-server offline_rpm]# cd /etc/yum.repos.d/
[root@grafana-server yum.repos.d]# ls
bak  new.repo
[root@grafana-server yum.repos.d]# cat new.repo 
[New]
name=New
baseurl=file:///tmp/offline_rpm
gpgcheck=0
enabled=1
[root@grafana-server yum.repos.d]#yum clean all

2.3安装

--安装zabbix-server和agent
yum install zabbix-server-mysql zabbix-agent -y
yum install centos-release-scl -y
--上面两部安装完后会多出两个repo,要把他移到bak中
cd /etc/yum.repos.d/
mv CentOS-SCLo-scl* bak/
--安装mariadb
yum -y install perl-DBD-MySQL-4.023-6.el7.x86_64.rpm 
yum -y install mariadb*
--安装web
cd /tmp/offline_rpm
--这里在安装web和apache的时候提示缺少依赖,于是我就将包全都安装了
yum install -y *

2.4配置数据库

#启动
systemctl start mariadb
 
#设置开机自启动
systemctl enable mariadb
 
#查看
systemctl status mariadb

--初始化数据库,配置登录密码
[root@grafana-server offline_rpm]# 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] n
 ... skipping.

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库,编码utf-8
[root@grafana-server offline_rpm]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 5.5.68-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)]> 
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> 
MariaDB [(none)]> create user zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> 
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
--导入zabbix初始库
[root@grafana-server offline_rpm]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: 

2.5配置zabbix_server.conf

--填写zabbix用户数据库密码
vi /etc/zabbix/zabbix_server.conf
DBPassword=zabbix

2.6配置php配置文件

#将注释;去掉,并修改为
#php_value[date.timezone] = Asia/Shanghai
vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf 
php_value[date.timezone] = Asia/Shanghai

2.7启动服务

#启动
systemctl start zabbix-server zabbix-agent httpd rh-php72-php-fpm
 
#设置开机自启动
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
 
#查看
systemctl status zabbix-server zabbix-agent httpd rh-php72-php-fpm

3.配置zabbix web界面

3.1登录web界面输入ip/zabbix进入首次配置界面

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
登录:默认用户名为Admin 密码为zabbix

3.2配置界面为中文

在这里插入图片描述

3.3图形乱码修改

将simhei.ttf放到/usr/share/fonts/dejavu/目录
[root@grafana-server ~]# cd /usr/share/fonts/dejavu/
[root@grafana-server dejavu]# mv DejaVuSans.ttf DejaVuSans.ttf.bak
[root@grafana-server dejavu]# ln -s simhei.ttf DejaVuSans.ttf
刷新web界面即可
在这里插入图片描述

二、agent安装配置

1.agent安装

离线包里有agent的rpm包

[root@nptdb1 soft]# rpm -ivh zabbix-agent-5.0.37-1.el7.x86_64.rpm 
warning: zabbix-agent-5.0.37-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-agent-5.0.37-1.el7        ################################# [100%]
--启动agent
[root@nptdb1 soft]# systemctl start zabbix-agent.service 
[root@nptdb1 soft]# systemctl enable zabbix-agent.service
--配置conf
修改内容如下
# zabbix 服务端地址
Server=101.15.60.34
# zabbix活动服务器地址
ServerActive=101.15.60.34
# 主机名,也就是要监控的那台主机名,在web页面添加主机时需设置相同
hostname=nptdb1
[root@nptdb1 zabbix]# cd /etc/zabbix/
[root@nptdb1 zabbix]# pwd
/etc/zabbix
[root@nptdb1 zabbix]# ls
zabbix_agentd.conf  zabbix_agentd.d
[root@nptdb1 zabbix]# vi zabbix_agentd.conf 

2.web界面主机添加

创建主机
在这里插入图片描述
在这里插入图片描述
选择监控项模板
在这里插入图片描述

添加完成后几分钟后刷新web界面查看主机,ZBX显示为绿色代表监控正常
在这里插入图片描述

zabbix-get安装
下载rpm包,下载地址:http://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/选择对应版本rpm包

[root@grafana-server soft]# ls
bin  conf  sbin  zabbix_agent-5.0.37-linux-3.0-amd64-static.tar.gz  zabbix-get-5.0.37-1.el7.x86_64.rpm
[root@grafana-server soft]# rpm -ivh zabbix-get-5.0.37-1.el7.x86_64.rpm 
warning: zabbix-get-5.0.37-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-get-5.0.37-1.el7          ################################# [100%]
[root@grafana-server soft]# zabbix-get
bash: zabbix-get: command not found...
[root@grafana-server soft]# zabbix_get
usage:
  zabbix_get -s host-name-or-IP [-p port-number] [-I IP-address] -k item-key
  zabbix_get -s host-name-or-IP [-p port-number] [-I IP-address]
                --tls-connect cert --tls-ca-file CA-file
                [--tls-crl-file CRL-file] [--tls-agent-cert-issuer cert-issuer]
                [--tls-agent-cert-subject cert-subject]
                --tls-cert-file cert-file --tls-key-file key-file
                [--tls-cipher13 cipher-string] [--tls-cipher cipher-string]
                -k item-key
  zabbix_get -s host-name-or-IP [-p port-number] [-I IP-address]
                --tls-connect psk --tls-psk-identity PSK-identity
                --tls-psk-file PSK-file [--tls-cipher13 cipher-string]
                [--tls-cipher cipher-string] -k item-key
  zabbix_get -h
  zabbix_get -V

更多推荐

【2023】数据挖掘课程设计:基于TF-IDF的文本分类

目录一、课程设计题目基于TF-IDF的文本分类二、课程设计设置1.操作系统2.IDE3.python4.相关的库三、课程设计目标1.掌握数据预处理的方法,对训练集数据进行预处理;2.掌握文本分类建模的方法,对语料库的文档进行建模;3.掌握分类算法的原理,基于有监督的机器学习方法,训练文本分类器。四、课程设计内容1.数据

【LeetCode-中等题】347. 前 K 个高频元素

文章目录题目方法一:优先队列(基于大顶堆实现)方法二:优先队列(基于小顶堆实现,队列只需维护k个元素)题目方法一:优先队列(基于大顶堆实现)PriorityQueue<int[]>queue=newPriorityQueue<>((a,b)->b[1]-a[1]);优先队列按照队列中的数组的第二个元素从大到小排序((a

华为云云耀云服务器L实例评测|华为云云耀云服务器L实例开展性能评测

作者简介:辭七七,目前大二,正在学习C/C++,Java,Python等作者主页:七七的个人主页文章收录专栏:七七的闲谈欢迎大家点赞👍收藏⭐加关注哦!💖💖华为云云耀云服务器L实例开展性能评测云耀云服务器L实例产品核心卖点评测实例测试环境性能评测指标在MySQL评测场景下的评测数据作为一款专为中小企业和开发者群体设

利用亚马逊 云服务器 EC2 和S3免费套餐搭建私人网盘

网盘是一种在线存储服务,提供文件存储,访问,备份,贡献等功能,是我们日常中不可或缺的一种服务。很多互联网公司都为个人和企业提供免费的网盘服务。但这些免费服务都有一些限制,比如限制下载速度,限制文件大小,不能多人同时管理,不能实现一些定制化功能。如果想取消这些限制,就要付费。现在我给大家介绍一种免费,且功能无限制的私人网

线性代数的本质(七)——特征值和特征向量

特征值和特征向量本章特征值和特征向量的概念只在方阵的范畴内探讨。相似矩阵Grant:线性变换对应的矩阵依赖于所选择的基。一般情况下,同一个线性变换在不同基下的矩阵不同。仍然以平面线性变换为例,Grant选用标准坐标系下的基向量i,j\mathbfi,\mathbfji,j,线性变换TTT对应的矩阵为AAA,而Jenni

Unity 场景淡入淡出效果

一.使用Dotween,建议使用我的方式FindObjectOfType<SceneFadeInAndOut>().FadeIn(()=>{Debug.Log("FadeinMenuStartScene");});usingDG.Tweening;usingSystem;usingSystem.Numerics;usi

干洗店洗鞋店线上下单小程序方便快捷

在线下单是干洗店小程序最直接满足顾客使用需求的一项功能,让顾客能够直观了解到不同规格不同方式清洁衣物干洗的价格并且能够直接在线下单,能够极大缩短消费环节,提升下单可能性,管理后台还能够同步记录顾客订单数据,对门店的日常管理也大有帮助。上门取送的功能也是一个十分适合添加在干洗店小程序里的模块,对于时间或者交通不便的用户来

蓝牙技术|多快好省的苹果Find My查找定位方案商:北京自在科技

在电子市场里,各种蓝牙定位器品牌争奇斗艳,例如国外的TileMate和Slim,三星的GalaxySmartTag和GalaxySmartTag+,Chipolo的ONESpot,还有苹果的AirTag等等。而国内也有着不少优秀的品牌,如Nutale的Air和Pro,VanMoof最S3及X3电动单车,Belkin的S

yamot:一款功能强大的基于Web的服务器安全监控工具

关于yamotyamot是一款功能强大的基于Web的服务器安全监控工具,专为只有少量服务器的小型环境构建。yamot只会占用非常少的资源,并且几乎可以在任何设备上运行。该工具适用于Linux或BSD,当前版本暂不支持Windows平台。比如说,广大研究人员可以使用yamot来监控在家运行的RaspberryPi服务器。

leetcode21合并两个有序链表

题目:将两个升序链表合并为一个新的升序链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。示例1:输入:l1=[1,2,4],l2=[1,3,4]输出:[1,1,2,3,4,4]示例2:输入:l1=[],l2=[]输出:[]示例3:输入:l1=[],l2=[0]输出:[0]提示:两个链表的节点数目范围是[0,5

web端程序访问过慢时如何判断问题

当Web端程序访问过慢时,可以按照以下步骤进行问题判断和排查:1.确认问题:确认Web端程序访问真的过慢,可以通过以下方法进行测试:在不同浏览器和设备上测试访问速度,以排除个别设备或浏览器的问题。在不同时间段进行测试,以排除网络高峰期的影响。确认网络连接是否稳定,可以尝试在多个网络环境下进行测试。2.检查服务器性能:如

热文推荐