DEBIAN8 Mounting Zabbix 3.0

Source: Internet
Author: User
Tags gz file

First, install the configuration Zabbix server

Web Server server: 172.28.0.187

MySQL server: 172.28.0.237

1. Install Web server (172.28.0.187) A, official documents

Zabbix officially provides installation documentation based on packages and compiled installation methods.

Here server I use the package method installs, the agent uses the source code compiles the way installs, because the server has only one, but the agent has many, needs to modify the configuration and repack to the installed agent, in order to facilitate the late batch deployment.

There are release packages in the Zabbix package because Zabbix server needs to be mysql,apache,php and the release package installs automatically to resolve dependencies.

B, Release package download

[Email protected]:~# wget http://repo.zabbix.com/zabbix/3.0/debian/pool/main/z/zabbix-release/zabbix-release_ 3.0-1+jessie_all.deb
C, install the release warehouse
[Email protected]:~# dpkg-i Zabbix-release_3.0-1+jessie_all.deb
D, update apt Warehouse
[Email protected]:~# Aptitude Update
E, install Zabbix-server-mysql and zabbix-frontend-php

During the installation process make sure to connect to the Internet, the source of the warehouse is recommended with Debian official source, here Server-mysql will automatically solve the MySQL dependency installation mysql,frontend-php will solve the Apache and PHP dependencies

[Email protected]:~ #aptitude install zabbix-server-mysql [email protected]:~ #aptitude Install zabbix-frontend-php

After installing Zabbix-server-mysql, a/usr/share/doc/zabbix-server-mysql/create.sql.gz file is generated, which is later used in the MySQL server

2. Configure MySQL server (172.28.0.237)

Go to MySQL server 172.28.0.237, you need to install MySQL in advance, if you are using database on Web server, configure the database of Web server

A. Enter MySQL

This is because the MySQL database server in our company is dedicated to MySQL users, so we need to switch users first

[Email protected]:~# su-mysql[email protected]:~# MySQL
B, create the Zabbix table, encoded as UTF8
Mysql> CREATE database Zabbix character set UTF8 collate utf8_bin;
C. Create a Zabbix user and authorize the Zabbix user Zabbix table

The authorization scope is the whole network, the user is the Zabbix password is 123321qQ

Mysql> Grant all privileges the zabbix.* to [email protected] '% ' identified by ' 123321qQ ';

Authorization range is local, user is Zabbix password is 123321qQ

Mysql> Grant all privileges the zabbix.* to [e-mail protected] identified by ' 123321qQ ';
D. Refresh MySQL Permissions
mysql> flush Privileges;
E. Import the file create.sql.gz into the Zabbix table

Install the generated Zabbix table in release mode is not the Schema.sql and Images.sql and data.sql three tables, but concentrated in create.sql, if this is the three table, please import these three tables in the Zabbix table just created

Because my create.sq.gz here are on the Web server, so I need to copy them.

#将172./usr/share/doc/zabbix-server-mysql/create.sql.gz passed to 172.28.0.237[email protected]:~# Scp/usr/share under 28.0.187 /doc/zabbix-server-mysql/create.sql.gz [email protected]:/root[email protected]:~# cp/root/create.sql.gz/home/ Mysql/create.sql.gz
#切换到mysql用户导入表格到zabbix [email protected]:~# su-mysql[email protected]:~$ zcat create.sql.gz | Mysql-uzabbix-p "123321qQ" Zabbix

If the machine configuration is low, the import time is very long, please wait patiently

3. Modify the Web server configuration file (172.28.0.187) A, enter 172.20.0.187 modify/etc/zabbix/zabbix_server.conf
[Email protected]:~# vi/etc/zabbix/zabbix_server.conf# Modify several dbhost=172.28.0.237 #mysql服务器地址DBName =zabbix #表名DBUser =zabbix #用户名DBPassword =123321qq #密码
B. Modify the time zone in/etc/apache2/conf-enabled/zabbix
[Email protected]:~# vim/etc/apache2/conf-enabled/zabbix.conf# Find the following line comment cancellation, instead, as I am here in Chongqing, so it is Chongqing, if it is other places can use other PHP_ Value Date.timezone asia/chongqing
C, set language is Chinese
[Email protected]:~# vim/usr/share/zabbix/include/locales.inc.ph# Modify the following line ' zh_cn ' = [' name ' = ' = ' = ' Chinese (zh_cn) ' ), ' display ' = True],
D, solve the problem of Chinese garbled

Open run in Windows, enter fonts

No renaming required

Upload the file to the/usr/share/zabbix/fonts/directory

#查看字体配置 [email protected]:~# grep font_name /usr/share/zabbix/include/defines.inc.php   -n45:define (' zbx_graph_font_name ',         ' Graphfont ');  //  font file name93:define (' zbx_font_name ',  ' Graphfont '); #确认字体名称是否可以替换 [email protected] : ~# grep graphfont /usr/share/zabbix/include/defines.inc.php  -n45:define (' ZBX_GRAPH_ Font_name ',         ' Graphfont '); // font file  Name93:define (' zbx_font_name ',  ' Graphfont '); #执行快捷替换 [email protected]:~# sed -i  "s/ Graphfont/msyh/g " /usr/share/zabbix/include/defines.inc.php# confirm whether the replacement was successful [Email protected]:~# grep  font_name /usr/share/zabbix/include/defines.inc.php  -n45:define (' ZBX_GRAPH_FONT_NAME ',          ' Msyh ');  // font file name93:define (' Zbx_ Font_name ',  ' msyh '); 
E. Start Zabbix-server reboot Apache
[Email protected]:~# service zabbix-server start[email protected]:~# service apache2 Restart

4. Enter Web interface initialization settings

Open Http://172.28.0.187/zabbix, Default user name is admin, password is Zabbix, "note case"

Second, compile and install agent, configure and repackage

First, download the source package

Zabbix official website to the source of the package will be server, agent, proxy are placed in a package, so the installation should pay attention to

Find the sources in download, select the 3.0 source package to download

Second, pre-installation preparation

Here I want to compile and install the agent, so I have to do some preparatory work, because it is the first compile installation, so it is best to choose the unused DEBIAN8 host

A. Installing GCC
[Email protected]:~/zabbix-3.0.2# apt-get Install gcc
B, install make
[Email protected]:~/zabbix-3.0.2# apt-get Install make
C, change the ruby source installation fpm, where FPM is installed to prepare for the subsequent production of the Deb package
[Email protected]:~# apt-get Install Ruby-dev rubygems[email protected]:~# gem sources-a https://ruby.taobao.org/[email protected]:~# gem sources-r https://rubygems.org/[email protected]:~# gem sources-l[email protected]:~# gem install FPM
Three, decompression and installation and packaging before the configuration A, unzip the source package
[Email protected]:~# tar-xzvf zabbix-3.0.2.tar.gz
B, pre-installation configuration
[Email protected]:~/zabbix-3.0.2#./configure--prefix=/usr/local/zabbix--sysconfdir=/usr/local/etc--enable-agent --disable-server--disable-proxy#--prefix= installation directory #--sysconfdir= configuration file directory #--enable-agent--disable-server--disable-prox Y Installation Agent does not install server and proxy
C, pre-packaging configuration, here because of the company's standardization requirements, so the agent is installed in the/tmp/installdir
#创建临时目录 [email protected]:~/zabbix-3.0.2# mkdir -p /tmp/installdir/etc/init.d/[email  Copy the protected]:~/zabbix-3.0.2# mkdir -p /tmp/installdir/etc/profile.d/#将编译后的源码包的zabbix-agent file [ Email protected]:~/zabbix-3.0.2# cp -a /root/zabbix-3.0.2/misc/init.d/debian/zabbix-agent  /tmp/installdir/etc/init.d/zabbix_agentd# Modifying the startup script [email protected]:~/zabbix-3.0.2# vim /tmp /installdir/etc/init.d/zabbix_agentdname=zabbix_agentddaemon=/usr/local/zabbix/sbin/${name}desc= "Zabbix  Agentd "pid=/tmp/$NAME. pid# Create environment variable script [email protected]:~# vim /tmp/installdir/etc/profile.d/ Zabbix.sh# zabbix initexport path= $PATH:/usr/local/zabbix/bin:/usr/local/zabbix/sbin# Create post-installation scripts, This script will automatically add the Zabbix user at the time of installation, and automatically add a boot boot if you have to install chkconfig[email protected]:~ #vim  /tmp/install_after.sh#!/bin/ bashuseradd -m -d /home/zabbix -s /bin/bash zabbixecho  ' zabbix   All= (All:all)  nopasSwd:all '  >> /etc/sudoershost= ' hostname ' sed -i  "s%^hostname=.*$%hostname= $host%g"  /usr/local/etc/zabbix_agentd.confsource /etc/profile.d/zabbix.shchkconfig --add zabbix_ agentdchkconfig --level 35 zabbix_agentd onexit 0# Create a pre-uninstall script that will clear the remaining scripts when uninstalling Zabbix user Delete did not write in, the need to write their own [email protected]:~ #vim  /tmp/remove_after.sh#!/bin/bashrm -rf /etc/ Init.d/zabbix_agentdrm -rf /etc/profile.d/zabbix.shrm -rf /var/lib/dpkg/info/zabbix-agentd *source /etc/profileexit 0
Iv. compiling and installing and modifying configuration files A, compiling and installing to the specified directory
[Email protected]:~ #cd/root/zabbix-3.0.2[email protected]:~/zabbix-3.0.2# make install destdir=/tmp/installdir/
B. Modify the configuration file
[Email protected]:~/zabbix-3.0.2# vim/tmp/installdir/usr/local/etc/zabbix_agentd.conf# Modify a few server=172.28.0.187 # Web server server address serveractive=172.28.0.187 #这里再次填入web Server server address, in order to actively upload hostnameitem=system.hostname #因为是要批量部署 in the future, So be sure to modify it to get the hostname, include=/usr/local/etc/zabbix_agentd.conf.d/#这里用于放置自定义的keyUnsafeUserParameters = 1 # This is changed to 1 to start the custom key.
V. Packing with FPM
[Email protected]:/tmp# fpm-s dir-t deb-n zabbix_agentd-v 3.0.2--iteration 1+wheezy-c/tmp/installdir/-p/root/--d Escription ' Zabbix_agentd deb '--post-install/tmp/install_after.sh--post-uninstall/tmp/remove_after.sh#-s specify source Type #- c Specifies the package path #-p specifies the packet output path #--description package describes the script that runs after the #--post-install installation package is completed #--post-uninstall the script that runs before the package is unloaded
Vi. deploy the packaged Deb file on a host that needs to be monitored
#安装 [email protected]:~# dpkg-i zabbix-agentd_3.0.2-1+wheezy_amd64.deb# start agentd[email protected]:~# service Zabbix_ Agentd start

It is important to note that you use to compile the installation and packaging of the server if the agent does not start, please uninstall and then use your packaged Deb file installed again, because on the compiled server did not run the pre-installation script we wrote, so there is no Zabbix user, nor set boot, So it is advisable to reload it with the Deb package.

To deploy the agent package in bulk, it is recommended to use Ansible.

Iii. create a template and apply it to host one, create a host

Ii. Creating a host group

There are 2 hosts in the host group, one is the Web server itself, one is MySQL

Iii. Creating templates

You can also import the template on the Web to modify, here I manually create a

Iv. Creating an application Set

V. Create a monitoring item

Vi. Creating triggers

This expression means that the value of iowait is greater than 30% in 30 minutes, and the alarm

Vii. Creating graphics

Because of the quantity, I only created 2 cases.

This will monitor the Zabbix Web server and MySQL's remaining disk and CPU iowait.

You can see that the template you just created has been successfully applied.

DEBIAN8 Mounting Zabbix 3.0

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.