zabbix监控配置流程

zabbix监控配置流程

在服务端上面部署lamp中成功了zabbix中继续以下操作
版本IP主机中部署的服务
centos8192.168.136.140lamp、zabbix_server 、zabbix_agentd(这个已经部署完)
centos8192.168.136.139agentd
1. 在192.168.136.139主机中部署agentd
# 关闭防火墙和selinux
[root@client ~]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@client ~]# setenforce 0
[root@client ~]# cat /etc/selinux/
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled


# 创建zabbix用户
[root@client ~]# useradd -r -M -s /sbin/nologin zabbix

# 下载zabbix软件包(这个包我有,直接传过来),可以上官网
[root@client ~]# ll
total 42728
-rw-------. 1 root root     1246 Jul 27 09:41 anaconda-ks.cfg
-rw-r--r--. 1 root root 43744978 Sep 23 04:36 zabbix-6.4.6.tar.gz

# 解压
[root@client ~]# tar xf zabbix-6.4.6.tar.gz 
[root@client ~]# ll
total 42732
-rw-------.  1 root root     1246 Jul 27 09:41 anaconda-ks.cfg
-rw-r--r--.  1 root root       80 Sep 14 10:40 echo
drwxr-xr-x.  5 root root      121 Sep 22 22:13 module
drwxr-xr-x. 13 tq   tq       4096 Aug 22 04:11 zabbix-6.4.6
-rw-r--r--.  1 root root 43744978 Sep 23 04:36 zabbix-6.4.6.tar.gz

# 安装编译器
[root@client yum.repos.d]# yum -y install gcc-c++ gcc make
[root@client zabbix-6.4.6]# yum -y install pcre-devel
#进行编译
[root@client ~]# cd zabbix-6.4.6
[root@client zabbix-6.4.6]# ./configure --help|grep agent
  --enable-agent          Turn on build of Zabbix agent and client utilities
  --enable-agent2         Turn on build of Zabbix agent 
  
[root@client zabbix-6.4.6]# ./configure --enable-agent 
过程省略.......
.............
 Enable agent:          yes
  Agent details:
    TLS:                   no
    Modbus:                no
    Linker flags:                -rdynamic    
    Libraries:                   -lpthread -lm -ldl  -lresolv  -lpcre  
    Configuration file:    /usr/local/etc/zabbix_agentd.conf
    Modules:               /usr/local/lib/modules

  Enable agent 2:        no

  Enable web service:    no

  Enable Java gateway:   no

  LDAP support:          no
  IPv6 support:          no
  cmocka support:        no

  yaml support:          no

***********************************************************
*            Now run 'make install'                       *
*                                                         *
*            Thank you for using Zabbix!                  *
*              <http://www.zabbix.com>                    *
***********************************************************
[root@client zabbix-6.4.6]# make install

....省略....
..............
 /usr/bin/install -c -m 644 'zabbix_agentd.man' '/usr/local/share/man/man8/zabbix_agen
make[2]: Leaving directory '/root/zabbix-6.4.6/man'
make[1]: Leaving directory '/root/zabbix-6.4.6/man'
Making install in misc
make[1]: Entering directory '/root/zabbix-6.4.6/misc'
make[2]: Entering directory '/root/zabbix-6.4.6/misc'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/root/zabbix-6.4.6/misc'
make[1]: Leaving directory '/root/zabbix-6.4.6/misc'
make[1]: Entering directory '/root/zabbix-6.4.6'
make[2]: Entering directory '/root/zabbix-6.4.6'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/root/zabbix-6.4.6'
make[1]: Leaving directory '/root/zabbix-6.4.6'

# 设置开机自启,agentd端 

[root@client system]# cat zabbix_agentd.service 
[Unit]
Description=zabbix agentd
After=network.target 

[Service]
Type=forking
ExecStart=/usr/local/sbin/zabbix_agentd
ExecStop=pkill zabbix_agentd
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

[root@client zabbix-6.4.6]# cd /usr/local/etc/
[root@client etc]# ll
total 20
-rw-r--r--. 1 root root 17025 Sep 23 04:55 zabbix_agentd.conf
drwxr-xr-x. 2 root root     6 Sep 23 04:55 zabbix_agentd.conf.d

[root@client etc]# vim zabbix_agentd.conf
109 # Mandatory: yes, if StartAgents is not explicitly set to 0
110 # Default:
111 # Server=
112 
113 Server=192.168.136.140 //ip为服务端的
166 
167 ServerActive=192.168.136.140 //ip也为服务端的
175 # Default:
176 # Hostname=
177 
178 Hostname=ttqlinux(这个要为全局唯一的)

#重新加载并开机自启
[root@client zabbix-6.4.6]# systemctl daemon-reload
[root@client zabbix-6.4.6]# systemctl enable --now zabbix_agentd.service 
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix_agentd.service → /usr/lib/systemd/system/zabbix_agentd.service.
[root@client etc]# ss -antl
State    Recv-Q   Send-Q     Local Address:Port        Peer Address:Port   Process   
LISTEN   0        128              0.0.0.0:10050            0.0.0.0:*                
LISTEN   0        128              0.0.0.0:22               0.0.0.0:*                
LISTEN   0        128                 [::]:22                  [::]:*   
2.把部署好的这台agentd加入到zabbix中
右上角点击创建主机

点击添加
在这里插入图片描述

主机添加成功!

手动测试创建一个被监控对象(被监控主机上)

[root@client ~]# echo "this a test file" >> /tmp/jjyy
[root@client ~]# cat /tmp/jjyy 
this a test file
步骤:
2. 创建item

在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述
在这里插入图片描述在这里插入图片描述

3.手动创建触发器

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

添加完毕!
4.测试
手动触发这个监控项,测试功能是否正常

在这里插入图片描述

在被控主机上修改/tmp/jjyy文件

[root@client ~]# echo "zabbix service" >> /tmp/jjyy
[root@client ~]# 

在这里插入图片描述

有报警信息!

再加一台windows来监控

去官网下载windows版本

https://cdn.zabbix.com/zabbix/binaries/stable/6.4/6.4.6/zabbix_agent-6.4.6-windows-amd64-openssl.zip

在这里插入图片描述

并找到下载的包进行解压并修改conf这个文件
在这里插入图片描述
在这里插入图片描述

保存!
在cmd 中
C:\Windows\system32>cd C:\Program Files\zabbix_agent-6.4.6-windows-amd64-openssl\bin\

C:\Program Files\zabbix_agent-6.4.6-windows-amd64-openssl\bin>dir
 驱动器 C 中的卷是 Windows
 卷的序列号是 8E4D-D951

 C:\Program Files\zabbix_agent-6.4.6-windows-amd64-openssl\bin 的目录

2023/09/24  19:49    <DIR>          .
2023/09/24  19:49    <DIR>          ..
2023/08/22  13:28         3,213,824 zabbix_agentd.exe
2023/08/22  13:28         2,841,600 zabbix_get.exe
2023/08/22  13:28         2,904,064 zabbix_sender.exe
               3 个文件      8,959,488 字节
               2 个目录 56,035,971,072 可用字节

C:\Program Files\zabbix_agent-6.4.6-windows-amd64-openssl\bin>zabbix_agentd.exe -c "C:\Program Files\zabbix_agent-6.4.6-windows-amd64-openssl\conf\zabbix_agentd" -i
zabbix_agentd.exe [7984]: service [Zabbix Agent] installed successfully
zabbix_agentd.exe [7984]: event source [Zabbix Agent] installed successfully

C:\Program Files\zabbix_agent-6.4.6-windows-amd64-openssl\bin>
启动agentd服务

在这里插入图片描述
在这里插入图片描述

记得在控制面版中关闭防火墙

第一添加主机或者主机组

创建主机组(如上面步骤一样)

在这里插入图片描述

创建主机

在这里插入图片描述在这里插入图片描述在这里插入图片描述

添加模块!

在这里插入图片描述

在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值