zabbix-安装与监控

    zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。

  zabbix(音同 zæbix)是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。 zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。 zabbix由2部分构成,zabbix server与可选组件zabbix agent。 zabbix server可以通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。


部署环境:

系统版本:centos7


安装准备工作

配置yum源

vim /etc/yum.repos.d/zabbix.repo

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

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

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


开始安装


一.安装组件

yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent mariadb mariadb-server httpd


二.配置数据库服务与导入数据库

1.启动数据库

systemctl start mariadb.service
systemctl start mariadb.service

2.登录数据库做用户授权与创建zabbix数据库和数据库校对规则

  • 登录mysql
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; #创建数据库
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; #用户创建与授权
MariaDB [(none)]> flush privileges; #刷新数据表
  • 导入zabbix初始数据库
zcat /usr/share/doc/zabbix-server-mysql-4.4.9/create.sql.gz |mysql -uzabbix -pzabbix zabbix
  • 编辑zabbix-server配置文件,配置数据库信息
[root@centos7-1 ~]# cat  /etc/zabbix/zabbix_server.conf |grep "^DB"
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix


三.设置时区信息

vim /etc/php.ini

image

[root@centos7-1 ~]# cat /etc/php.ini |grep '^date.timezone'
date.timezone = Asia/Shanghai


四.解决中文乱码

1.删除/usr/share/zabbix/assets/fonts目录下的graphfont.ttf文件

2.将从主机拷贝的字体文件改名为graphfont.ttf

3.上传到/usr/share/zabbix/assets/fonts目录

4.赋予权限 chmod 777 /usr/share/zabbix/assets/fonts/graphfont.ttf


五.启动服务

systemctl start httpd zabbix-server zabbix-agent


六.web界面安装zabbix

image

image

image

image

image


七.web界面的中文显示

image

image

image


开始监控主机

客户端安装zabbix-agent

1.配置repo源

步骤同server端.

2.安装zabbix-agent

yum -y install zabbix-agent


3.修改配置文件

[root@centos7 ~]# cat /etc/zabbix/zabbix_agentd.conf |grep '^Server'
Server=192.168.100.128
ServerActive=192.168.100.128

服务端IP


4.启动

systemctl start zabbix-agent
原文地址:https://www.cnblogs.com/sunjianlin/p/13219661.html