[root@compute ~]# cat /etc/redhat-release // 查看系统版本
CentOS Linux release 7.4.1708 (Core)
[root@compute ~]# uname -r // 查看内核版本
3.10.0-693.el7.x86_64
[root@compute ~]# getenforce // 检测selinux是否关闭
Enforcing
[root@compute ~]# vim /etc/selinux/config // 关闭selinux
SELINUX=disabled
Init 6 // 如果是Enforcing 设置后重启
[root@compute ~]# setenforce 0 //临时关闭
[root@compute ~]# systemctl disable firewalld // 关闭防火墙开机自启动
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@compute ~]# systemctl stop firewalld // 关闭防火墙
1)安装数据库
[root@compute ~]# yum install -y mariadb-server
[root@compute ~]systemctl start mariadb
2)设root用户密码
[root@compute ~]# mysqladmin -u root password 123456
初始化zabbix库、表用户
1、[root@compute ~]# mysql -u root –p123456
2、MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
3、MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
4、MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@compute identified by 'zabbix';
5、\q;
1)安装zabbix的yum源
[root@compute ~]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-local.repo CentOS-Sources.repo
[root@compute ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
[root@compute ~]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-local.repo CentOS-Sources.repo zabbix.repo
[root@compute ~]# cat /etc/yum.repos.d/zabbix.repo
显示:
[zabbix]
name=Zabbix Official Repository - b a s e a r c h b a s e u r l = h t t p : / / r e p o . z a b b i x . c o m / z a b b i x / 3.4 / r h e l / 7 / basearch baseurl=http://repo.zabbix.com/zabbix/3.4/rhel/7/ basearchbaseurl=http://repo.zabbix.com/zabbix/3.4/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 - b a s e a r c h b a s e u r l = h t t p : / / r e p o . z a b b i x . c o m / n o n − s u p p o r t e d / r h e l / 7 / basearch baseurl=http://repo.zabbix.com/non-supported/rhel/7/ basearchbaseurl=http://repo.zabbix.com/non−supported/rhel/7/basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
2)安装:
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent
3)初始化zabbix数据
[root@compute ~]# zcat /usr/share/doc/zabbix-server-mysql-3.4.13/create.sql.gz |mysql -u zabbix -pzabbix zabbix
[root@compute ~]# mysql -uroot –p123456 -e "use zabbix;show databases;"
显示:
±-------------------+
| Database |
±-------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| zabbix |
±-------------------+
4)在Zabbix_server.conf编辑数据库配置
[root@compute ~]# vim /etc/zabbix/zabbix_server.conf
[root@compute ~]# grep -vE "^#|^$" /etc/zabbix/zabbix_server.conf
显示:
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
5)启动zabbix服务器进程
[root@compute ~]# systemctl enable zabbix-server
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
[root@compute ~]# systemctl start zabbix-server
[root@compute ~]# systemctl status zabbix-server
6)编辑zabbix前端php配置
vi /etc/httpd/conf.d/zabbix.conf
添加以下:
php_value date.timezone Asia/Shanghai
7)改变配置文件后,启动Apache Web服务器
[root@compute ~]# systemctl start httpd
[root@compute ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
1)http://10.10.20.74/zabbix/setup.php
安装向导一:
安装向导二:
安装向导三:
安装向导四:
安装向导五,回顾概要:
安装向导,成功提示:
Zabbix登录准备。默认用户名/密码为Admin/zabbix
在上面博客中我们已经安装了zabbix的server端,如果我们需要对某台机器进行监控,还需要在被监控的机器上面安装客户端,这样才能进行监控,下面就给大家介绍一下agent端的安装教程
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
yum install zabbix-agent
vi /etc/zabbix/zabbix_agentd.conf
修改此文件中的下面三个值:
Server=192.168.92.8 //安装zabbix服务端的机器的IP
ServerActive=192.168.92.8 //安装zabbix服务端的机器的IP
Hostname=09 //被监控的机器的ip作为Hostname
关闭 防火墙 stop firewalld.service
关闭SELinux setenforce 0
systemctl start zabbix-agent
1、进入UI界面—》配置—》主机—》创建主机
2、进入下面编辑页面 ip地址一定要填写正确,
3、填写完上面的主机信息以后,要选择一个模板
点击选择以后 在弹出的选择列表中选择Template OS Linux
选择完模板以后,首先点击模板页面中那个比较小一点的“添加”,然后在点击那个大一点的添加!
下面看监控的效果图形:
还可以将多个监控项在一个页面进行展示
点击添加以后
点击构造函数,然后点击更改后,完成聚合图形的构建。
点击选择后,进行主机和监控项的选择,在一个聚合图形中可以同时展现多个主机和多个监控项的监控