Zabbix 监控Postgresql数据库,用grafana来实现可视化:(二)CentOS 7 安装 zabbix- Agent

# 前言

本系列文章总共分为4篇,主要描述使用Zabbix 监控Postgresql数据库,并且用grafana来实现可视化。
文章部分内容也借鉴了许多博主的想法。我将部署的每一步都放到文章中,部分代码来自其他博主的也在文章结尾的总结处放了连接,大家可以去看原文。文章仅供参考,也欢迎大家在下面提出补足和建议。这是第二篇:安装zabbix-Agent
 

 一、部署工具及环境
FinalShell 4.5.12: 连接虚拟机工具
虚拟机: VMware- CentOS 7
- Zabbix Server: 192.168.130.84 (4.0版本)
- Zabbix Agent (也就是数据库所在的机子上):192.168.130.85 (4.10 版本)
- Grafana: 192.168.130.90

二、 安装Zabbix - Agent

1. 使用清华大学的镜像开源网站下载rpm包安装。此方法可以用在被隔离的物理环境中。

 链接:Index of /zabbix/zabbix/4.4/rhel/7/x86_64/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

下载4.4.10版本

2. 把rpm包放到/root目录中

3. 安装

rpm -ivh zabbix-agent-4.4.10-1.el7.x86_64.rpm

4. 修改配置文件

vi /etc/zabbix/zabbix_agentd.conf
### Option: Server
#    List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies.
#    Incoming connections will be accepted only from the hosts listed here.
#    If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
#    and '::/0' will allow any IPv4 or IPv6 address.
#    '0.0.0.0/0' can be used to allow any IPv4 address.
#    Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
#
# Mandatory: yes, if StartAgents is not explicitly set to 0
# Default:
# Server=
Server=192.168.130.84

### 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: 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.130.84

5. 设置自启动,并且启动zabbix - agent

​
systemctrl enable zabbix-agent

systemctrl start zabbix-agent

systemctrl status zabbix-agent

​

6. 查看 zabbix -agent 版本

[root@localhost ~]# rpm -qi zabbix-agent
Name        : zabbix-agent
Version     : 4.4.10
Release     : 1.el7
Architecture: x86_64
Install Date: 2024年10月23日 星期三 15时18分41秒
Group       : Applications/Internet
Size        : 1812451
License     : GPLv2+
Signature   : RSA/SHA512, 2020年06月29日 星期一 20时33分26秒, Key ID 082ab56ba14fe591
Source RPM  : zabbix-4.4.10-1.el7.src.rpm
Build Date  : 2020年06月29日 星期一 19时57分01秒
Build Host  : builds.zabbix.lan
Relocations : (not relocatable)
URL         : http://www.zabbix.com/
Summary     : Old Zabbix Agent
Description :
Old implementation of zabbix agent.
To be installed on monitored systems.

8. 在Web端配置 Agent

在Web端按照图中的指示操作:

检查状态:

三、报错

如果发现无法启动,可以查看日志

sudo tail -f /var/log/zabbix/zabbix_agentd.log

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xixiya_49346343

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值