1) Deployment LNMP
1.1)
CD / the root
the tar -xf lnmp_soft.tar.gz
CD lnmp_soft /
the tar-1.10.3.tar.gz -xf Nginx
CD-1.10.3 Nginx /
yum the install GCC PCRE -Y-devel OpenSSL-devel
-s the useradd / sbin / nologin Nginx
./configure --user = Nginx Nginx --group = --with-http_ssl_module --with-Stream-http_stub_status_module --with
the make
the make the install
LN -s / usr / local / Nginx / sbin / nginx / sbin / nginx /// create a soft link
yum -y install php-fpm /// php -fpm process interpreter before centos7.4 need to download their own, after centos7.4 integrated into the kernel inside
yum -y PHP-PHP MySQL the install
yum the install -Y-Server MariaDB MariaDB MariaDB /// devel-mounted MariaDB 1.2) modify the configuration file
/usr/local/nginx/conf/nginx.conf vim
fastcgi_buffers 8 16K; // FastCGI configuration information
fastcgi_buffer_size 32K;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
LOCATION ~ \ .php $ {// Enable dynamic php page
root html;
127.0.0.1:9000 fastcgi_pass;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME / scripts $ fastcgi_script_name;
the include fastcgi.conf;
}
2) deploy database
2.1)
mysql database MariaDB // default input to sign mysql
the create database Character zabbix the SET utf8; // create zabbix library
grant all on zabbix * to zabbix @ localhost identified by "zabbix";. // create an account has full rights to all tables in the database zabbix
3) deployment zabbix
3.1) Source Installation zabbix
yum -y install gcc PCRE-devel // installation dependencies
yum -y install net-snmp-devel curl-devel libevent-devel // install dependencies
the tar -xf ZABBIX / ZABBIX-3.4.4.tar.gz
CD-ZABBIX 3.4.4 /
./configure --enable --enable-Proxy---enable -server Agent --with-MySQL = / usr / bin / the mysql_config --with-NET-SNMP --with-libcurl
the make the install
3.2) initialized to empty web page zabbix
cd zabbix-3.4.4 / database / mysql // zabbix source package below the default database structure
mysql -uzabbix - pzabbix zabbix <schema.sql // import sequence can not be wrong
MySQL -uzabbix -pzabbix ZABBIX <images.sql
MySQL -uzabbix -pzabbix ZABBIX <data.sql
cd /root/zabbix-3.4.4/frontends/php // default page has the following zabbix Source Package
cp -a * / usr / local / nginx / HTML /
the chmod 777 -R & lt /usr/local/nginx/conf/nginx.conf 3.3) may first attempt to access the page, the index.php default, prompted to modify the configuration file, the required installation dependencies
3.4) dependent software installed
yum PHP-PHP the install Gd -Y-XML PHP-LDAP
yum -Y-BCMath the install PHP-PHP // check whether the mbstring integrated in kernel
3.5) modify the configuration file
Vim / etc / PHP-INI
the date.timezone = Asia / of Shanghai / / done according to the web page of the local newspaper red configuration changes
max_execution_time = 300
post_max_size = 32M
max_input_time 300 =
3.6) zabbix start
to modify the configuration file
/usr/local/etc/zabbix_server.conf vim
DBHost = localhost /// set up database hosting
DBName = zabbix /// set the database name
DBUser = zabbix /// set up a database account
DBPassword = zabbix /// Set Database Password
LogFile = / tmp / zabbix_server.log /// Set log
start the service
useradd zabbix // does not create a user can not start the service
zabbix_server //// start the service, if you did not start successfully, you can not execute the command to start again. We need to kill zabbix_server to terminate the process, and then start.
ss -aunltp | grep: 10051 // query whether there start port 10051, to determine whether to start the program
4) being monitored end
4.1) installed zabbix
tar -xf of ZABBIX / zabbix-3.4.4.tar.gz
cd zabbix-3.4.4 /
--enable-Agent ./configure
the make install
4.2) modify the configuration file
vim /usr/local/etc/zabbix_agentd.conf
Server = 127.0.0.1,192.168.2.5 /// allow access to the address list service
ServerActive = 192.168.2.5: 10051 /// monitoring server ip address
LogFile = / tmp / zabbix_agent.log /// log files
4.3) start zabbix_agent
useradd -s / sbin / nologin zabbix // create a user does not create a user does not start properly
zabbix_agentd
SS -aunltp | grep: 10050
4.4) custom zabbix monitoring items
monitored host to create a custom key
custom key syntax is: UserParameter = custom key names, command.
Key files are generally stored in /usr/local/etc/zabbix_agentd.conf.d/ custom directory, there is also need to modify the file zabbix_agentd.conf, allows custom monitor key, to read all the files in the directory.
4.4.1) modify the configuration file, read the directory configuration file loading
vim /usr/local/etc/zabbix_agentd.conf
Include = / usr / local / etc / zabbix_agentd.conf.d / // load configuration files directory
4.4.2) to create a file in the profile directory
cd /usr/local/etc/zabbix_agent.conf.d/
vim count.line.passwd // create a file in the directory
UserParameter count.line.passwd =, WC -l / etc / the passwd | awk '{}. 1 Print $'
4.4.3) test custom key is working
killall zabbix_agentd // Close zabbix_agentd service
zabbix_agentd // start zabbix_agentd service
zabbix_get -s 127.0 .0.1 -k count.line.passwd