1.zabbix4.0监控系统部署
zabbix4.0软件分为:zabbix-server-mysql zabbix-web-mysql
这里虽然是-mysql但是不是安装的数据库哟,而是这个zabbix将来使用什么版本的数据库,可以是postgresql也可以是mysql
预先配置
[root@zabbix-server ~]# setenforce 0 [root@zabbix-server ~]# sed -ri '/^SELINUX=/c SELINUX=disabled' /etc/sysconfig/selinux [root@zabbix-server ~]# sed -ri '/^SELINUX=/c SELINUX=disabled' /etc/selinux/config [root@zabbix-server ~]# systemctl stop firewalld [root@zabbix-server ~]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
1.1.zabbix4.0安装
1.获取zabbix4.0镜像源 [root@zabbix-server ~]# wget http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm 2.安装镜像源 [root@zabbix-server ~]# rpm -ivh zabbix-release-4.0-1.el7.noarch.rpm 安装完成后/etc/yum.repos.d/会多出来镜像文件 [root@zabbix-server ~]# ls /etc/yum.repos.d/ zabbix.repo 3.修改镜像文件base地址为清华园 [root@zabbix-server ~]# vim /etc/yum.repos.d/zabbix.repo [zabbix] name=Zabbix Official Repository - $basearch baseurl=http://mirror.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/$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=http://mirror.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/$basearch/ enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX gpgcheck=1 4.开启yum缓存方便以后复用 [root@zabbix-server ~]# vim /etc/yum.conf keepcache=1 5.安装zabbix4.0软件 [root@zabbix-server ~]# yum -y install zabbix-server-mysql zabbix-web-mysql --downloaddir=/root
1.2.zabbix数据库配置
1.安装mysql [root@zabbix-server ~]# yum -y install mariadb-server 2.启动数据库 [root@zabbix-server ~]# systemctl start mariadb.service [root@zabbix-server ~]# systemctl enable mariadb.service 3.mysql安全配置,回车、n、一路y [root@zabbix-server ~]# mysql_secure_installation Enter current password for root (enter for none): OK, successfully used password, moving on... Set root password? [Y/n] n ... skipping. Remove anonymous users? [Y/n] y ... Success! Disallow root login remotely? [Y/n] y ... Success! Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reload privilege tables now? [Y/n] y ... Success! 4.创建数据库并授权 [root@zabbix-server ~]# mysql MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'%' identified by '123456'; 授权root用户远程登录并使用Navicat去查看数据库 MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option; 5.导入zabbix SQL [root@zabbix-server ~]# zcat /usr/share/doc/zabbix-server-mysql-4.0.24/create.sql.gz | mysql -uroot -p123456 zabbix 扩展:zcat可以看到压缩包中的文件内容,但是必须压缩包中只有一个文件
使用Navicat查看导入的sql
1.3.配置zabbix server
1.修改zabbix server配置文件 [root@zabbix-server ~]# vim /etc/zabbix/zabbix_server.conf DBHost=192.168.81.210 DBName=zabbix DBUser=zabbix DBPassword=123456 整个配置文件内容 [root@zabbix-server ~]# cat /etc/zabbix/zabbix_server.conf | egrep -v '^$|^#' LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=0 PidFile=/var/run/zabbix/zabbix_server.pid SocketDir=/var/run/zabbix DBHost=192.168.81.210 DBName=zabbix DBUser=zabbix DBPassword=123456 SNMPTrapperFile=/var/log/snmptrap/snmptrap.log Timeout=4 AlertScriptsPath=/usr/lib/zabbix/alertscripts ExternalScripts=/usr/lib/zabbix/externalscripts LogSlowQueries=3000 2.启动zabbix-server [root@zabbix-server ~]# systemctl start zabbix-server.service [root@zabbix-server ~]# systemctl enable zabbix-server.service
1.4.配置zabbix web
1.设置时区 [root@zabbix-server ~]# vim /etc/httpd/conf.d/zabbix.conf <IfModule mod_php5.c> php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 2M php_value max_input_time 300 php_value max_input_vars 10000 php_value always_populate_raw_post_data -1 php_value date.timezone Asia/Shanghai </IfModule> 2.重启httpd [root@zabbix-server ~]# systemctl start httpd [root@zabbix-server ~]# systemctl enable httpd
2页面安装zabbix
2.1.访问zabbix
http://192.168.81.210/zabbix/setup.php
点击next step
2.2.检查环境
检查系统的安装环境
2.3.配置数据库
填写数据库信息
2.4.配置server
随便起名字
2.5.配置明细
2.6.安装完成
2.7.登录zabbix
默认账号Admin 默认密码zabbix
登录后显示首页仪表盘
2.8.设置中文格式
点击管理员—语言—中文
![在这里插入图片描述](https://ucc.alicdn.com/images/user-upload-01/20201230113353468.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NDk1MzY1OA==,size_16,color_FFFFFF,t_70
中文显示