公司网站建设沈阳,好丹东网,wordpress云端采集,网站域名申请程序一.Zabbix服务介绍
1.1服务介绍
Zabbix是基于WEB界面的分布式系统监控的开源解决方案#xff0c;Zabbix能够监控各种网络参数#xff0c;保证服务器系统安全稳定的运行#xff0c;并提供灵活的通知机制让SA快速定位并解决存在的各种问题。
1.2 Zabbix优点 Zabbix分布式监…一.Zabbix服务介绍
1.1服务介绍
Zabbix是基于WEB界面的分布式系统监控的开源解决方案Zabbix能够监控各种网络参数保证服务器系统安全稳定的运行并提供灵活的通知机制让SA快速定位并解决存在的各种问题。
1.2 Zabbix优点 Zabbix分布式监控系统的优点如下 支持自动发现服务器和网络设备支持底层自动发现分布式的监控体系和集中式的WEB管理支持主动监控和被动监控模式服务器端支持多种操作系统Agent客户端支持多种操作系统基于SNMP、IPMI接口方式、Agent方式安全的用户认证和权限配置基于WEB的管理方法支持自定义事件和邮件、短信发送高水平的业务视图监控资源支持日志审计资产管理等功能支持高水平API二次开发、脚本监控、自Key定义、自动化运维整合调用 二.实验环境
虚拟机VMware 系统版本
[rootlocalhost ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)关闭安全上下文
[rootlocalhost ~]# setenforce 0虚拟机IP
[rootlocalhost ~]# hostname -I
192.168.196.128 192.168.122.1 是否可以ping通服务
[rootlocalhost ~]# ping -c1 -w 1 www.baidu.com
PING www.a.shifen.com (14.119.104.189) 56(84) bytes of data.
64 bytes from 14.119.104.189 (14.119.104.189): icmp_seq1 ttl53 time36.5 ms清空防火墙规则
[rootlocalhost ~]# iptables -F以上环境都布置好之后就可开始安装Zabbix服务了。
三.部署Zabbix监控
3.1 安装LAMP环境所需要的软件包
yum install httpd httpd-devel mariadb mariadb-server php php-mysql php-devel php-common php-gd php-mbstring php-xml php-bcmath php-cli php-pear -y当然为了防止有些包可能为安装上可以多执行一次上面的命令。 安装好之后可以看看包是不是都已经安装了。 都安装了之后继续执行下一步操作。
3.2 下载Zabbix软件包
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm点击安装之后进度条到了100%说明是已经成功了。 如果需要下载其他Zabbix的rpm包可以到Zabbix官网去找。 Zabbix官网的repo源–点击这里 Zabbix的rpm包下载好后可以开始安装Zabbix一系列程序了。
3.3 安装Zabbix程序
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y因为使用的是Zabbix官网的源安装过程中会有些许慢可以稍微等一会当然也可直接替换使用国内的源。
3.4 启动Apache和数据库
启动Apache和数据库服务是为了下一步做准备。
systemctl start httpd mariadb
systemctl enable httpd mariadb3.5 创建数据库密码授权
很奇怪这一步为什么不需要找mysql的初始密码因为安装的mariadb不用找密码可以直接进入数据库的。
[rootlocalhost ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type help; or \h for help. Type \c to clear the current input statement.
#创建zabbix的数据库并且需要将字符集做修改否则在网页上会显示默认的字符集不正确
MariaDB [(none)] create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
#授权数据库并且设置账号密码
MariaDB [(none)] grant all on zabbix.* to zabbixlocalhost identified by GUANzhu123//;
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)] exit
Bye错误示范
3.6 导入基础数据库
-p接的密码填写之前创建数据库的密码
zcat /usr/share/doc/zabbix-server-mysql-4.0.44/create.sql.gz|mysql -uzabbix -pGUANzhu123// zabbix等待片刻后可以重新进入数据库查看Zabbix数据是否成功导入到数据库了。
[rootlocalhost ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.68-MariaDB MariaDB ServerCopyright (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)] use zabbix
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
MariaDB [zabbix] show tables;
----------------------------
| Tables_in_zabbix |
----------------------------
| acknowledges |
| actions |
| alerts |
| application_discovery |
| application_prototype |
| application_template |
| applications |
| auditlog |
| auditlog_details |
| autoreg_host |......#一共有144个表为了方便查看我删除了一些
----------------------------
144 rows in set (0.00 sec)MariaDB [zabbix] exit
Bye到这里Zabbix监控服务已经是配置好一大半了。
3.7 修改Zabbix配置文件
还记得之前授权数据库的信息不 配置文件的时候需要用到分别是这三个值 DBNamezabbix DBUserzabbix DBPasswordGUANzhu123// 这里密码填写您自己设置的密码
#Zabbix配置文件在这里若不记得可以使用这个查看
[rootlocalhost ~]# rpm -qc zabbix-server-mysql
/etc/logrotate.d/zabbix-server
/etc/zabbix/zabbix_server.conf
[rootlocalhost ~]# vim /etc/zabbix/zabbix_server.conf
[rootlocalhost ~]# grep DBPassword !$
grep DBPassword /etc/zabbix/zabbix_server.conf
### Option: DBPassword
DBPasswordGUANzhu123//3.8修改Zabbix文件
注意这里是还需要修改一个文件的要将PHP的时区修改成上海。
[rootlocalhost ~]# grep timezone !$
grep timezone /etc/httpd/conf.d/zabbix.confphp_value date.timezone Asia/Shanghai将配置文件的20行信息改成下面的Asia/Shanghai 忘记修改php的时区在网页上就会显示这个内容。 3.9 重启服务
systemctl restart httpd zabbix-server zabbix-agent 到这里已经不需要在虚拟机上配置了在网页上执行试试吧 四.网页部署
#在网页上输入您本地的IP/zabbix/即可访问监控ZABBIX默认的账号密码是 UsernameAdmin Passwordzabbix 总结
搭建Zabbix4.0的步骤就是这么多可以尝试看看能不能搭建属于您自己的监控若觉得内容还行的可以点赞支持一下