当前位置: 首页 > news >正文

ubuntu 安装zabbix6 agent2

ubuntu 安装zabbix6 agent2

1.添加 Zabbix 仓库

首先,你需要添加 Zabbix 官方仓库到你的系统中。这里以 Zabbix 6.0 版本为例:

https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/ 下找到对应的版本

root@dfmc-dpca-ai:~# hostnamectlStatic hostname: dfmc-dpca-aiIcon name: computer-vmChassis: vmMachine ID: b47fc56e17d44c04b7c98819b67695abBoot ID: a89883eeadda43da876c08e68ae154b4Virtualization: kvmOperating System: Ubuntu 20.04.6 LTSKernel: Linux 5.4.0-214-genericArchitecture: x86-64

ubuntu20.04

cd /soft
wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_6.0%2Bubuntu20.04_all.deb --no-check-certificate
dpkg -i zabbix-release_latest_6.0+ubuntu20.04_all.deb
## 更新源
apt update

ubuntu22.04

cd /soft
wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_6.0%2Bubuntu22.04_all.deb --no-check-certificate
dpkg -i zabbix-release_latest_6.0+ubuntu22.04_all.deb
## 更新源
apt update

2.安装 Zabbix Agent 2

更新软件包列表后,可以使用以下命令来安装 Zabbix Agent 2:


root@dfmc-dpca-ai:/soft# apt install zabbix-agent2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:eatmydata libeatmydata1 libfwupdplugin1 libxmlb1 python3-jinja2 python3-json-pointer python3-jsonpatch python3-markupsafe squashfs-tools
Use 'apt autoremove' to remove them.
The following additional packages will be installed:zabbix-agent2-plugin-mongodb zabbix-agent2-plugin-postgresql
The following NEW packages will be installed:zabbix-agent2 zabbix-agent2-plugin-mongodb zabbix-agent2-plugin-postgresql
0 upgraded, 3 newly installed, 0 to remove and 17 not upgraded.
Need to get 11.3 MB of archives.
After this operation, 37.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://repo.zabbix.com/zabbix/6.0/ubuntu focal/main amd64 zabbix-agent2-plugin-mongodb amd64 1:6.0.40-1+ubuntu20.04 [3,422 kB]
Get:2 https://repo.zabbix.com/zabbix/6.0/ubuntu focal/main amd64 zabbix-agent2-plugin-postgresql amd64 1:6.0.40-1+ubuntu20.04 [2,806 kB]                        
Get:3 https://repo.zabbix.com/zabbix/6.0/ubuntu focal/main amd64 zabbix-agent2 amd64 1:6.0.40-1+ubuntu20.04 [5,048 kB]                                          
Fetched 11.3 MB in 5min 42s (33.0 kB/s)                                                                                                                         
Selecting previously unselected package zabbix-agent2-plugin-mongodb.
(Reading database ... 118010 files and directories currently installed.)
Preparing to unpack .../zabbix-agent2-plugin-mongodb_1%3a6.0.40-1+ubuntu20.04_amd64.deb ...
Unpacking zabbix-agent2-plugin-mongodb (1:6.0.40-1+ubuntu20.04) ...
Selecting previously unselected package zabbix-agent2-plugin-postgresql.
Preparing to unpack .../zabbix-agent2-plugin-postgresql_1%3a6.0.40-1+ubuntu20.04_amd64.deb ...
Unpacking zabbix-agent2-plugin-postgresql (1:6.0.40-1+ubuntu20.04) ...
Selecting previously unselected package zabbix-agent2.
Preparing to unpack .../zabbix-agent2_1%3a6.0.40-1+ubuntu20.04_amd64.deb ...
Unpacking zabbix-agent2 (1:6.0.40-1+ubuntu20.04) ...
Setting up zabbix-agent2-plugin-postgresql (1:6.0.40-1+ubuntu20.04) ...
Setting up zabbix-agent2-plugin-mongodb (1:6.0.40-1+ubuntu20.04) ...
Setting up zabbix-agent2 (1:6.0.40-1+ubuntu20.04) ...
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service → /lib/systemd/system/zabbix-agent2.service.
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.24) ...
root@dfmc-dpca-ai:/soft# echo $?
0

3.配置 Zabbix Agent 2

编辑 Zabbix Agent 2 的配置文件 /etc/zabbix/zabbix_agent2.conf,至少需要修改以下几项:

# cd /etc/zabbix/# grep -Ev "^#|^$" zabbix_agent2.confPidFile=/var/run/zabbix/zabbix_agent2.pid
LogFile=/var/log/zabbix/zabbix_agent2.log
LogFileSize=0
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server
Include=/etc/zabbix/zabbix_agent2.d/*.conf
PluginSocket=/run/zabbix/agent.plugin.sock
ControlSocket=/run/zabbix/agent.sock
Include=./zabbix_agent2.d/plugins.d/*.conf# cp zabbix_agent2.conf zabbix_agent2.conf.bak`date +%Y%M%d`cat > zabbix_agent2.conf << EOF
PidFile=/var/run/zabbix/zabbix_agent2.pid
LogFile=/var/log/zabbix/zabbix_agent2.log
LogFileSize=0
HostMetadata=Linux
Server=10.138.66.*
ServerActive=10.138.66.*
Include=./zabbix_agent2.d/plugins.d/*.conf
EOF

此外,如果你希望 Zabbix Agent 2 能够执行自定义脚本或更高级的功能,可能还需要调整其他配置选项。

4.启动并启用 Zabbix Agent 2

启动服务并设置开机自启:

systemctl restart zabbix-agent2
systemctl enable zabbix-agent2
systemctl status zabbix-agent2

5.查看防火墙

### 查看防火墙的状态
ufw status
## 是否放行 10050
ufw status|grep 10050
## 放行10050 端口
ufw allow 10050/tcp

6.验证

http://www.dtcms.com/a/286385.html

相关文章:

  • AI进入自动驾驶时代:OpenAI发布革命性ChatGPT Agent
  • 生成式引擎优化(GEO)核心解析:下一代搜索技术的演进与落地策略
  • OpenAI最强ChatGPT智能体发布:技术突破与应用前景分析
  • 脉冲神经网络(Spiking Neural Network, SNN)与知识蒸馏(Knowledge Distillation, KD)
  • 有好内容,如何做好知识变现?
  • BIST会对锁步核做什么?
  • 深入了解直播美颜SDK:GPU加速下的美白滤镜功能实现?
  • 解决 IDEA 中 XML 文件的 “URI is not registered” 报错
  • html5+css3+canvas纯前端4字方形LOGO生成器
  • 【C# in .NET】17. 探秘类成员-构造函数与析构函数:对象生命周期管理
  • Beagle 480 USB分析仪
  • 差分数组算法
  • 柴油机活塞cad【4张】三维图+设计说明书
  • ollma dify 搭建合同审查助手
  • RabbitMQ—TTL、死信队列、延迟队列
  • ChatGPT Agent技术架构探析
  • 读书笔记(学会说话)
  • 变频器实习总结3 ISU单元 船舶电力系统
  • 锁步核,为什么叫锁步核?
  • jar命令提取 JAR 文件
  • AI 驱动的仪表板:从愿景到 Kibana
  • MySQL之SQL 优化全攻略:从原理到实战
  • 2025年华为认证之HCIE-云计算方向的报考流程
  • STM32之TB6612电机驱动模块
  • Oracle 11g RAC 高可用集群部署最佳实践
  • Level-MC 8”深暗之域“
  • 面向对象三大特性---继承
  • 大数据安全规划总体方案
  • 【深度学习】神经网络 批量标准化-part6
  • 在 OpenSUSE Tumbleweed 和 Leap 上安装 VirtualBox