Centos 7 搭建 Zabbix
来源:互联网 发布:iphone刷机后 数据恢复 编辑:程序博客网 时间:2024/05/18 23:53
背景不多说,直接上干货!
Zabbix-Server端:
关闭SELinux
[root@localhost ~]# setenforce 0 //临时修改,重启失效修改配置文件:/etc/selinux/configSELINUX=enforcing 改成 SELINUX= disabled
关闭防火墙
[root@localhost ~]# systemctl stop firewalld //关闭防火墙[root@localhost ~]# systemctl disable firewalld //开机不启动防火墙
删除原来配置的yum源
[root@localhost ~]# rm -rf /etc/yum.repos.d/* //删除其他yum源
配置阿里云 yum源
[root@localhost ~]# vi /etc/yum.repos.d/zabbix.repo[os]name=osbaseurl=https://mirrors.aliyun.com/centos/7/os/x86_64/gpgcheck=0enabled=1[non-supported]name=non-supportedbaseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/x86_64/gpgcheck=0enabled=1[zabbix]name=zabbix 3.2baseurl=https://mirrors.aliyun.com/zabbix/zabbix/3.2/rhel/7/x86_64/gpgcheck=0enabled=1
重新缓存yum源
[root@localhost ~]yum clean all[root@localhost ~]yum repolist
安装zabbix-server
[root@localhost ~]# yum install -y zabbix-server-mysql zabbix-web-mysql
安装数据库
[root@localhost ~]# yum groupinstall -y mariadb mariadb-client
在[mysqld]下添加character-set-server=utf8 ##设置字符集innodb_file_per_table=1 ##让innodb每个表文件单独存放
启动mariadb数据库
[root@localhost ~]# systemctl enable mariadb
[root@localhost ~]# systemctl start mariadb
交互式界面初始化数据库
[root@localhost ~]# mysql_secure_installation
创建zabbix库
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; ##创库时设置好字符集问题
创建数据库用户及配置用户权限
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'redhat';
重载权限表
MariaDB [(none)]> flush privileges;
查找数据库文件
[root@localhost ~]# rpm -ql zabbix-server-mysql/usr/share/doc/zabbix-server-mysql-3.2.4/create.sql.gz
解压(可用file 查看文件类型)
[root@localhost zabbix-server-mysql-3.2.4]# gzip -d create.sql.gz
导入
[root@localhost zabbix-server-mysql-3.2.4]# mysql -uroot -predhat ##登录数据库MariaDB [(none)]> use zabbix; ##切换到zabbix库MariaDB [zabbix]> source create.sql ##导入数据,当前路径为进数据库时使用的路径
修改zabbix配置文件(zabbix_server.conf)
[root@localhost zabbix-server-mysql-3.2.4]# vi /etc/zabbix/zabbix_server.conf
DBName=zabbixDBUser=zabbixDBPassword=redhatDBSocket=/var/lib/mysql/mysql.sock
启动 zabbix-server
[root@localhost zabbix-server-mysql-3.2.4]# systemctl enable zabbix-server[root@localhost zabbix-server-mysql-3.2.4]# systemctl start zabbix-server
启动失败,查看日志显示
[root@localhost ~]# journalctl -xn-- Logs begin at Fri 2017-04-21 03:56:34 CST, end at Fri 2017-04-21 04:50:18 CST. --Apr 21 04:50:08 localhost.localdomain systemd[1]: zabbix-server.service: control process exited, code=killed status=11Apr 21 04:50:08 localhost.localdomain systemd[1]: Failed to start Zabbix Server.-- Subject: Unit zabbix-server.service has failed-- Defined-By: systemd-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel-- -- Unit zabbix-server.service has failed.-- -- The result is failed.Apr 21 04:50:08 localhost.localdomain systemd[1]: Unit zabbix-server.service entered failed state.Apr 21 04:50:18 localhost.localdomain systemd[1]: zabbix-server.service holdoff time over, scheduling restart.Apr 21 04:50:18 localhost.localdomain systemd[1]: Stopping Zabbix Server...-- Subject: Unit zabbix-server.service has begun shutting down-- Defined-By: systemd-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel-- -- Unit zabbix-server.service has begun shutting down.Apr 21 04:50:18 localhost.localdomain systemd[1]: Starting Zabbix Server...-- Subject: Unit zabbix-server.service has begun with start-up-- Defined-By: systemd-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel-- -- Unit zabbix-server.service has begun starting up.Apr 21 04:50:18 localhost.localdomain kernel: zabbix_server[2393]: segfault at 18 ip 00007fd42784dc00 sp 00007ffffedf7868 error 4 in libpthread-2.17.so[7fd4278Apr 21 04:50:18 localhost.localdomain systemd[1]: zabbix-server.service: control process exited, code=killed status=11Apr 21 04:50:18 localhost.localdomain systemd[1]: Failed to start Zabbix Server.-- Subject: Unit zabbix-server.service has failed-- Defined-By: systemd-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel-- -- Unit zabbix-server.service has failed.-- -- The result is failed.Apr 21 04:50:18 localhost.localdomain systemd[1]: Unit zabbix-server.service entered failed state.
这是由于trousers版本过低导致,升级trousers
yum update trousers
在此启动 zabbix-server
root@localhost ~]# systemctl start zabbix-server
修改时区
[root@localhost ~]# vi /etc/httpd/conf.d/zabbix.conf
Alias /zabbix /usr/share/zabbix<Directory "/usr/share/zabbix"> Options FollowSymLinks AllowOverride None # php_value date.timezone Europe/Riga ##删掉注释符,修改时区为 Asia/Shanghai </IfModule></Directory>
重启Apache
[root@localhost ~]# systemctl restart httpd
在浏览器中打开URL(IP为server端地址)
http://192.168.0.104/zabbix/
按照提示填写相关信息
右边显示的OK必须全部OK方可下一步,否则检查环境是否出错
数据库信息
服务端信息:Host填hostname或IP地址,端口为服务端开放的zabbix端口(默认10051),Name为自定义名称
安装概述
安装完成
登录用户名为Admin,密码为zabbix
登录之后的界面
client端(zabbix-agent)
客户端安装代理
yum install -y zabbix-agent
修改配置文件 zabbix_agentd.conf
Server=192.168.0.104 //被动模式,服务器取数据ServerActive=192.168.0.104:10051 //主动模式,主动向服务器监听端口推送数据Hostname=Client01 //可与本机hostname不一样
开启代理服务
[root@client ~]#systemctl enable zabbix-agent[root@client ~]#systemctl start zabbix-agent
Server端通过前台页面添加Client
完成后记得点Add按钮
在仪表盘页面可以看到新添加的主机Client
0 0
- Centos 7 搭建 Zabbix
- Centos 7下搭建Zabbix监控软件
- CentOS 6.5 搭建 Zabbix
- CentOS 企业级 ----Zabbix 搭建
- centos 7 安装zabbix
- CentOS 7.2下搭建Zabbix 3.2.6
- CentOS 7下【zabbix-agent】
- CentOS 7 yum安装Zabbix
- CentOS 7源码安装zabbix
- CentOS 7 yum安装Zabbix
- CentOS 7 yum安装Zabbix
- CentOS 7 部署zabbix-3.4
- centos 7 安装 zabbix过程
- Zabbix搭建笔记[7]--触发器
- CentOS 6.5 LNMP架构Zabbix 3.2.4监控端搭建
- zabbix搭建
- CentOS 7安装zabbix-2.4.8监控
- CentOS 7 yum install zabbix 2.4
- ArrayList源码解析
- 关于Stage3D中Matrix3D
- Jquery中AJAX参数详细介绍
- MVP架构在Android平台上的实现分析
- SpringBoot介绍
- Centos 7 搭建 Zabbix
- 【机器学习】贝叶斯角度看L1,L2正则化
- Servlet学习记录2: java.lang.NullPointerException
- Const 类型
- 机器学习之最大似然算法
- Unix进程之进程概述
- mariadb字符集
- 删数问题
- 安卓M 6.0动态权限的问题