Build Environment: centos6.5_x86_64,zabbix2.4.5 (the latest version so far), Epel source
Service side:
1. Install the development package
Yum-y Groupinstall "Development Tools"
2. Install the required dependency packages
Yum-y install httpd mysql mysql-server mysql-devel php php-mysql php-common php-mbstring php-gd php-odbc php-pear Curl CU Rl-devel net-snmp net-snmp-devel perl-dbi php-xml ntpdate Php-bcmath
3. Synchronize the time on the server to keep all servers time consistent to avoid the unavailability of monitoring data due to time differences
Ntpdate pool.ntp.org
4. Create the users and groups required for the Zabbix service to run
GROUPADD-G 201 Zabbix
Useradd-g zabbix-u 201-m Zabbix
5. Initializing the MySQL server
/etc/init.d/mysqld start
6. Create the database and user rights required for the Zabbix operation
mysqladmin-uroot-h127.0.0.1 password "Chengshan"
Mysql-uroot-p
Mysql> CREATE database Zabbix character set UTF8;
Mysql> grant all privileges on zabbix.* to [email protected] '% ' identified by ' zabbixpwd ';
mysql> flush Privileges;
7. Download the decompression Zabbix
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.4.5/zabbix-2.4.5.tar.gz/download
Tar XF zabbix-2.4.5.tar.gz
8. Import the initial data of Zabbix into the database
CD zabbix-2.4.5
Mysql-uzabbixuser-h192.168.2.100-p Zabbix<database/mysql/schema.sql
Mysql-uzabbixuser-h192.168.2.100-p Zabbix<database/mysql/images.sql
Mysql-uzabbixuser-h192.168.2.100-p Zabbix<database/mysql/data.sql
#登录数据库查看下表是否都创建成功
9. Compile and install Zabbix
./configure-sysconfdir=/etc/zabbix/-ENABLE-SERVER-ENABLE-AGENT-WITH-NET-SNMP-WITH-LIBCURL-WITH-MYSQL-WITH-SSH2 --enable-java
After executing the above command, the following error is reported:
Configure:error:Not found Mysqlclient Library
Workaround:
Ln-s/usr/lib64/mysql/libmysqlclient.so.16.0.0/usr/lib64/mysql/libmysqlclient.so
Ln-s/usr/lib64/mysql/libmysqlclient_r.so.16.0.0/usr/lib64/mysql/libmysqlclient_r.so
Ln-s/usr/lib64/libmysqlclient.so.16.0.0/usr/lib64/libmysqlclient.so
Ln-s/usr/lib64/libmysqlclient_r.so.16.0.0/usr/lib64/libmysqlclient_r.so
Then re-execute the commands above./configure, etc.
Then perform the compilation installation
Make && make install
#此处指定sysconfdir配置文件的路径就在 the/etc/zabbix/directory, if you do not specify the default under/USR/LOCAL/ETC
10.Copy zabbixserver start script with Agent side and set execution permissions
CP misc/init.d/tru64/zabbix_agentd/etc/init.d/
CP misc/init.d/tru64/zabbix_server/etc/init.d/
chmod +x/etc/init.d/zabbix_*
11. Copy the Zabbix page file to the specified directory (same as the Apache configuration)
Mkdir/var/www/html/zabbix
Cp-a frontends/php/*/var/www/html/zabbix/
Chown-r apache.apache/var/www/html/zabbix/
12. Configure PHP files to fit the parameters required for Zabbix installation
# Vim/etc/php.ini
Date.timezone = Asia/shanghai#946行
Max_execution_time =#440行
Max_input_time =#449行
Post_max_size = 32M#729行
Memory_limit = 128M#457行
Mbstring.func_overload = 2#1586行, this line needs to be commented
13. Configure the Apache file to define a virtual host to install access to Zabbix
# vim/etc/httpd/conf/httpd.conf
ServerName 127.0.0.1
<virtualhost *:80>
DocumentRoot "/var/www/html"
ServerName 192.168.2.100
</VirtualHost>
14. Configure the Zabbix server-side files, define the database IP, user name, password
# vim/etc/zabbix/zabbix_server.conf
dbhost=192.168.2.100#68行
Dbname= Zabbix#78行
Dbuser=zabbixuser#94行
Dbpassword=zabbixpwd#102行
Dbsocket=/var/lib/mysql/mysql.sock#104行
Startpollers=30 #127行, open multi-threaded number, generally not more than 30
Starttrappers=20 #156行, number of trapper threads
startpingers=10 #164行, number of fping threads
startdiscoverers=120 #172行
listenip=0.0.0.0#277行
maxhousekeeperdelete=5000 #307行
cachesize=1024m #324行, the number of caches used to store monitoring data, adjusted appropriately according to the number of monitoring hosts
Startdbsyncers=8 #340行, database synchronization time
historycachesize=1024m #349行
trendcachesize=128m #358行, total trend Cache size
historytextcachesize=512m#367行
Alertscriptspath=/etc/zabbix/alertscripts#425行
logslowqueries=1000#467行
15. Launch Apache service and Zabbix service
/ETC/INIT.D/HTTPD start
/etc/init.d/zabbix_server start
16. Access to the installation interface follow the interface prompts step-by-step completion of the installation
http://192.168.2.100/zabbix/setup.php
A) Enter the installation screen and click Next
b) Ensure that all monitoring items are OK, click Next
c) Fill in the Zabbix database user name, password, address and other information, click on test Connection,ok and click Next
d) Fill in the Zabbix server information, hostname, server program listening port, host IP address, etc., if the server and the Web on a server to maintain the default, click Next
e) Confirm that the previous sections have been filled in with no questions, click Next
f) Check the config file of the Web program, if no problem will show OK, click Finish to complete the installation (if there is a problem is generally Zabbix virtual host directory file permissions problem, the above has been set up the process generally does not have problems)
#如果因为手误, the database password or user name, and so on the wrong, the following will always error, we can manually edit the configuration file vim/var/www/html/zabbix/conf/zabbix.conf.php manually define the relevant parameters can be
g) Enter login interface Click Login, default admin Zabbix
#至此, server-side installation is complete
Agent side:
1. Install the development package
Yum-y Groupinstall "Development Tools"
Yum–y Install Ntpdate
2. Synchronizing client time to prevent inconsistencies with the server, resulting in detection of unavailable monitoring data
Ntpdate pool.ntp.org
3. Create the user and group required to run the Zabbix
GROUPADD-G 201 Zabbix
Useradd-g zabbix-u 201-m Zabbix
4. Unzip and install the zabbixagent end
Tar XF zabbix-2.4.5.tar.gz
CD zabbix-2.4.5
./configure-sysconfdir=/etc/zabbix-enable-agent
Make && make install
5.copy script required to run the agent side
CP misc/init.d/tru64/zabbix_agentd/etc/init.d/
chmod +x/etc/init.d/zabbix_agentd
6. Configure agent-side configuration files
# vim/etc/zabbix/zabbix_agentd.conf #此处千万别写成了zabbix_agent. conf, otherwise the configuration does not take effect
server=192.168.2.100 #81行, fill in the IP address of the server
serveractive=192.168.2.100:10051 #122行, modify the IP address of the server + port number
hostname=192.168.2.100 #133行, fill in the Hostname of this machine, note server side to be able to parse
Unsafeuserparameters=1 #265行, whether a custom key,1 is allowed, 0 is not allowed
include=/etc/zabbix/zabbix_agentd.conf.d/#249行, a custom AGENTD configuration file (key) can be written here;
7. Start the Zabbix agent side
/etc/init.d/zabbix_agentd start
Solve Zabbix Chinese garbled and Han
1. Find a font you like in Windows or download a font on the web
2. Upload the font to the/var/www/html/zabbix/fonts directory, as I have used the "XXFarEastFont-Arial General", the file name of the font Stsong.ttf
3. Modify the Chinese font settings for Zabbix page management
# vim/var/www/html/zabbix/include/defines.inc.php #修改以下两行
Define (' Zbx_font_name ', ' Stsong '); #92行
Define (' Zbx_graph_font_name ', ' Stsong '); #44行
4. Login page Set the corresponding user's default language administrator-->users (here to ensure that the user is displayed, otherwise the user group is displayed)
5. Click on the user name to enter the user information edit, the default language select Simplified Chinese, then click Save Save
6. Refresh the page
#已经成为中文, in some places still will have English but Zabbix of the Chinese is relatively other open source software has done very good!!!
CentOS6.5 under Zabbix installation and localization