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. Python3.5学习之旅——day2

    本节内容: 1.模块初识 2..pyc是什么? 3.Python的数据类型 4.三元运算 5.进制 6.byte类型 7.数据运算 8.列表 9.元组 10.课后练习 一.模块初识 由day1的学习我 ...

  2. 剑指offer第二版速查表

    3.数组中重复数字:每个位置放置数字与下标对应相等 O(n) 4.二维数组中的查找:右下角开始比较 O(m+n) 5.替换空格:python直接替换 6.从尾到头打印链表: 借助栈或直接利用系统调用栈 ...

  3. sqlmap命令手册

    http://127.0.0.1/sqli-labs-master/Less-1/?id=1 当给sqlmap上面这么一个url的时候,它会自动: 1.判断可注入的参数 2.判断可以用那种SQL注入技 ...

  4. 三 Spring和DI(面试)

      IOC:控制反转,将对象的创建权反转给了Spring DI:依赖注入,前提要有IOC的环境.Spring管理这个类的时候会将类的依赖的属性,在xml注入(设置)进来. 面向对象的时候,类和类之间的 ...

  5. 2019 深信服 下棋(DFS+回溯)

    链接:https://www.nowcoder.com/questionTerminal/a0feb0696e2043a5b3b0779fa861b64a?f=discussion来源:牛客网 8x8 ...

  6. Python函数-1 range()函数

    range()函数 在其他语言中,如果想要循环一个变量从1到100,要怎么写呢? for(i = 1,i<=100,i++){} python怎么实现这个功能呢?python设计了range() ...

  7. Redis实战(20)Redis 如何从海量数据中查询出某一个 Key?

    序言 资料 https://www.cnblogs.com/vipstone/p/12373734.html

  8. Codeforces 599D:Spongebob and Squares

    D. Spongebob and Squares time limit per test 2 seconds memory limit per test 256 megabytes input sta ...

  9. centos7一步一步搭建docker nginx 及重点讲解

    系统环境:centos7.7 (VMware中) images版本:nginx:latest (截止2020.01.10最新版) 1.拉取镜像 docker pull nginx 2.启动nginx容 ...

  10. 中山Day10——普及

    今天又是愚蠢的一天,估分230,实得110.其中T2.4不会,这里就只说题意和简要思路. 收获:scanf>>a,以及printf<<a. T1:模板题 此题相对简单,就是读入 ...