CentOS操作系统部署zabbix agent服务

                              作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.查看zabbix的官方手册

1>.点击下载

2>.查看Ubuntu操作系统的安装文档

  博主推荐阅读:
    https://www.zabbix.com/cn/download?zabbix=4.0&os_distribution=centos&os_version=7&db=mysql&ws=apache
    https://www.zabbix.com/documentation/4.0/zh/manual

二.基于yum方式安装zabbix agent

1>.安装zabbix官方的安装yum源

[root@node201.yinzhengjie.org.cn ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.rwZ29x: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing... ################################# [%]
Updating / installing...
:zabbix-release-4.0-.el7 ################################# [%]
[root@node201.yinzhengjie.org.cn ~]#

[root@node201.yinzhengjie.org.cn ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

  有时候zabbix官网的yum源并不太稳定比如"2020-02-28 08:00",有图有真相,如下图所示:

2>.使用阿里的软件源替换zabbix官网的软件源

[root@node201.yinzhengjie.org.cn ~]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/
enabled=
gpgcheck=
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/debuginfo/
enabled=
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck= [zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled=
gpgcheck=
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/$basearch/debuginfo/
enabled=
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck= [zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/
enabled=
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]#

[root@node201.yinzhengjie.org.cn ~]# sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo

3>.安装zabbix agent

[root@node201.yinzhengjie.org.cn ~]# yum -y install  zabbix-agent
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.aliyun.com
* updates: mirrors.tuna.tsinghua.edu.cn
base | 3.6 kB ::
docker-ce-stable | 3.5 kB ::
extras | 2.9 kB ::
kubernetes | 1.4 kB ::
updates | 2.9 kB ::
zabbix | 2.9 kB ::
zabbix-non-supported | B ::
(/): base//x86_64/group_gz | kB ::
(/): extras//x86_64/primary_db | kB ::
(/): docker-ce-stable/x86_64/updateinfo | B ::
(/): docker-ce-stable/x86_64/primary_db | kB ::
(/): kubernetes/primary | kB ::
(/): zabbix/x86_64/primary_db | kB ::
(/): base//x86_64/primary_db | 6.0 MB ::
(/): updates//x86_64/primary_db | 6.7 MB ::
zabbix-non-supported/x86_64/primary | 1.6 kB ::
kubernetes /
zabbix-non-supported /
Resolving Dependencies
--> Running transaction check
---> Package zabbix-agent.x86_64 :4.0.-.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved ==============================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================================================================================================================================
Installing:
zabbix-agent x86_64 4.0.-.el7 zabbix k Transaction Summary
==============================================================================================================================================================================================================================================================================
Install Package Total download size: k
Installed size: 1.6 M
Downloading packages:
warning: /var/cache/yum/x86_64//zabbix/packages/zabbix-agent-4.0.-.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Public key for zabbix-agent-4.0.-.el7.x86_64.rpm is not installed
zabbix-agent-4.0.-.el7.x86_64.rpm | kB ::
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
Importing GPG key 0xA14FE591:
Userid : "Zabbix LLC <packager@zabbix.com>"
Fingerprint: a184 8f53 52d0 22b9 471d 83d0 082a b56b a14f e591
Package : zabbix-release-4.0-.el7.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : zabbix-agent-4.0.-.el7.x86_64 /
Verifying : zabbix-agent-4.0.-.el7.x86_64 / Installed:
zabbix-agent.x86_64 :4.0.-.el7 Complete!
[root@node201.yinzhengjie.org.cn ~]#

[root@node201.yinzhengjie.org.cn ~]# yum -y install zabbix-agent

4>.修改zabbix agent的配置文件

[root@node201.yinzhengjie.org.cn ~]# grep ^Server= /etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# sed -r -i 's#(Server=)127.0.0.1#\1172.200.5.203,172.200.3.205#' /etc/zabbix/zabbix_agentd.conf
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# grep ^Server= /etc/zabbix/zabbix_agentd.conf
Server=172.200.5.203,172.200.3.205
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]#

[root@node201.yinzhengjie.org.cn ~]# sed -r -i 's#(Server=)127.0.0.1#\1172.200.5.203,172.200.3.205#' /etc/zabbix/zabbix_agentd.conf        #指定zabbix agent被动工作模式的zabbix server

[root@node201.yinzhengjie.org.cn ~]# grep ^ServerActive= /etc/zabbix/zabbix_agentd.conf
ServerActive=127.0.0.1
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# sed -r -i 's#(ServerActive=)127.0.0.1#\1172.200.3.205#' /etc/zabbix/zabbix_agentd.conf
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# grep ^ServerActive= /etc/zabbix/zabbix_agentd.conf
ServerActive=172.200.3.205
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]#

[root@node201.yinzhengjie.org.cn ~]# sed -r -i 's#(ServerActive=)127.0.0.1#\1172.200.3.205#' /etc/zabbix/zabbix_agentd.conf             #指定zabbix agent主动工作模式的zabbix proxy

[root@node201.yinzhengjie.org.cn ~]# grep ^Hostname= /etc/zabbix/zabbix_agentd.conf
Hostname=Zabbix server
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# sed -r -i 's#(Hostname=)Zabbix server#\1node201.yinzhengjie.org.cn#' /etc/zabbix/zabbix_agentd.conf
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# grep ^Hostname= /etc/zabbix/zabbix_agentd.conf
Hostname=node201.yinzhengjie.org.cn
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]#

[root@node201.yinzhengjie.org.cn ~]# sed -r -i 's#(Hostname=)Zabbix server#\1node201.yinzhengjie.org.cn#' /etc/zabbix/zabbix_agentd.conf      #指定zabbix agent的主机名名称

5>.启动zabbix agent并设置为开机自启动

[root@node201.yinzhengjie.org.cn ~]# ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 127.0.0.1: *:*
LISTEN 127.0.0.1: *:*
LISTEN *: *:*
LISTEN ::: :::*
LISTEN ::: :::*
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# systemctl start zabbix-agent.service
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 127.0.0.1: *:*
LISTEN 127.0.0.1: *:*
LISTEN *: *:*
LISTEN *: *:*
LISTEN ::: :::*
LISTEN ::: :::*
LISTEN ::: :::*
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# systemctl list-unit-files | grep zabbix-agent.service
zabbix-agent.service disabled
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# systemctl enable zabbix-agent.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# systemctl list-unit-files | grep zabbix-agent.service
zabbix-agent.service enabled
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]# systemctl status zabbix-agent.service
● zabbix-agent.service - Zabbix Agent
Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: disabled)
Active: active (running) since Thu -- :: CST; 38s ago
Main PID: (zabbix_agentd)
CGroup: /system.slice/zabbix-agent.service
├─ /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
├─ /usr/sbin/zabbix_agentd: collector [idle sec]
├─ /usr/sbin/zabbix_agentd: listener # [waiting for connection]
├─ /usr/sbin/zabbix_agentd: listener # [waiting for connection]
├─ /usr/sbin/zabbix_agentd: listener # [waiting for connection]
└─ /usr/sbin/zabbix_agentd: active checks # [idle sec] Feb :: node201.yinzhengjie.org.cn systemd[]: Starting Zabbix Agent...
Feb :: node201.yinzhengjie.org.cn systemd[]: Can't open PID file /run/zabbix/zabbix_agentd.pid (yet?) after start: No such file or directory
Feb :: node201.yinzhengjie.org.cn systemd[]: Started Zabbix Agent.
[root@node201.yinzhengjie.org.cn ~]#
[root@node201.yinzhengjie.org.cn ~]#

[root@node201.yinzhengjie.org.cn ~]# systemctl start zabbix-agent.service

CentOS操作系统部署zabbix agent服务的更多相关文章

  1. Ubuntu操作系统部署zabbix agent服务

    Ubuntu操作系统部署zabbix agent服务 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.下载zabbix软件包 博主推荐阅读: https://www.cnblog ...

  2. 运维监控-基于yum的方式部署 Zabbix Agent 4.0 版本

    运维监控-基于yum的方式部署 Zabbix Agent 4.0 版本 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 上一篇博客我们分享了如何基于yum的方式部署zabbix 4. ...

  3. CENTOS安装部署zabbix

    果学网 -专注IT在线www.prismcollege.com 參考原文:http://www.showerlee.com/archives/13 RHCE过的EMAIL已经下来.所以近期闲了就准备把 ...

  4. CentOS 7 实现zabbix agent 自动添加,并链接到指定的模版

    如果添加的agent端数量较少时 , 手动添加还是可以的 , 如果数量较多 , 那么zabbix-server 的Discovery自动发现功能便派上了用场 首先所需要加入的服务器zabbix-age ...

  5. centos6.5安装部署zabbix监控服务端和客户端

    部署zabbix服务端需要LNMP环境(nginx,mysql,php),其它数据库也可以,我这里使用mysql,关于LNMP环境部署,可以参考我的另一遍文章:http://www.cnblogs.c ...

  6. Centos/Rhel7部署Zabbix监控(部署篇之服务器篇)

    Zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案. Zabbix能监视各种网络参数,保证服务器系统的安全运营:并提供灵活的通知机制以让系统管理员快速定位/解决 ...

  7. centos 安装部署zabbix

    Zabbix_server初始安装部署 各模块要安装的模块 Server:server+nginx+mysql+php Agentd:agentd Proxy:proxy+mysql 1.准备环境: ...

  8. 【docker部署】基于linux的centos操作系统部署安装docker容器

    一.docker介绍 容器是轻量级的,包含应用运行所需所有东西(代码.库.运行时环境.系统设置,以及依赖关系)的独立的包.每个容器都部署于它自己的 CPU.内存.块 I/O,以及网络资源上,所有这些都 ...

  9. 通过ansible自动化部署zabbix应用

    zabbix在实际的应用中,可能需要监控的主机非常多,而每个主机的操作系统类型.版本也都不尽相同,在这种环境下,通过手动安装zabbix的agent端已经不现实了,此时就需要借助自动化工具完成zabb ...

随机推荐

  1. 关于数据库中的三值逻辑(Tree-Value-Logic)

    在sql中,逻辑表达式(也叫做谓词),可以有三种值:True.False.Unknown,这就是所谓的三值逻辑,,是sql的特有属性. 在大多数编程语言中,逻辑表达式只有两个值,就是True和Fals ...

  2. windows之杀死端口

    提示: 查询端口 查询pid 杀死任务 通过 cmd 进入控制台: 查询端口: netstat -aon|findstr 1111 查询pid下的任务: tasklist|findstr 6616 杀 ...

  3. 同一条sql insert 有时快有时慢 引发的血案

    同一条sql语句,为什么有时插入块,有时插入慢原因剖析 背景:同一条sql ,有时插入时间几毫秒,有时插入时间几十毫秒,为什么? Sql角度:简单insert 表角度: 一个主键 系统参数角度: 开启 ...

  4. The property does not exist in XML namespace

    自定义依赖属性,绑定在xaml文件中,无问题. 但是编译失败,报 The property does not exist in XML namespace 错误. 发现如果依赖属性定义在本程序集中,在 ...

  5. win10 设置jdk环境变量

    win10环境变量较为特殊 只需要设置JAVA_HOME和PATH,设置后可以通过java -version 和 javac -version 验证查看jdk得版本号和编译版本号 具体如下图所示:

  6. ios中使用socket实现聊天

    [iOS]SocketRocket简单实现聊天室功能 https://www.jianshu.com/p/db34940f1135      CocoaAsyncSocket   https://gi ...

  7. Java基础知识笔记第四章:类和对象

      编程语言的几个发展阶段 面向机器语言 面向过程语言 面向对象语言:封装.继承.多态 类 类声明 class Person{ ....... } class 植物{ ....... } 类体 类使用 ...

  8. postman 使用post方式提交参数值

    参考:https://www.cnblogs.com/haoxuanchen2014/p/7771459.html

  9. 建设基于TensorFlow的深度学习环境

    一.使用yum安装git 1.查看系统是否已经安装git git --version 2.yum 安装git yum install git 3.安装成功 git --version 4.进入指定目录 ...

  10. unity 骨骼 蒙皮

    https://blog.csdn.net/weixin_44350205/article/details/100551233 https://www.jianshu.com/p/d5e2870eb3 ...