Zabbix的客户端安装教程

Posted jks212454

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Zabbix的客户端安装教程相关的知识,希望对你有一定的参考价值。

一、Zabbix客户端及其它相关介绍

1.zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案
2.zabbix由2部分构成,zabbix server与可选组件zabbix agent。
3.Zabbix_Agent:zabbix-agent为客户端软件,用于采集各监控项目的数据,并把采集的数据传输给zabbix-proxy或zabbix-server。
4.zabbix server:可以通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。

二、Zabbix客户端安装步骤

1.开通10050端口用于和Zabbix-server通信

[root@control ~]# firewall-cmd --permanent --add-port=10050/tcp
success
[root@control ~]# firewall-cmd --reload 
success

2.SELINUX关闭

[root@control ~]# setenforce 0
[root@control ~]# getenforce 
Permissive
[root@control ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
[root@control ~]# grep SELINUX /etc/selinux/config 
# SELINUX= can take one of these three values:
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
SELINUXTYPE=targeted

3.安装Zabbix-agent

[root@control ~]# yum -y install https://repo.huaweicloud.com/zabbix/zabbix/5.0/rhel/8/x86_64/zabbix-agent2-5.0.9-1.el8.x86_64.rpm
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
AppStream                                                                                                                         0.0  B/s |   0  B     00:00    
BaseOS                                                                                                                            0.0  B/s |   0  B     00:00    
Failed to synchronize cache for repo 'AppStream', ignoring this repo.
Failed to synchronize cache for repo 'BaseOS', ignoring this repo.
Last metadata expiration check: 0:57:08 ago on Thu 06 May 2021 12:01:05 AM CST.
zabbix-agent2-5.0.9-1.el8.x86_64.rpm                                                                                              2.7 MB/s | 5.4 MB     00:02    
Dependencies resolved.
==================================================================================================================================================================
 Package                                  Arch                              Version                                 Repository                               Size
==================================================================================================================================================================
Installing:
 zabbix-agent2                            x86_64                            5.0.9-1.el8                             @commandline                            5.4 M

Transaction Summary
==================================================================================================================================================================
Install  1 Package

Total size: 5.4 M
Installed size: 18 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                          1/1 
  Running scriptlet: zabbix-agent2-5.0.9-1.el8.x86_64                                                                                                         1/1 
  Installing       : zabbix-agent2-5.0.9-1.el8.x86_64                                                                                                         1/1 
  Running scriptlet: zabbix-agent2-5.0.9-1.el8.x86_64                                                                                                         1/1 
  Verifying        : zabbix-agent2-5.0.9-1.el8.x86_64                                                                                                         1/1 
Installed products updated.

Installed:
  zabbix-agent2-5.0.9-1.el8.x86_64                                                                                                                                

Complete!

4.安装zabbix-sender

[root@control ~]# yum -y install https://repo.huaweicloud.com/zabbix/zabbix/5.0/rhel/8/x86_64/zabbix-sender-5.0.9-1.el8.x86_64.rpm
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
AppStream                                                                                                                         0.0  B/s |   0  B     00:00    
BaseOS                                                                                                                            0.0  B/s |   0  B     00:00    
Failed to synchronize cache for repo 'AppStream', ignoring this repo.
Failed to synchronize cache for repo 'BaseOS', ignoring this repo.
Last metadata expiration check: 0:58:44 ago on Thu 06 May 2021 12:01:05 AM CST.
zabbix-sender-5.0.9-1.el8.x86_64.rpm                                                                                              281 kB/s | 364 kB     00:01    
Dependencies resolved.
==================================================================================================================================================================
 Package                                  Arch                              Version                                 Repository                               Size
==================================================================================================================================================================
Installing:
 zabbix-sender                            x86_64                            5.0.9-1.el8                             @commandline                            364 k

Transaction Summary
==================================================================================================================================================================
Install  1 Package

Total size: 364 k
Installed size: 1.6 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                          1/1 
  Installing       : zabbix-sender-5.0.9-1.el8.x86_64                                                                                                         1/1 
  Running scriptlet: zabbix-sender-5.0.9-1.el8.x86_64                                                                                                         1/1 
  Verifying        : zabbix-sender-5.0.9-1.el8.x86_64                                                                                                         1/1 
Installed products updated.

Installed:
  zabbix-sender-5.0.9-1.el8.x86_64                                                                                                                                

Complete!

5.配置/etc/zabbix/zabbix.agentd.conf


Server=192.168.200.129

### Option: ListenPort
#       Agent will listen on this port for connections from the server.
#
# Mandatory: no
# Range: 1024-32767
# Default:
# ListenPort=10050

### Option: ListenIP
#       List of comma delimited IP addresses that the agent should listen on.
#       First IP address is sent to Zabbix server if connecting to it to retrieve list of active checks.
#
# Mandatory: no
# Default:
# ListenIP=0.0.0.0

### Option: StatusPort
#       Agent will listen on this port for HTTP status requests.
#
# Mandatory: no
# Range: 1024-32767
# Default:
# StatusPort=

##### Active checks related

### Option: ServerActive
#       List of comma delimited IP:port (or DNS name:port) pairs of Zabbix servers and Zabbix proxies for active checks.
#       If port is not specified, default port is used.
#       IPv6 addresses must be enclosed in square brackets if port for that host is specified.
#       If port is not specified, square brackets for IPv6 addresses are optional.
#       If this parameter is not specified, active checks are disabled.
#       Example: ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
#
# Mandatory: no
# Default:
# ServerActive=


ServerActive=192.168.200.129

### Option: Hostname
#       Unique, case sensitive hostname.
#       Required for active checks and must match hostname as configured on the server.
#       Value is acquired from HostnameItem if undefined.
#
# Mandatory: no
# Default:
# Hostname=

Hostname=192.168.200.129

6.启动服务

[root@control ~]# systemctl enable --now zabbix-agent2.service 
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service → /usr/lib/systemd/system/zabbix-agent2.service.

三、测试安装结果

1.服务端添加被监控主机

在这里插入图片描述

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

以上是关于Zabbix的客户端安装教程的主要内容,如果未能解决你的问题,请参考以下文章

zabbix Java开发教程docker部署zabbix及api获取实战教程

zabbix Java开发教程docker部署zabbix及api获取实战教程

zabbix6.0安装教程:安装要求&获取方式

zabbix6.0安装教程:安装要求&获取方式

zabbix6.0安装教程:从源代码安装

zabbix6.0安装教程:从源代码安装