一、zabbix结构组成

zabbix软件结构组成:

1.Zabbix Web GUI: 提供Web界面

2.Zabbix Database:提供数据存储功能,专用于存储配置信息,以及采集到的数据

3.Zabbix Server: 接收Agent采集数据的核心组件。

4.Zabbix Agent: 部署在被监控主机上,用于采集本地数据。

5.Zabbix Proxy: 当被监控节点较多时,用于减轻Server压力的组件,也用于分布式监控系统。由Proxy接收数据后统一发送至Server。

二、zabbix架构图

Zabbix逻辑组件:

主机组(host groups)

主机(hosts)

应用(application)

监控项(items)

触发器(triggers)

事件(events)

动作(actions):条件(conditions)和操作(operations)

媒介(media):发送通知的通道,短信,邮件等

通知(notiflcations)

远程命令(remote command)

报警升级(escalation)

模板(template)

图形(graph)

屏幕(screens)

幻灯(slide show)

三、zabbix部署

IP地址 服务 配置 10.0.0.71 zabbix-server 1c1g 10.0.0.7 zabbix-agent 1c1g

Zabbix服务端部署

a.安装nginx + php7.2+环境

#yum配置

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum install epel-release.noarch -y

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

#安装nginx+php

yum install nginx php72w-fpm php72w-gd php72w-mbstring php72w-bcmath php72w-xml php72w-ldap php72w-mysqlnd -y

vim /etc/php-fpm.d/www.conf

vim /etc/nginx/nginx.conf

user nginx;

worker_processes 1;

events {

worker_connections 1024;

}

http {

include mime.types;

default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

client_max_body_size 10m;

server {

listen 80;

server_name localhost;

location / {

root /html;

index index.html index.htm index.php;

location ~ \.php$ {

root /html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /html$fastcgi_script_name;

include fastcgi_params;

}

}

}

}

#启动服务

systemctl start nginx php-fpm

systemctl enable nginx php-fpm

b.安装mariadb

yum install mariadb-server -y

systemctl start mariadb.service

systemctl enable mariadb.service

mysql_secure_installation

mysql> create database zabbix character set utf8 collate utf8_bin;

mysql> create user 'zabbix'@'localhost' identified by '123456';

mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost';

c.安装zabbix-server

rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

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

[zabbix-frontend]

...

enabled=1

yum install zabbix-server-mysql -y

zcat /usr/share/doc/zabbix-server-mysql-5.0.6/create.sql.gz|mysql zabbix

vim /etc/zabbix/zabbix_server.conf

DBHost=localhost

DBName=zabbix

DBUser=zabbix

DBPassword=123456

#验证

netstat -lntup

d.zabbix-web的安装

tar xf zabbix-5.0.6.tar.gz

cd zabbix-5.0.6/ui/

mv * /html/

chown -R nginx:nginx /html

mkdir /var/lib/php/session

chown -R nginx:nginx /var/lib/php/session

vim /etc/php.ini

; php_value[date.timezone] = Europe/Riga

systemctl restart php-fpm.service

e.登录zabbix服务端web界面,进行初始化配置

用户名Admin 密码zabbix

f.启动zabbix-server服务

systemctl start zabbix-server.service

netstat -tnulp|grep 10051

zabbix客户端部署

#下载安装zabbix 源文件

yum -y install zabbix-agent

#编写zabbix客户端配置文件

vim /etc/zabbix/zabbix_agetnd.conf

98 Server=172.16.1.71

#启动zabbix-agent服务

systemctl start zabbix-agent

netstat -tnulp|grep 10050

四、监控一台服务主机

#监控zabbix-server

wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-agent-5.0.6-1.el7.x86_64.rpm

rpm -ivh zabbix-agent-5.0.6-1.el7.x86_64.rpm

systemctl start zabbix-agent.service

systemctl enable zabbix-agent.service

#添加其他的主机监控

rpm -ivh http://192.168.15.253/zabbix-agent-5.0.6-1.el7.x86_64.rpm

vim /etc/zabbix/zabbix_agentd.conf

Server=10.0.0.71

systemctl start zabbix-agent.service

systemctl enable zabbix-agent.service

 

查看原文