Zabbix Agent的安装和使用

最近需要在服务器集群上监控服务器们的CPU和RAM的使用情况,zabbix 主服务器在US, agent 安装在监控的服务器上.

总的来说其实很简单,主要就是两个步骤:

  1. 安装zabbix agent 组件并且设置好conf文件
  2. 防火墙打开10050端口或者直接whitelist zabbix主服务器的IP

 

下面是详细的步骤:

1 安装组件

4.4 for centos and debian

Centos 7: 

rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm

yum install zabbix-agent

Centos 8:

rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm

yum install zabbix-agent

Debian 9:

# wget https://repo.zabbix.com/zabbix/4.4/debian/pool/main/z/zabbix-release/zabbix-release_4.4-1+stretch_all.deb
# dpkg -i zabbix-release_4.4-1+stretch_all.deb
# apt update

#apt install zabbix-agent

Debian 10:

# wget https://repo.zabbix.com/zabbix/4.4/debian/pool/main/z/zabbix-release/zabbix-release_4.4-1+buster_all.deb
# dpkg -i zabbix-release_4.4-1+buster_all.deb
# apt update

#apt install zabbix-agent

zabbix 5.0 LTS for debian 9

# wget https://repo.zabbix.com/zabbix/5.0/debian/pool/main/z/zabbix-release/zabbix-release_5.0-1+stretch_all.deb
# dpkg -i zabbix-release_5.0-1+stretch_all.deb
# apt update

# apt install zabbix-agent

zabbix 5.0 LTS for centos 7

# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

# yum install zabbix-agent

2 修改配置文件

无论centos 还是debian,都是在/etc/zabbix/zabbix-agentd.conf

agent 可以以两种模式运行: passive 和 active,我们一般使用passive 模式就可以,也最简单,只需要修改

Passive checks related下面的Server IP就可以

默认的是Server=127.0.0.1, 把127.0.0.1改成你的zabbix 主服务器的IP就可以了

3 防火墙打开10050 端口或者直接whitelist 你的zabbix主服务器的IP就可以了

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.