本文共 2282 字,大约阅读时间需要 7 分钟。
Zabbix监控软件
重要组件Zabbix Server:负责接收组件Database storage:负责存储收集的信息Web interface:图形界面接口Proxy:分布式组件,可选安装Agent:负责收集被监控端的信息并传给Serverzabbix进程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 mariadbmysqladmin -u root password 'password123'cp -r /abc/Zabbix软件包 /Zabbix
mv yum源所需 yumcreaterepo /Zabbix/yum #生成yum仓库目录修改本地yum源公钥检测为0,修改目录为/Zabbixvim /etc/yum.repos.d/a.repo [a]name=abaseurl=file:///Zabbix/yum/gpgcheck=0enable=0yum -y install -y zabbix-server-mysql zabbix-web-mysql zabbix-agentmysql -u root -ppassword123create 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=localhostDBName=zabbixDBUser=zabbixDBPassword=password456cp /etc/zabbix/zabbix_agentd.conf /etc/zabbix/.zabbix_agentd.conf.bakvim /etc/zabbix/zabbix_agentd.confServer=127.0.0.1 #指定server主机地址(被动)ServerActive=127.0.0.1 #指定server地址(主动)Hostname=linux-server001systemctl start zabbix-serversystemctl enable zabbix-server搭建GNS3R1:
conf tint e0/0ip add 192.168.10.100 255.255.255.0no shexitno ip routingsnmp-server community centos ROsnmp-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.rpmvim /etc/zabbix/zabbix_agentd.confServer=192.168.10.1 #指定server主机地址(被动)ServerActive=192.168.10.1 #指定server地址(主动)Hostname=linux-server001systemctl start zabbix-agent.servicenetstat -anpt | grep agentyum -y install httpd
mkdir /etc/zabbix/zabbix_scriptscd /etc/zabbix/zabbix_scriptsvim check_httpd.sh#!/bin/basha=netstat -anpt | grep httpd
if [[ -n $a ]]thenecho "2"elseecho "0"fi vim /etc/zabbix/zabbix_agentd.conf
UnsafeUserParameters=1 #支持自定义脚本vim /etc/zabbix/zabbix_agentd.d/userparameter_httpd.confUserParameter=check_httpd,sh /etc/zabbix/zabbix_scripts/check_httpd.sh转载于:https://blog.51cto.com/13968682/2372939