Home > Backend Development > PHP Tutorial > Zabbix_agent deployment_PHP tutorial

Zabbix_agent deployment_PHP tutorial

WBOY
Release: 2016-07-12 08:51:50
Original
984 people have browsed it

Zabbix_agent deployment

Reference documents:

1. zabbix monitors linux host: http://www.osyunwei.com/archives /8035.html

1. Environment

Server: Based on CentOS-7-x86_64-1511, zabbix-3.0.1 server has been deployed

ServerIP: 192.168.11.252

Agent: CentOS-6.4- x86_64

AgentIP: 192.168.21.252, the route is reachable server

2. Software acquisition

Zabbix official website download address: http://www.zabbix.com/download.php

The current latest LTS version download address: http://jaist.dl.sourceforge.net /project/zabbix/ZABBIX Latest Stable/3.0.1/zabbix-3.0.1.tar.gz

3. Preparation

1. iptables settings

[root@localhost ~]# vim /etc/sysconfig/iptables

-A INPUT -s 192.168.11.252 -p tcp -m state --state NEW -m tcp--dport 10050 -j ACCEPT

-A OUTPUT -d 192.168.11.252 -p tcp -m state --state NEW -m tcp--dport 10051 -j ACCEPT

#zabbix_agent port 10050, the agent adopts passive mode, and the server actively connects to the agent; the agent also has an active mode, which can be configured in the agent's configuration file

# zabbix_trapper port 10051, agent active or trapper Method to connect to the server

# The server ip is specified here for security, which can be ignored

2. selinux

[root@localhost~]# getenforce

# Check whether selinux is closed. If it is running, it needs to be closed

[root@localhost~]# vim /etc/selinux/config

#SELINUX=enforcing

SELINUX=disabled

[root@localhost~]# setenforce 0

# Make the configuration take effect immediately

4. Install zabbix_agent

1. Dependency packages

Description: zabbix_agent requires relatively few dependency packages, but basic compilation dependency packages are still needed, such as gcc, gcc-c, etc. The initial centos system here is installed according to the compilation environment. The compilation and installation went smoothly. It is not certain which dependent packages are needed in addition to the basic compilation environment. Readers can try compilation and installation first, and deal with any errors if they occur.

2. Add user

groupaddzabbix

useradd-g zabbix -s /sbin/nologin zabbix

#Create user zabbix and add user zabbix Go to user group zabbix

3. Add service port

vim/etc/services

# Zabbix

zabbix-agent 10050/tcp # Zabbix Agent

zabbix-agent 10050/udp # Zabbix Agent

zabbix-trapper 10051/tcp # Zabbix Trapper

zabbix-trapper 10051/udp # Zabbix Trapper

#Add the port corresponding to the zabbix service.

has been added in the default services document. 4. Install zabbix_agent

ln -s/usr/local/lib/libiconv.so .2 /usr/lib/libiconv.so.2

/sbin/ldconfig

#Make the configuration take effect immediately

#It is possible that libiconv.so.2 cannot be found file, no impact has been found yet

tar -zxvf/usr/local/src/zabbix-3.0.1.tar.gz

cd/usr/local /src/zabbix-3.0.1

./configure--prefix=/usr/local/zabbix --enable-agent

#Only install zabbix_agent

make

makeinstall

ln -s/usr/local/zabbix/sbin/* /usr/local/sbin/

ln -s/usr/ local/zabbix/bin/* /usr/local/bin/

#Add soft links to zabbix_agent related execution files

5. Configuration

Modify zabbix_agnet configuration file

vim /usr/local/zabbix/etc/zabbix_agentd.conf

Server=192.168.11.252

Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d /

UnsafeUserParameters=1

#Enable custom key

Add boot script

cp/usr/local/src/zabbix-3.0.1 /misc/init.d/fedora/core/zabbix_agentd/etc/rc.d/init.d/zabbix_agentd

#Client

chownzabbix:zabbix /etc /rc.d/init.d/zabbix_agentd

chmod x/etc/rc.d/init.d/zabbix_agentd

#Add script execution permissions

vim/etc/rc.d/init. d/zabbix_agentd

BASEDIR=/usr/local/zabbix/

#Edit the installation directory of zabbix in the client startup script

chkconfig-- level 35 zabbix_agentd on

#Add boot startup

6. Startup verification

service zabbix_agentdstart

ps aux |grep zabbix_agentd

netstat-tunlp | grep zabbix

# Check whether the Zabbix client is running normally

Test whether the communication between the Zabbix client and the Zabbix server is normal, as follows The command is executed on the zabbix server:

zabbix_get-s 192.168.21.252 -p 10050 -k "system.uptime"

2533194

#If there is data echo, the communication is normal , 192.168.21.252 is the zabbix client IP address; if the echo is abnormal, you can check the agent log. According to the file configuration, the default is /tmp/zabbix_agentd.log

5. Add linux host monitoring

1. Create a host

Open the zabbix server in the browser:

http://192.168.11.252/zabbix

ConfigurationàHostsàCreate host

2. Host information

under the Host tag:

Customize "Host name";

Select "Groups", if not, create a new "Newgroup";

Select "Agentinterfaces" for monitoring mode, fill in "IP ADDRESS", the default is Connect to port 10050 in IP mode, do not make any changes, and leave the rest as default.

3. Select the monitoring template

Under the Templates tab:

"Link new templates", Selectà selected Template OSLinux Template àAdd confirms adding the template, and the added template will be displayed in "Linked Templates";

Click the "Add" button at the bottom of the page, and the host is added successfully.

4. Status Observation

The host is added successfully and automatically returns to the Hosts page. For the created host, mainly observe the status of "STATUS" and "AVAILABILITY", as follows:

If the status is abnormal, you can check the server-side log, according to the configuration file , the default is /tmp/zabbix_server.log.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1128023.htmlTechArticleZabbix_agent deployment reference document: 1. zabbix monitors linux host: http://www.osyunwei.com/archives/ 8035.html 1. Environment Server: Based on CentOS-7-x86_64-1511, zabbix-3.0.1 service has been deployed...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template