首页 > 其他分享 >zabbix监控配置流程

zabbix监控配置流程

时间:2022-09-04 21:23:07浏览次数:107  
标签:0.0 流程 zabbix client 监控 rc root LISTEN

1.0 zabbix监控配置流程详细

管理角度:

  • 开发
    由开发人员提供监控指标来监控
  • 运营
    让其找开发要监控指标
  • 运维
    直接加

配置角度:

  • 创建主机
  • 创建主机组并加入主机
  • 添加监控项
  • 添加触发器
  • 配置媒介
  • 配置动作
  • 手动触发告警

配置流程
配置监控的步骤:
添加主机组
添加主机并加到主机组:
安装agent
创建用户zabbix
编译安装
配置 zabbix_agentd.conf,设置zabbix_server的ip,hostname的值
启动服务
在web界面添加主机
添加监控项
手动配置监控项
通过模板配置监控项
添加触发器
配置用户媒介
添加动作
手动触发并验证

开启zabbix并开机自启
[root@localhost ~]# ss -antl
State      Recv-Q     Send-Q         Local Address:Port           Peer Address:Port     Process     
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                        *:3306                      *:*                    
LISTEN     0          128                        *:80                        *:*                    
LISTEN     0          128                     [::]:22                     [::]:*                    
LISTEN     0          70                         *:33060                     *:*                    
[root@localhost ~]# vim /etc/rc.local
#!/bin/bash
zabbix_server
zabbix_agentd
[root@localhost ~]# ll /etc/rc.local 
lrwxrwxrwx. 1 root root 13 Dec  2  2020 /etc/rc.local -> rc.d/rc.local
[root@localhost ~]# ll /etc/rc.d/rc.local 
-rw-r--r--. 1 root root 502 Sep  3 17:26 /etc/rc.d/rc.local
[root@localhost ~]# chmod +x /etc/rc.d/rc.local 
[root@localhost ~]# ll /etc/rc.d/rc.local 
-rwxr-xr-x. 1 root root 502 Sep  3 17:26 /etc/rc.d/rc.local
[root@localhost ~]# source /etc/rc.d/rc.local 
[root@localhost ~]# ss -antl
State      Recv-Q     Send-Q         Local Address:Port           Peer Address:Port     Process     
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          128                        *:3306                      *:*                    
LISTEN     0          128                        *:80                        *:*                    
LISTEN     0          128                     [::]:22                     [::]:*                    
LISTEN     0          70                         *:33060                     *:*                    
[root@localhost ~]# 

2.0 zabbix监控项配置















2.1手动添加监控项

被监控
[root@client ~]# useradd -r -M -s /sbin/nologin zabbix
[root@client ~]# cat /etc/redhat-release 
CentOS Stream release 8
[root@client ~]# dnf -y install gcc gcc-c++ make vim 
监控
[root@localhost src]# ls
debug  kernels  zabbix-6.2.2  zabbix-6.2.2.tar.gz
[root@localhost src]# scp zabbix-6.2.2.tar.gz 192.168.29.141:/usr/src/
The authenticity of host '192.168.29.141 (192.168.29.141)' can't be established.
ECDSA key fingerprint is SHA256:upy1B8yc2gXKPvSfXDtoilVF3ZbDVJZVKbQlw7hsnks.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.29.141' (ECDSA) to the list of known hosts.
[email protected]'s password: 
zabbix-6.2.2.tar.gz                                               100%   33MB  47.0MB/s   00:00    
[root@localhost src]# 

被监控
[root@client ~]# cd /usr/src/
[root@client src]# ls
debug  kernels  zabbix-6.2.2.tar.gz
[root@client src]# tar xf zabbix-6.2.2.tar.gz 
[root@client src]# cd zabbix-6.2.2/
[root@client zabbix-6.2.2]# ls
AUTHORS    Makefile.am  aclocal.m4  conf          configure.ac  install-sh  missing
COPYING    Makefile.in  bin         config.guess  database      m4          sass
ChangeLog  NEWS         build       config.sub    depcomp       man         src
INSTALL    README       compile     configure     include       misc        ui
[root@client zabbix-6.2.2]# ./configure --enable-agent
......
checking for the linux kernel version... unknown family (4.18.0-257.el8.x86_64)
checking size of void *... 8
configure: using old pcre library by default
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
configure: error: cannot find pkg-config package for libpcre
[root@client zabbix-6.2.2]# dnf -y install pcre-devel openssl openssl-devel
[root@client zabbix-6.2.2]# ./configure --enable-agent
......
***********************************************************
*            Now run 'make install'                       *
*                                                         *
*            Thank you for using Zabbix!                  *
*              <http://www.zabbix.com>                    *
***********************************************************

[root@client zabbix-6.2.2]# make install
[root@client zabbix-6.2.2]# cd
[root@client ~]# cd /usr/local/etc/
[root@client etc]# ls
zabbix_agentd.conf  zabbix_agentd.conf.d
[root@client etc]# vim zabbix_agentd.conf

Server=192.168.29.140(被动模式)

ServerActive=192.168.29.140(主动模式)

Hostname=mary --随机生成
[root@client etc]# zabbix_agentd 
[root@client etc]# ss -antl
State      Recv-Q     Send-Q         Local Address:Port           Peer Address:Port     Process     
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@client etc]# 



2.2使用模板添加监控项

有局限性)(可创建所需监控的模板)

标签:0.0,流程,zabbix,client,监控,rc,root,LISTEN
From: https://www.cnblogs.com/marymary/p/16656129.html

相关文章