Zabbix deployment installation on the server side

Source: Internet
Author: User
Tags php mysql snmp

Based on centos6.5 + zabbix-2.4.6 and most of the commands are under the Zabbix installation path!! Like/usr/local/zabbix/.
Yum-y install gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql ph P-GD php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql Net-snmp-devel Curl-devel
Edit PHP-related/etc/php.ini files. (There must be a response change, otherwise the error will be made during the subsequent web initialization.) )

If Yum installation is unsuccessful, download php-bcmath-5.3.3-26.el6.x86_64; php-mbstring-5.3.3-26.el6.x86_64, two RPM package, run
Yum-y Install php-*, then perform the first step of the Yum installation command!

Vim/etc/php.ini

Modify the following entry or replace the content with the SED command

Date.timezone = Asia/shanghai
Max_execution_time = 300
Post_max_size = 16M # # #有时候这里会被设置成32M, but here according to the information in the following initialization prompts, is required to set to 16M
max_input_time=300
Memory_limit = 128M
Mbstring.func_overload = 2 # # # #有时候到安装界面会有报错, write this line off. (Mbstring.func_overload does not show ok!! )

or to replace content with SED:

#sed-i "s/;d ate.timezone =/date.timezone = asia\/shanghai/g"/etc/php.ini
#sed-i "s#max_execution_time = 30#max_execution_time = 300#g"/etc/php.ini
#sed-i "s#post_max_size = 8m#post_max_size = 32m#g"/etc/php.ini
#sed-i "s#max_input_time = 60#max_input_time = 300#g"/etc/php.ini
#sed-i "s#memory_limit = 128m#memory_limit = 128m#g"/etc/php.ini
#sed-i "/;mbstring.func_overload = 0/;ambstring.func_overload = 2\n"/etc/php.ini
Finally, turn on the httpd and set the boot from

#chkconfig httpd on
#service httpd Start


2. Preparation of MySQL Database

Turn on MySQL and set the boot from:

#chkconfig mysqld on
#service mysqld Start

Add the Zabbix user for the MySQL database and set the password:

Log in to MySQL with Root and execute the following command

Mysql>use MySQL
Mysql>insert into Mysql.user (Host,user,password) VALUES ("localhost", "Zabbix", Password ("Zabbix"));
Mysql>flush privileges;
3. Create Zabbix user for CentOS system

#groupadd ZABBIX-G 501
#useradd-G zabbix-u 501-m Zabbix

PS: Here the UID and GID of the Zabbix user are set to 501.

#tar XVF zabbix-2.x.x.tar.gz
#./configure--prefix=/usr/local/zabbix--enable-server--enable-proxy--enable-agent--with-mysql=/usr/bin/mysql_ Config--with-net-snmp--with-libcurl
#make
#make Install
3. Check if Zabbix is added to the system service file

#tail-n4/etc/services

If you see the following message, you have added a success, or you can manually add it to the/etc/services file yourself:

Zabbix-agent 10050/tcp #Zabbix Agent
Zabbix-agent 10050/UDP #Zabbix Agent
Zabbix-trapper 10051/tcp #Zabbix Trapper
Zabbix-trapper 10051/udp #Zabbix Trappe

4. Establish the database required for Zabbix

Root identity and other people to the MySQL database, and execute the following command to establish the Zabbix database:

Mysql>create database Zabbix character set UTF8;
Mysql>grant all privileges in zabbix.* to [e-mail protected] identified by ' Zabbix ';
Mysql>flush privileges;

Then there is a database/mysql subdirectory in the downloaded source file, which is stored in the SQL script file that establishes the ZABBIX database structure. First go to the directory where the Zabbix source file resides and execute the following statement:

#mysql-U zabbix-p Zabbix <./database/mysql/schema.sql
#mysql-U zabbix-p Zabbix <./database/mysql/images.sql
#mysql-U zabbix-p Zabbix <./database/mysql/data.sql

PS: The above three instructions will execute SQL script, build the structure of the Zabbix database, and enter the password of the Zabbix account in MySQL each time.
5. Create log files and connections for Zabbix

#mkdir/var/log/zabbix
#chown Zabbix.zabbix/var/log/zabbix
#ln-S/usr/local/zabbix/etc/etc/zabbix
#ln-S/usr/local/zabbix/bin/*/usr/bin/
#ln-S/usr/local/zabbix/sbin/*/usr/sbin/


6. Copy and configure Zabbix boot file

#cp misc/init.d/fedora/core/zabbix_*/etc/init.d/
#chmod 755/etc/init.d/zabbix_*
#sed-i "s#basedir=/usr/local#basedir=/usr/local/zabbix#g"/etc/init.d/zabbix_server
#sed-i "s#basedir=/usr/local#basedir=/usr/local/zabbix#g"/etc/init.d/zabbix_agentd
7. Configure Zabbix_server.conf Server file

Edit and modify the/etc/zabbix/etc/zabbix_server.conf file, and modify the following entries:

Dbname=zabbix database name
Dbuser=zabbix Database User
Dbpassword=zabbix Database Password (here for demonstration, the Zabbix database password was previously set to Zabbix)

or replace the contents of the file with sed:

#sed-i "s/dbuser\=root/dbuser\=zabbix/g"/etc/zabbix/zabbix_server.conf
#sed-i "/# dbpassword=/adbpassword=zabbix\n"/etc/zabbix/zabbix_server.conf
#sed-i "s#tmp/zabbix_server.log#var/log/zabbix/zabbix_server.log#g"/etc/zabbix/zabbix_server.conf
8, configure the zabbix_agentd.conf file (here is to monitor the server itself, such as the other server monitoring, configuration files similar)

PS: Here to Live is zabbix_agentd.conf is the client configuration file, here is to demonstrate, so the purpose of this configuration file is to be able to implement the local server monitoring. The file needs to modify the following four entries:

server=127.0.0.1 the IP address of the server is added here, if the servers are not native, you need to fill in the IP addresses of the remote Zabbix_server
serveractive=127.0.0.1 is modified here as the IP of the server, this should be modified to the external IP address
/tmp/zabbix_agentd.log Modifying log paths
Unsafeuserparameters=0 default is not to enable the custom Script feature, to customize the key, need to turn on, set to 1
Include=/etc/zabbix/zabbix_agentd.conf.d/Custom AGENTD profiles can be written under this directory

The execution commands for content substitution using SED are as follows:

#sed-i "s/server\=127.0.0.1/server\=127.0.0.1,192.168.81.129/g"/etc/zabbix/zabbix_agent.conf
#sed-i "s/serveractive\=127.0.0.1/serveractive\=192.168.81.129:10051/g"/etc/zabbix/zabbix_agent.conf
#sed-i "s#tmp/zabbix_agentd.log#var/log/zabbix/zabbix_agentd.log#g"/etc/zabbix/zabbix_agentd.conf
#sed-i "#UnsafeUserParameters =0#aunsafeuserparameters=1\n"/etc/zabbix/zabbix_agentd.conf

9. Copy PHP Web files to Apache

#cp-R./frontends/php//var/www/html/zabbix
#chown-R Apache.apache/var/www/html/zabbix

10. Open Zabbix

#/etc/init.d/zabbix_server start
#/etc/init.d/zabbix_agentd start

At this point, the installation of Zabbix is complete.

Zabbix deployment installation on the server side

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.