前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CentOS7下Zabbix监控平台的搭建

CentOS7下Zabbix监控平台的搭建

作者头像
yuanfan2012
发布2019-08-22 10:44:07
1K0
发布2019-08-22 10:44:07
举报
文章被收录于专栏:WalkingCloud

zabbix是一个基于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下Zabbix监控平台的搭建

一、安装MariaDB

yum -y install centos-release-scl-rh centos-release-scl

yum --enablerepo=centos-sclo-rh -y install rh-mariadb102-mariadb-server

[root@zabbix ~]# scl enable rh-mariadb102 bash

[root@zabbix ~]# mysql -V

mysql Ver 15.1 Distrib 10.2.22-MariaDB, for Linux (x86_64) using EditLine wrapper

[root@zabbix ~]# which mysql

/opt/rh/rh-mariadb102/root/usr/bin/mysql

[root@zabbix ~]#

[root@zabbix ~]# vi /etc/profile.d/rh-mariadb102.sh

#!/bin/bash

source /opt/rh/rh-mariadb102/enable

export X_SCLS="`scl enable rh-mariadb102 'echo $X_SCLS'`"

vi /etc/opt/rh/rh-mariadb102/my.cnf.d/mariadb-server.cnf

添加character-set-server=utf8

[root@zabbix ~]# systemctl start rh-mariadb102-mariadb

[root@zabbix ~]# systemctl enable rh-mariadb102-mariadb

进行数据库的初始化

[root@zabbix ~]# mysql_secure_installation

验证数据库是否安装成功

如果有防火墙

[root@zabbix ~]# firewall-cmd --add-service=mysql --permanent

[root@zabbix ~]# firewall-cmd --reload

二、安装Zabbix-Server

1)安装zabbix-release-4.2-2.el7.noarch.rpm

rpm -Uvh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-2.el7.noarch.rpm

2)yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

3)初始化数据库,创建zabbix用户以及zabbix数据库

[root@zabbix ~]# mysql -uroot -p

Enter password:

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 15

Server version: 10.2.22-MariaDB MariaDB Server

Copyright (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)]> create database zabbix character set utf8 collate utf8_bin;

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'Admin@123';

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit

4)导入zabbix表数据

cd /usr/share/doc/zabbix-server-mysql-4.2.5/

gzip -d create.sql.gz

mysql -uzabbix -p zabbix < create.sql

5)修改配置zabbix_server.conf 文件及/etc/httpd/conf.d/zabbix.conf配置文件

vi /etc/zabbix/zabbix_server.conf

DBHost=localhost

DBPassword=Admin@123(数据库的密码)

vi /etc/httpd/conf.d/zabbix.conf,修改时区

6)启动zabbix-server zabbix-agent httpd服务,并设为开机自启动

[root@zabbix ~]# systemctl restart zabbix-server zabbix-agent httpd

[root@zabbix ~]# systemctl enable zabbix-server zabbix-agent httpd

7)进行Web初始化

初始的账号Admin,密码zabbix

三、Agent的安装,监控资源的添加

以CentOS6.9的一台主机为例

1)rpm -ivh 安装agent

rpm -ivh zabbix-agent-4.2.5-1.el6.x86_64.rpm

2)修改配置文件,指定Server的IP

vi /etc/zabbix/zabbix_agentd.conf

Server=10.20.10.93

ServerActive=10.20.10.93

3)启用agent并设置agent服务开机自启动

[root@localhost ~]# service zabbix-agent start

Starting Zabbix agent: [ OK ]

[root@localhost ~]# chkconfig zabbix-agent on

[root@localhost ~]# chkconfig zabbix-agent --list

zabbix-agent 0:off 1:off 2:on 3:on 4:on 5:on 6:off

4)Zabbix Web管理界面上添加主机,设置模板

5)验证效果,例如查看网口流量信息

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2019-08-20,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 WalkingCloud 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档