重要组件 Zabbix Server:负责接收组件 Database storage:负责存储收集的信息 Web interface:图形界面接口 Proxy:分布式组件,可选安装 Agent:负责收集被监控端的信息并传给Server zabbix进程 zabbix_agentd: C守护进程,负责收集传送 zabbix_get: S端手动获取C信息程序 zabbix_sender: C手动上传信息 zabbix_server: S守护进程,负责接收 zabbix_proxy: 代理进程 监控架构: S-C :直连架构 S-N-C :node架构 S-P-C :proxy架构 实验环境

LAMP或LNMP环境 通过yum安装 yum -y install mariadb mariadb-server #安装数据库 systemctl start mariadb mysqladmin -u root password 'password123'

cp -r /abc/Zabbix软件包 /Zabbix mv yum源所需 yum createrepo /Zabbix/yum #生成yum仓库目录 修改本地yum源公钥检测为0,修改目录为/Zabbix vim /etc/yum.repos.d/a.repo [a] name=a baseurl=file:///Zabbix/yum/ gpgcheck=0 enable=0 yum -y install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent mysql -u root -ppassword123 create database zabbix character set utf8 collate utf8_bin; #创建数据库 grant all privileges on zabbix.* to zabbix@localhost identified by 'password456'; #赋权

zcat /usr/share/doc/zabbix-server-mysql-3.4.1/create.sql.gz | mysql -u zabbix -p zabbix #导入脚本进zabbix vim /etc/zabbix/zabbix_server.conf #修改server配置文件 DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=password456 cp /etc/zabbix/zabbix_agentd.conf /etc/zabbix/.zabbix_agentd.conf.bak vim /etc/zabbix/zabbix_agentd.conf Server=127.0.0.1 #指定server主机地址(被动) ServerActive=127.0.0.1 #指定server地址(主动) Hostname=linux-server001 systemctl start zabbix-server systemctl enable zabbix-server 搭建GNS3

R1: conf t int e0/0 ip add 192.168.10.100 255.255.255.0 no sh exit no ip routing snmp-server community centos RO snmp-server enable traps #开启主动上传模式 snmp-server host 192.168.10.1 centos #指定zabbix服务器

监控Linux服务器 cd /abc/Zabbix软件包/yum源所需/ rpm -ivh zabbix-agent-3.4.1-1.el7.x86_64.rpm vim /etc/zabbix/zabbix_agentd.conf Server=192.168.10.1 #指定server主机地址(被动) ServerActive=192.168.10.1 #指定server地址(主动) Hostname=linux-server001 systemctl start zabbix-agent.service netstat -anpt | grep agent

yum -y install httpd mkdir /etc/zabbix/zabbix_scripts cd /etc/zabbix/zabbix_scripts vim check_httpd.sh #!/bin/bash a=netstat -anpt | grep httpd if [[ -n $a ]] then echo "2" else echo "0" fi

vim /etc/zabbix/zabbix_agentd.conf UnsafeUserParameters=1 #支持自定义脚本 vim /etc/zabbix/zabbix_agentd.d/userparameter_httpd.conf UserParameter=check_httpd,sh /etc/zabbix/zabbix_scripts/check_httpd.sh