天天看點

使用阿裡源部署監控報警平台Zabbix4.0

一、Zabbix簡介

概念:一個基于WEB界面的提供的分布式系統監視以及網絡監視功能的企業級的開源解決方案。能監視各種網絡參數,保證伺服器系統的安全營運;提供靈活的通知機制以及讓系統管理者快速定位并解決存在的問題。

監控對象:源代碼、資料庫、應用軟體(agent)、叢集、虛拟化層/雲層(agent)、作業系統性能參數、硬體(IPMI)、網絡(SNMP)。

監控收集資訊方式:主動收集和被動收集。

二、Zabbix部署

1、Zabbix-server:

官網:https://www.zabbix.com/cn/

環境:在本實驗中使用阿裡源中的安裝包,首先在配置阿裡yum源和epel擴充源。本文所使用的的是CenterOS 7系統。

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

           

安裝Zabbix安裝包:

hostnamectl set-hostname zabbix_server 
systemcltl stop firewalld 
systemctl disable firewalld 
setenforce 0
yum -y install zabbix40-server-mysql zabbix40-web-mysql zabbix40-agent
           

建立資料庫:

yum -y install mariadb mariadb-server
systemctl enable mariadb
systemctl start mariadb
mysql
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to [email protected] identified by '密碼';
flush privileges;
mysql -uzabbix -p'密碼' zabbix < /usr/share/zabbix-mysql/schema.sql
mysql -uzabbix -p'密碼' zabbix < /usr/share/zabbix-mysql/images.sql 
mysql -uzabbix -p'密碼' zabbix < /usr/share/zabbix-mysql/data.sql 
           

配置sql賬号密碼:

vim /etc/zabbix/zabbix_server.conf
	DBHost=localhost
	DBName=zabbix
	DBUser=zabbix
	DBPassword=密碼
           

啟動zabbix:

systemctl enable zabbix-server-mysql.service zabbix-agent.service httpd
systemctl start zabbix-server-mysql.service zabbix-agent.service httpd
           

編輯php配置的zabbix前端:

vim /etc/httpd/conf.d/zabbix.conf
	php_value date.timezone Asia/Shanghai
systemctl enable httpd 
systemctl start httpd
           

使用浏覽器通路ip/zabbix,按提示資訊填寫相關内容。

2、zabbix-agent:

設定主機名:

hostnamectl set-hostname web1
           

環境:

systemctl stop firewalld
systemctl disable firewalld
setenforce 0
           

安裝zabbix-agent:

yum install -y zabbix-agent
           

配置主伺服器的ip位址:

vim /etc/zabbix/zabbix_agentd.conf
	Server=伺服器ip			被動模式zabbix-server-ip
	ServerActive=伺服器ip	主動模式 zabbix-server-ip
	Hostname=web1			
           

啟動zabbix-agent:10050

systemctl start zabbix-agent
systemctl enable zabbix-agent
ss -anlp | grep :10050
           

在zabbix伺服器上使用指令行測試示例:通過zabbix_get收集用戶端資料

zabbix_get -s 用戶端ip -k system.uname 	檢視用戶端核心版本
zabbix_get -s 用戶端ip -k system.cpu.load[all,avg15] 檢視用戶端CPU資訊
           

繼續閱讀