Rapid deployment of Zabbix server and MPM (monitor for MySQL)

Source: Internet
Author: User
Tags gpg install perl

1. Preface Zabbix as open source free monitoring software, its easy to manage the configuration and visualization of the view, the regular maintenance of historical data, templated monitoring projects more and more by the majority of IT operations and maintenance staff favorite. Here is the main summary of the next Zabbix server and MPM using Yum for rapid deployment. The more detailed things, people still look at the official documents it. Let's set up the environment first! 2. Environment 1) Zabbix Server
os:redhat6.5 i686 (VMware) ipaddr:192.168.8.3 Hostname:linux-zabbix mysql:5.6.23 mem:1g
2) Monitoring End
Os:centos 6.4 x64 (VMware) ipaddr:192.168.8.5 HOSTNAME:ONEPROXY-VM mem:1g
3. Zabbix Server Deployment 3.1 Yum environment configuration here the Yum source uses the source of the 163 CentOS6.6 and Zabbix official website. Since my server is Rehat, I will first uninstall Redhat Yum and install CentOS Yun software. 3.1.1 Download CentOS Yum software
wget Http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpmwget/HTTP Mirrors.163.com/centos/6/os/x86_64/packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpmwget/HTTP Mirrors.163.com/centos/6/os/x86_64/packages/yum-3.2.29-40.el6.centos.noarch.rpmwget http://mirrors.163.com/ centos/6/os/x86_64/packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

3.1.2 Uninstalling Redhat's Yum pack
Rpm-qa|grep-i Yum|xargs rpm-e--nodeps

3.1.3 Installing the CentOS Package
RPM-IVH PYTHON-INIPARSE-0.3.1-2.1.EL6.NOARCH.RPMRPM-IVH YUM-METADATA-PARSER-1.1.2-16.EL6.X86_64.RPMRPM-IVH yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

3.1.4 Configuration 163 of the CentOS6.6 Yum
[[email protected] yum.repos.d]# cd/etc/yum.repos.d[[email protected] yum.repos.d]# cat Centos6-base-163.repo # centos-base.repo## The mirror system uses the connecting IP address of the client and the# update  The status of each mirror to pick mirrors is updated to and# geographically close to the client. You should use this for CentOS updates# unless is manually picking other mirrors.## If the mirrorlist= does For your, as a fall back you can try the # remarked off Baseurl= line Instead.##[base]name=centos-6.6-base-163.combaseu rl=http://mirrors.163.com/centos/6.6/os/$basearch/#mirrorlist =http://mirrorlist.centos.org/?release=6.6& Arch= $basearch &repo=osgpgcheck=1gpgkey=http://mirror.centos.org/centos/rpm-gpg-key-centos-6#released Updates [updates]name=centos-6.6-updates-163.combaseurl=http://mirrors.163.com/centos/6.6/updates/$basearch/# Mirrorlist=http://mirrorlist.centos.org/?release=6.6&arch= $basearch &repo=updatesgpgcheck=1gpgkey=http://mirror.centos.org/centos/rpm-gpg-key-centos-6#additional packages that could be useful[extras]name=centos-6.6- extras-163.combaseurl=http://mirrors.163.com/centos/6.6/extras/$basearch/#mirrorlist =http:// Mirrorlist.centos.org/?release=6.6&arch= $basearch &repo=extrasgpgcheck=1gpgkey=http://mirror.centos.org /centos/rpm-gpg-key-centos-6#additional packages that extend functionality of existing packages[centosplus]name= centos-6.6-plus-163.combaseurl=http://mirrors.163.com/centos/6.6/centosplus/$basearch/#mirrorlist =http:// Mirrorlist.centos.org/?release=6.6&arch= $basearch &repo=centosplusgpgcheck=1enabled=0gpgkey=http:// Mirror.centos.org/centos/rpm-gpg-key-centos-6#contrib-packages by CentOS Users[contrib]name=centos-6.6-contrib- 163.combaseurl=http://mirrors.163.com/centos/6.6/contrib/$basearch/#mirrorlist =http://mirrorlist.centos.org/? Release=6.6&arch= $basearch &repo=contribgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/ Rpm-gpg-key-centos-6

3.1.5 Configuring the Zabbix Yum Source
wget HTTP://REPO.ZABBIX.COM/ZABBIX/2.4/RHEL/6/I386/ZABBIX-RELEASE-2.4-1.EL6.NOARCH.RPMRPM-IVH zabbix-release-2.4-1.el6.noarch.rpm
[email protected] yum.repos.d]# cat Zabbix.repo [Zabbix]name=zabbix official repository-$basearchbaseurl =http:// repo.zabbix.com/zabbix/2.4/rhel/6/$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/ Rpm-gpg-key-zabbix[zabbix-non-supported]name=zabbix official Repository non-supported-$basearch baseurl=http:// repo.zabbix.com/non-supported/rhel/6/$basearch/enabled=1gpgkey=file:///etc/pki/rpm-gpg/ Rpm-gpg-key-zabbixgpgcheck=1

3.2 Zabbix Server Installation 3.2.1 Installing the MySQL Database
Yum Remove Mysql-libs-5.1.71-1.el6.i686rpm-ivh MYSQL-SERVER-ADVANCED-5.6.23-1.EL6.I686.RPMRPM-IVH MYSQL-CLIENT-ADVANCED-5.6.23-1.EL6.I686.RPMRPM-IVH mysql-shared-compat-advanced-5.6.23-1.el6.i686.rpm mysql-shared-advanced-5.6.23-1.el6.i686.rpm mysql-devel-advanced-5.6.23-1.el6.i686.rpm

3.2.2 Configuring the MySQL configuration file/etc/my.cnf
[[email protected] etc]# cat my.cnf[client]port = 3306socket =/tmp/mysql.sock#the mysql server######## #Basic ##### #[mysqld]server-id = 1port = 3306user = Mysqlbasedir =/usr/datadir =/var/lib/mysqltmpdir =/var/lib/mysql/tmpsocket =/ Tmp/mysql.sockskip-external-lockingskip-name-resolvedefault-storage-engine = Innodbcharacter-set-server = utf8wait _timeout = 100connect_timeout = 20interactive_timeout = 100back_log = 500event_scheduler = Onexplicit_defaults_for_ Timestamp#skip-grant-tables ############ #binlog ############# #log-bin =/var/lib/mysql/logs/mysql-binbinlog_format = Rowmax_binlog_size = 128mbinlog_cache_size = 4mexpire_logs_days = 5 ############# #Slow log################### #slow_ Query_log = 1slow_query_log_file =/var/lib/mysql/logs/mysql.slowlong_query_time = 2############## #Per_Thread_ buffers####################### #max_connections = 1024max_user_connections = 1000max_connect_errors = 10000key_buffer _size = 32mmax_allowed_packet = 128mtable_open_cache = 3096table_definitiOn_cache = 4096sort_buffer_size = 512kread_buffer_size = 512kread_rnd_buffer_size = 512kjoin_buffer_size = 512Ktmp_table _size = 16mmax_heap_table_size = 16mquery_cache_type = 0query_cache_size = 0bulk_insert_buffer_size = 16Mthread_cache_ Size = 64thread_stack = 256k############### #InnoDB ######################## #innodb_data_home_dir =/var/lib/ Mysqlinnodb_autoinc_lock_mode = 2innodb_log_group_home_dir =/var/lib/mysql/logsinnodb_data_file_path = Ibdata1:1G: Autoextendinnodb_buffer_pool_size = 256minnodb_buffer_pool_instances = 1innodb_log_file_size = 64Minnodb_log_buffer_ Size = 4minnodb_flush_log_at_trx_commit = 2innodb_lock_wait_timeout = 10innodb_sync_spin_loops = 40innodb_max_dirty_ pages_pct = 90innodb_support_xa = 1innodb_thread_concurrency = 0innodb_thread_sleep_delay = 500innodb_file_io_threads = 4innodb_concurrency_tickets = 1000log_bin_trust_function_creators = 1innodb_flush_method = O_DIRECTinnodb_file_per_ Tableinnodb_read_io_threads = 4innodb_write_io_threads = 4innodb_io_capacity = 2000innodb_file_format = Barracudainnodb_purge_threads = 1innodb_purge_batch_size = 32innodb_old_blocks_pct = 75innodb_change_buffering = Alltransaction_isolation = read-committed
[Mysqldump]quickmax_allowed_packet = 64m[mysql]no-auto-rehash[myisamchk]key_buffer_size = 32Msort_buffer_size = 256kread_buffer = 2mwrite_buffer = 2m[mysqlhotcopy]interactive-timeout[mysqld_safe]open-files-limit=28192[mysql] host=localhostuser=zabbixpassword=zabbixsocket=/tmp/mysql.sock[mysqladmin]host=localhostuser=zabbixpassword= Zabbixsocket=/tmp/mysql.sock
Create a Directory
Mkdir-p/var/lib/mysql/tmpmkdir-p/var/lib/mysql/logschown-r Mysql:mysql/var/lib/mysql
Initialize MySQL
mysql_install_db--defaults-file=/etc/my.cnf--datadir=/var/lib/mysql/
After starting the database, create the Zabbix database and set the root password
Service MySQL startmysql> CREATE database Zabbix default CharSet UTF8;
Mysql> Grant All on * * to ' root ' @ ' localhost ' identified by ' 123456 ';
Mysql> Grant All on * * to ' root ' @ '% ' identified by ' 123456 ';
mysql> flush Privileges;
3.2.3 Installation Zabbix
Yum Install zabbix-server-mysql Zabbix-web-mysqlyum install Zabbix-get
Yum will automatically configure Apache and PHP installations.
3.2.4 Initializing the Zabbix database
Cd/usr/share/doc/zabbix-server-mysql-2.4.5/create
3.2.5 Modifying the Zabbix server configuration file
cat/etc/zabbix/zabbix_server.confdbhost=localhostdbname=zabbixdbuser=rootdbpassword=123456
3.2.6 Modifying PHP configuration Files
Php_value max_execution_time 300php_value memory_limit 128mphp_value post_max_size 16Mphp_value upload_max_filesize 2mphp_value max_input_time 300date.timezone = PRC
3.2.7 Start Service
Service Zabbix-server Startservivce httpd start

3.2.8 Configuration page After you open Http://192.168.8.3/zabbix, configure the relevant options to install requirements check


Database configuration

Zabbix-server

Installation Preview

When you are finished, you can log in using the default administrator user Admin/zabbix

4. Configuring the Zabbix agent and the MPM4.1 Zabbix agent configuration of Yum the previous section has already been said to be installed directly
Yum Install Zabbix-agentyum Install Zabbix-sender
Configure/etc/zabbix/zabbix_agentd.conf
Server=192.168.8.3serveractive=192.168.8.3hostname=oneproxy-vm

4.2 MPM Installation Configuration 4.2.1 Install dependent packages
Yum install Perl-file-which perl-libwww-perl perl-digest-sha perl-dbd-mysql perl-time-hires Perl-Crypt-SSLeay

4.2.2 Software Introduction to the official website http://www.fromdual.com/download the relevant version of MPM, here I am using mysql_performance_monitor-0.9.3.tar.gz. (PS: The latest 0.10 version does not have the relevant documentation, it's a pit!) After extracting the package, you will find two files mysql_performance_monitor_agent-0.9.3.tar.gz and mysql_performance_monitor_templates-0.9.3.tar.gz. Where mysql_performance_monitor_agent-0.9.3.tar.gz is the configuration information placed on the monitoring machine, mysql_performance_monitor_ Templates-0.9.3.tar.gz is the template data that you want us to import into Zabbix server.
4.2.3 Template import log on to our Zabbix server server, template import via Configuration-->templates-->import
After extracting mysql_performance_monitor_templates-0.9.3.tar.gz, Template_FromDual.MySQL.mpm.xml must be imported, we will import it first. Others are imported according to the requirements. I am here to import all the templates.
4.2.4 Creating a monitoring Host creates a user group by configuration-->host groups. Here I create a user group named MPM.

Create a user from configuration-->hosts, add it to the MPM user group, and the associated template uses the one we imported.


Associate Template


OK, we have configured the server side.
4.2.5 MPM Agent Configuration Unzip our agent package mysql_performance_monitor_agent-0.9.3.tar.gz and put it in the/OPT directory
MV Mysql_performance_monitor_agent-0.9.3/opt/mysql_performance_monitor_agent
CD/OPT/MYSQL_PERFORMANCE_MONITOR_AGENT/ETCCP fromdualmysqlagent.conf.template/etc/zabbix/ Fromdualmysqlagent.confmkdir-p/var/log/zabbix/var/log/zabbix/cachechown-r Zabbix:/var/log/zabbix/var/log/zabbix /cache

Edit/etc/zabbix/zabbix-agent.conf, add
userparameter=fromdual.mysql.check,/opt/mysql_performance_monitor_agent/fromdualmysqlagent.pl/etc/zabbix/ Fromdualmysqlagent.conf

Modifying the MPM configuration file
[[email protected] zabbix]# cat/etc/zabbix/fromdualmysqlagent.conf[default]# Type of section:# mysqld for a normal MySQL database# ndbd for a mysql Clustertype = mysqld# Debug levels are:# 1 is logging only errors# 2 are logging errors and warnings (this is the default) # 3 logs some informations messages as wel  l# 4 logs Everything (for debugging purposes only) Debug = 2LogFile =/var/log/zabbix/fromdualmysqlagent.log# Directory where the Cache files should be written to:cachefilebase =/var/log/zabbix/cache/fromdualagentcache# If your age NT is not located in the same time zone as your server# for US something like-6.0 to our MaaS server# for Asia something Like +7.0 to our MaaS server# timeshift = +0.0# information for MySQL connections:username = Rootpassword = 123456 Mysqlhost = 127.0.0.1MysqlPort = 3306# Zabbix Server IP addresszabbixserver = 192.168.8.3 
</pre><pre name= "code" class= "HTML" ># If section was disableddisabled = false# Possible modules for Databas Es are:# process mysql myisam aria innodb pbxt ndb master slave drbd galera memcache# Possible modules for servers are:# m PM server# Usual Modules aremodules = process mysql MyISAM INNODB[ONEPROXY-VM]          # This must match Hostname in Zabb Ix! Type         = mysqldusername     = Rootpassword     = 123456MysqlHost    = 127.0.0.1MysqlPort =    3306Modules      = Process MySQL MyISAM innodbpidfile      =/data/mysql_3306/mysql.pid

Where the default field is defaulted, the ONEPROXY-VM field must be equal to the hosts name configured in Zabbix-server. Other configurations are based on your own local MySQL environment. Give Zabbix read access to the PID file and the permissions of the MPM log
chmod o+r/data/mysql_3306/mysql.pid
Touch/var/log/zabbix/fromdualmysqlagent.log
Chown-r Zabbix:zabbix/var/log/zabbix
Start Zabbix-agent and then
Service Zabbix-agent Start


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Rapid deployment of Zabbix server and MPM (monitor for MySQL)

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.