The Xenserver7 host uses yum to install the zabbix client

foreword

The company has been using zabbix as the company's internal server monitoring, newly built XenServer7, and wants to join the zabbix monitoring, which is convenient for unified management and control. Don't ask why you have to join zabbix, you just want to control it in a unified way. If you see this article, it means that we have a fate. Congratulations, you can achieve it.

I have searched a lot on Baidu, basically excerpting or even plagiarizing others for the sake of click-through rate, and many basically cannot solve the actual problem, and some even say to change the key components of the system such as lib.so, you must know that this is a very important Dangerous things, once the failure will lead to the direct collapse of the system, not only the purpose cannot be achieved, but it will backfire and cause irreparable mistakes! And some blogs don't even show the seriousness and importance of the revision! I still hope that everyone can write some technical documents with their own opinions and ideas.

statement

系统版本:XenServer7.0
zabbix版本:3.0

==XenServer6.x needs to be modified according to its own environment. If you understand it, XenServer6.x is not a problem! ==

Install

There are two ways

第一,使用yum安装。简单快捷,但默认XenServer7的yum源是封闭的,并且是基于Centos7的内测版本二次封装,所以要先把yum源配置好才行。

第二,使用rpm包安装,也就是说系统提示什么你就装什么,前提是找对版本和有耐心,因为需要的环境组件着实很多。比如zabbix-agent依赖unixODBC而unixODBC又依赖libtool-ltdl等,装下来要装十几个环境组件

So we use method one here. First, we directly use yum to install and test to see the error modification.

http://mirror.centos.org/centos/7-2.1511.el7.centos.2.10/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found

It is found that the file cannot be found, but open the centos source official website http://mirror.centos.org/ 7.2.1511 source directory to get the following information

This directory (and version of CentOS) is deprecated.  For normal users,
you should use /7/ and not /7.2.1511/ in your path. Please see this FAQ
concerning the CentOS release scheme:

https://wiki.centos.org/FAQ/General

If you know what you are doing, and absolutely want to remain at the 7.2.1511
level, go to http://vault.centos.org/ for packages. 

Please keep in mind that 7.2.1511 no longer gets any updates, nor
any security fix's.

I was told that the source of centos7 should be used, but 7.2.1511 is used by default, so we need to point it to centos7 and change it to the yum source path of centos7

http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml

Modify all the [$releasever] variables in the CentOS-Base.repo file to the number [7], which is the name of the centos7 directory, and enable this configuration

mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os&infra=$infra
baseurl=http://mirror.centos.org/centos/7/os/$basearch/
enabled=1

Posted my CentOS-Base.repo configuration information

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os&infra=$infra
baseurl=http://mirror.centos.org/centos/7/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

After wq saves and exits, update the yum cache to take effect immediately

yum clean all

Next, you can use yum to install the required environment components

yum install -y unixODBC glibc* ld-linux.so.2

To install the zabbix client, you can also use the source installation package

rpm -ivh zabbix-agent-3.0.3-1.el6.x86_64.rpm
warning: zabbix-agent-3.0.3-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-agent-3.0.3-1.el6         ################################# [100%]

Change the zabbix server address

vi zabbix_agentd.conf
Server=[你的zabbix服务器IP]
ServerActive=[你的zabbix服务器IP]
Hostname=[主机名]

Enable zabbix-agent service

systemctl start zabbix-agent

join boot

chkconfig zabbix-agent on

detect

==Note to turn off firewall and selinux or add permission==

Check if the service is normal

systemctl status zabbix-agent
zabbix-agent.service - LSB: Start and stop Zabbix agent
   Loaded: loaded (/etc/rc.d/init.d/zabbix-agent)
   Active: active (running) since Mon 2018-01-22 14:11:45 CST; 1s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 7376 ExecStart=/etc/rc.d/init.d/zabbix-agent start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/zabbix-agent.service
           ├─7383 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
           ├─7385 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
           ├─7386 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
           ├─7387 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
           ├─7388 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
           └─7389 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]

Power-on auto-start detection

chkconfig | grep zabbix
Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

zabbix-agent   	0:off	1:off	2:on	3:on	4:on	5:on	6:off

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324452871&siteId=291194637