zabbix配置流程

zabbix配置流程

1. zabbix监控监控指标

1.1 系统
  • CPU使用率
  • 内存使用率
  • 硬盘使用率
1.2 网络
  • 网络,交换机中的网口
1.3 业务(开发的程序,服务)
  • 进程
  • 端口号
  • 日志(是否出现错误)
1.4 硬件
  • 电源个数
  • CPU温度
  • 硬盘温度

2. zabbix监控配置流程

2.1 管理层次
  • 开发人员要加监控,需要让其提供监控指标
  • 运营人员要加监控,让其找开发要监控指标
  • 运营人员要加监控
2.2 配置层次
  • 1). 添加主机或主机组

  • 2). 添加监控项

    • 使用模板添加
    • 自定义模板
    • 手动加监控项
  • 3). 添加触发器,怎样知道添加的监控配好了

  • 4). 添加媒介,用什么方式告警,告警方式

  • 5). 为用户选择要使用的媒介

  • 6). 添加动作,以什么方式取告警

  • 7). 手动触发并验证

3. 环境,并启动服务端zabbix和lamp

  • 首先安装lamp架构
环境IP要安装的应用
服务器192.168.232.132lamp架构 zabbix server zabbix agent
客户端192.168.232.128zabbix agent
  • [root@SYL4 ~]# ss -antl
    State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess 
    LISTEN 0      128        127.0.0.1:9000      0.0.0.0:*           
    LISTEN 0      128          0.0.0.0:22        0.0.0.0:*           
    LISTEN 0      80                 *:3306            *:*           
    LISTEN 0      128                *:80              *:*           
    LISTEN 0      128             [::]:22           [::]:*           
    [root@SYL4 ~]# zabbix_server 
    [root@SYL4 ~]# zabbix_agentd 
    [root@SYL4 ~]# ss -antl
    State  Recv-Q Send-Q Local Address:Port  Peer Address:PortProcess
    LISTEN 0      128        127.0.0.1:9000       0.0.0.0:*          
    LISTEN 0      128          0.0.0.0:22         0.0.0.0:*          
    LISTEN 0      128          0.0.0.0:10050      0.0.0.0:*          
    LISTEN 0      128          0.0.0.0:10051      0.0.0.0:*          
    LISTEN 0      80                 *:3306             *:*          
    LISTEN 0      128                *:80               *:*          
    LISTEN 0      128             [::]:22            [::]:*          
    [root@SYL4 ~]# 
    

4. 编译安装客户端程序

4.1 提供软件,解压,并创建用户
[root@SYL4 ~]# scp zabbix-5.0.25.tar.gz 192.168.232.128:/root
The authenticity of host '192.168.232.128 (192.168.232.128)' can't be established.
ECDSA key fingerprint is SHA256:K5PZWAGixN2F0s4CX9AnYLG7WeRbA6adXzDLI4JRIpQ.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.232.128' (ECDSA) to the list of known hosts.
root@192.168.232.128's password: 
zabbix-5.0.25.tar.gz           100%   20MB   7.3MB/s   00:02    

[root@SYL3 ~]# ls
anaconda-ks.cfg  zabbix-5.0.25.tar.gz
[root@SYL3 ~]# tar xf zabbix-5.0.25.tar.gz 
[root@SYL3 ~]# useradd -r -M -s /sbin/nologin zabbix
4.2 安装编译工具,并编译
[root@SYL3 ~]# yum -y install make gcc gcc-c++ vim wget

[root@SYL3 ~]# cd zabbix-5.0.25
[root@SYL3 zabbix-5.0.25]#
[root@SYL3 zabbix-5.0.25]# ./configure --enable-agent

configure: error: Unable to use libpcre (libpcre check failed)
错误:无法使用libpcre (libpcre检查失败)

安装libpcre
[root@SYL3 ~]# yum -y install pcre-devel

再次编译
[root@SYL3 zabbix-5.0.25]# ./configure --enable-agent

安装
[root@SYL3 zabbix-5.0.25]# make install
4.3 关闭防火墙
[root@SYL3 ~]# systemctl disable --now firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@SYL3 ~]# vim /etc/selinux/config 
[root@SYL3 ~]# setenforce 0
[root@SYL3 ~]# getenforce 
Permissive
[root@SYL3 ~]# 
4.4 修改配置文件
[root@SYL3 zabbix-5.0.25]# cd /usr/local/etc/
[root@SYL3 etc]# ls
zabbix_agentd.conf  zabbix_agentd.conf.d
[root@SYL3 etc]# vim zabbix_agentd.conf
[root@SYL3 etc]# cat zabbix_agentd.conf|grep 192.168.232.132
Server=192.168.232.132
ServerActive=192.168.232.132
[root@SYL3 etc]# cat zabbix_agentd.conf|grep mushuang
Hostname=mushuang
[root@SYL3 etc]# 

启动服务
[root@SYL3 etc]# zabbix_agentd 
[root@SYL3 etc]# ss -antl
State  Recv-Q Send-Q Local Address:Port  Peer Address:PortProcess
LISTEN 0      128          0.0.0.0:22         0.0.0.0:*          
LISTEN 0      128          0.0.0.0:10050      0.0.0.0:*          
LISTEN 0      128             [::]:22            [::]:*          
[root@SYL3 etc]# 

5. 配置服务端的界面

5.1 添加主机
  • 在这里插入图片描述

  • 在这里插入图片描述

5.2 添加监控项
5.2.1 模板介绍
  • 在这里插入图片描述
5.2.2 使用模板添加
  • 在这里插入图片描述
5.2.3 查看

-在这里插入图片描述

5.2.4 自定义模板
  • 点击客户端1的items,点击右上角create item
  • 在这里插入图片描述
5.2.5 配置触发器
  • 点击Triggers,然后点击右上角create trigger

-在这里插入图片描述

  • 在这里插入图片描述
5.2.6 查看配置的模板
  • 在这里插入图片描述

  • 在这里插入图片描述

  • 在这里插入图片描述

5.2.7 查看
  • 创建数据

  • [root@SYL3 ~]# echo 'hello hello' > /tmp/abc
    [root@SYL3 ~]# cd /tmp/
    [root@SYL3 tmp]# cat abc 
    hello hello
    [root@SYL3 tmp]# echo 'hello hello' >> /tmp/abc
    [root@SYL3 tmp]# 
    
  • 获取到了数据

  • 在这里插入图片描述

  • 在这里插入图片描述

5.2.8 清掉模板

-在这里插入图片描述

  • 在这里插入图片描述
5.2.9 设置告警
  • 在这里插入图片描述

  • 在这里插入图片描述

  • 在这里插入图片描述

6. 设置邮箱告警

  • 服务正常,改了配置不能重启,但是服务发生告警,不能提供服务,终止了需要重启
6.1 配置邮箱
  • 在这里插入图片描述

  • 在这里插入图片描述

6.2 配置用户要使用的媒介
  • 在这里插入图片描述

  • 在这里插入图片描述

7. 配置动作

7.1 点击Actions
  • 点击右上角,create actions

  • 在这里插入图片描述

  • 在这里插入图片描述

在这里插入图片描述

  • 触发告警

  • [root@SYL3 tmp]# echo 'hello hello' >> /tmp/abc
    [root@SYL3 tmp]# echo 'hello hello' >> /tmp/abc
    [root@SYL3 tmp]# echo 'hello hello' >> /tmp/abc
    [root@SYL3 tmp]# echo 'hello hello' >> /tmp/abc
    [root@SYL3 tmp]# echo 'hello hello' >> /tmp/abc
    [root@SYL3 tmp]# echo 'hello hello' >> /tmp/abc
    [root@SYL3 tmp]# echo 'hello hello' >> /tmp/abc
    [root@SYL3 tmp]# echo 'hello hello' >> /tmp/abc
    [root@SYL3 tmp]# echo 'hello hello' >> /tmp/abc
    [root@SYL3 tmp]# echo 'hello hello' >> /tmp/abc
    [root@SYL3 tmp]# echo 'hello hello' >> /tmp/abc
    [root@SYL3 tmp]# 
    
  • 在这里插入图片描述

8. 触发告警并且查看

[root@SYL3 tmp]# echo 'hello hrgudg' >> abc 
[root@SYL3 tmp]# echo 'hello hrgudg' >> abc 
[root@SYL3 tmp]# echo 'hello hrgudg' >> abc 
[root@SYL3 tmp]# echo 'hello hrgudg' >> abc 
[root@SYL3 tmp]# echo 'hello hrgudg' >> abc 
[root@SYL3 tmp]# 
  • 在这里插入图片描述

9. 在服务端发送邮件

  • [root@zabbix_server ~]# yum -y install mailx postfix
    [root@zabbix_server ~]# systemctl start postfix
    [root@zabbix_server ~]# ss -antl
    State  Recv-Q Send-Q Local Address:Port  Peer Address:PortProcess
    LISTEN 0      128        127.0.0.1:9000       0.0.0.0:*          
    LISTEN 0      128          0.0.0.0:22         0.0.0.0:*          
    LISTEN 0      100        127.0.0.1:25         0.0.0.0:*          
    LISTEN 0      128          0.0.0.0:10050      0.0.0.0:*          
    LISTEN 0      128          0.0.0.0:10051      0.0.0.0:*          
    LISTEN 0      80                 *:3306             *:*          
    LISTEN 0      128                *:80               *:*          
    LISTEN 0      128             [::]:22            [::]:*          
    LISTEN 0      100            [::1]:25            [::]:*          
    [root@zabbix_server ~]# 
    [root@zabbix_server ~]# echo "hello hello" |mail -s "This is a test" 2807689558@qq.com
    [root@zabbix_server ~]# echo "hello hello" |mail -s "This is a test" 2807689558@qq.com
    [root@zabbix_server ~]# 
    
  • [root@zabbix_server ~]# yum -y install mailx postfix
    [root@zabbix_server ~]# systemctl start postfix
    [root@zabbix_server ~]# ss -antl
    State  Recv-Q Send-Q Local Address:Port  Peer Address:PortProcess
    LISTEN 0      128        127.0.0.1:9000       0.0.0.0:*          
    LISTEN 0      128          0.0.0.0:22         0.0.0.0:*          
    LISTEN 0      100        127.0.0.1:25         0.0.0.0:*          
    LISTEN 0      128          0.0.0.0:10050      0.0.0.0:*          
    LISTEN 0      128          0.0.0.0:10051      0.0.0.0:*          
    LISTEN 0      80                 *:3306             *:*          
    LISTEN 0      128                *:80               *:*          
    LISTEN 0      128             [::]:22            [::]:*          
    LISTEN 0      100            [::1]:25            [::]:*          
    [root@zabbix_server ~]# 
    [root@zabbix_server ~]# echo "hello hello" |mail -s "This is a test" 2807689558qq.com
    [root@zabbix_server ~]# 
    
  • 查看QQ邮箱

  • 在这里插入图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值