Zabbix Monitoring Linux Host Setup method _zabbix

Source: Internet
Author: User
Tags curl gettext openssl iptables

Description

The Zabbix monitoring server is already configured and now uses Zabbix to monitor the Linux host.

Specific actions:

The following operations are performed on a monitored Linux host, taking the CentOS 6.x system as an example.

First, configure the firewall, open 10050, 10051 TCP and UDP ports

Vi/etc/sysconfig/iptables #编辑防火墙配置文件

-A input-s 192.168.21.127-m state--state new-m tcp-p TCP--dport 10050:10051-j ACCEPT

-A input-s 192.168.21.127-m state--state new-m udp-p UDP--dport 10050:10051-j ACCEPT

: wq! #保存退出

Service iptables restart #重启防火墙使配置生效

Description: 192.168.21.127 is the IP address of the Zabbix server, which means that the port is open only to this IP, if it is to be open to all IP, the rules are as follows:

-A input-m state--state new-m tcp-p TCP--dport 10050:10051-j ACCEPT

-A input-m state--state new-m udp-p UDP--dport 10050:10051-j ACCEPT

Second, close SELinux

Vi/etc/selinux/config

#SELINUX =enforcing #注释掉

#SELINUXTYPE =targeted #注释掉

selinux=disabled #增加

: wq! #保存退出

Setenforce 0 #使配置立即生效

Third, install Zabbix client

1, Zabbix package download

zabbix-2.2.6

Http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.6/zabbix-2.2.6.tar.gz

Upload zabbix-2.2.6.tar.gz to server/usr/local/src directory

2, add Users

Groupadd Zabbix #创建用户组zabbix

Useradd zabbix-g zabbix-s/bin/false #创建用户zabbix and adds user Zabbix to the user group Zabbix

3. Installation Zabbix

Ln-s/usr/local/lib/libiconv.so.2/usr/lib/libiconv.so.2 #添加软连接

/sbin/ldconfig #使配置立即生效

Cd/usr/local/src

Tar zxvf zabbix-2.2.6.tar.gz

CD zabbix-2.2.6

./configure--prefix=/usr/local/zabbix--enable-agent #配置

Make #编译

Make install #安装

Ln-s/usr/local/zabbix/sbin/*/usr/local/sbin/ #添加系统软连接

Ln-s/usr/local/zabbix/bin/*/usr/local/bin/ #添加系统软连接

Note: The compiler installation software needs to first install the system software package, such as the compiler CentOS use the following command to install

Yum install apr* autoconf automake Bison cloog-ppl compat* cpp Curl curl-devel fontconfig fontconfig-devel freetype freety pe* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-deve L krb5-devel libcom_err-devel libpng* libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 L Ibxml2-devel libxpm* libtiff libtiff* libx* make MPFR ncurses* ntp OpenSSL openssl-devel patch pcre-devel perl php-common PHP-GD policycoreutils ppl telnet t1lib t1lib* nasm nasm* wget zlib-devel

4, add the Zabbix service corresponding port

Echo ' zabbix-agent 10050/tcp #Zabbix agent ' >>/etc/services

Echo ' zabbix-agent 10050/udp #Zabbix agent ' >>/etc/services

Echo ' Zabbix-trapper 10051/tcp #Zabbix trapper ' >>/etc/services

Echo ' Zabbix-trapper 10051/udp #Zabbix trapper ' >>/etc/services

Or

Vi/etc/services #编辑, add the following code at the end

# 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

: wq! #保存退出

5, modify the Zabbix configuration file

vi/usr/local/zabbix/etc/zabbix_agentd.conf #编辑

server=192.168.21.127

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

Unsafeuserparameters=1 #启用自定义key

: wq! #保存退出

Note: 192.168.21.127 is the Zabbix server IP address

6. Add Boot Script

Cp/usr/local/src/zabbix-2.2.6/misc/init.d/fedora/core/zabbix_agentd/etc/rc.d/init.d/zabbix_agentd

Vi/etc/rc.d/init.d/zabbix_agentd #编辑

basedir=/usr/local/zabbix/ #Zabbix安装目录

: wq! #保存退出

chmod +x/etc/rc.d/init.d/zabbix_agentd #添加脚本执行权限

Chkconfig zabbix_agentd on #添加开机启动

Service Zabbix_agentd start #启动Zabbix客户端

PS ax|grep zabbix_agentd #检查Zabbix客户端是否正常运行

NETSTAT-UTLNP | grep Zabbix #检查Zabbix客户端是否正常运行

Test Zabbix client and Zabbix service end communication is normal

The following code executes on the Zabbix server

/usr/local/zabbix/bin/zabbix_get-s192.168.21.128-p10050-k "System.uptime"

5049866 #有数据显示说明通信正常

Note: 192.168.21.128 is the Zabbix client IP address

Five, add to the Linux host monitoring

Open in Browser:

http://192.168.21.127/zabbix/ #Zabbix服务端访问地址

Configuration-Host

Creating a Host

Host Name:192.168.21.128

Group:Linux Servers

interface of endpoint Agent-ip address:192.168.21.128

Status: under Monitoring

Other options can be done by default

Switch to Template

Choose

Selection:Template OS Linux

Point add

Archive

At this point, Zabbix monitoring the Linux host setup is complete.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.