Build Environment: Centos6.5_x86_64,zabbix2.4.5,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 curl-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/zab
Bix-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
The path to the #此处指定 sysconfdir configuration file is in the/etc/zabbix/directory, if you do not specify the default
/usr/local/etc under
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 Line
Max_execution_time = #440 Line
Max_input_time = #449 Line
Post_max_size = 32M #729 Line
Memory_limit = 128M #457 Line
Mbstring.func_overload = 2 #1586 line, 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 Line
Dbname= Zabbix #78 Line
Dbuser=zabbixuser #94 Line
Dbpassword=zabbixpwd #102 Line
Dbsocket=/var/lib/mysql/mysql.sock #104 Line
Startpollers=30 #127 Line, turn on multithreading number, general
No more than 30
Starttrappers=20 #156 Line, number of trapper threads
startpingers=10 #164 Line, number of fping threads
startdiscoverers=120 #172 Line
listenip=0.0.0.0 #277 Line
maxhousekeeperdelete=5000 #307 Line
cachesize=1024m #324 line that is used to store the monitoring data
Number of caches, adjusted appropriately according to the number of monitoring hosts
Startdbsyncers=8 #340 Line, database synchronization time
historycachesize=1024m #349 Line
trendcachesize=128m #358 line, total trend cache size
historytextcachesize=512m #367 Line
Alertscriptspath=/etc/zabbix/alertscripts #425 Line
logslowqueries=1000 #467 Line
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 information of the Zabbix server, host name, server program listening port, host IP address, etc., if
Server and the Web remain on a single server by 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 directly to complete the installation (such as
If there is a problem here is generally the Zabbix virtual host directory file permissions issues, the above has been set up the process is generally not
Problems will occur)
#如果因为手误, the database password or user name and so on the wrong, the following will always error, we can manually
To edit the configuration file vim/var/www/html/zabbix/conf/zabbix.conf.php manually define the relevant parameters
Number can
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 Line, fill in the IP address of the Server
serveractive=192.168.2.100:10051 #122 Line, modify the IP for the Server
Address + port number
hostname=192.168.2.100 #133 Line, fill in this machine
HostName, note that the Server side should be able to parse
Unsafeuserparameters=1 #265 Line, whether the custom key,1 is allowed
To allow, 0 is not allowed
Include=/etc/zabbix/zabbix_agentd.conf.d/#249 Line, custom AGENTD configuration file (key)
It can be written in this area;
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 fonts to the/var/www/html/zabbix/fonts directory, as I have used the "XXFarEastFont-Arial Routine",
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 Line
Define (' Zbx_graph_font_name ', ' Stsong '); #44 Line
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
#已经成为中文, English is still available in some places.
CentOS Zabbix installation deployment and localization