Server-side deployment:
System environment and software version:
Linux:release 6.3
Zabbix:zabbix-3.2.5.tar.gz
Nginx:nginx-1.12.0.tar.gz
Php:php-5.5.38.tar.gz
Mysql:mysql-5.6.28.tar.gz
First, install Nginx:
1. Dependent Packages:
Yum-y install gcc gcc-c++ autoconf automake zlib zlib-devel OpenSSL openssl-devel make Gd-devel libjpeg-devel libpng-deve L Libxml2-devel bzip2-devel Libcurl-devel
2. Create Nginx User:
Useradd www-s/sbin/nologin
3, installation Prce:
TAR-ZXVF pcre-7.8.tar.gz
CD pcre-7.8
Make && make install
4. Compile and install nginx1.12:
TAR-ZXVF nginx-1.12.0.tar.gz
Shielded Banner (/root/soft/nginx-1.12.0/src/core/nginx.h)
./configure--user=www--group=www--with-http_realip_module--with-http_stub_status_module--with-http_gzip_static _module--with-sha1=auto/lib/sha1--with-pcre=/root/soft/pcre-7.8--without-select_module--without-poll_module-- Without-http_ssi_module--without-http_userid_module--without-http_geo_module--without-http_map_module-- Without-http_memcached_module--without-mail_pop3_module--without-mail_imap_module--without-mail_smtp_module-- Prefix=/usr/local/nginx--with-http_ssl_module
Make && make install
Second, installation php5.5
1. Install the dependent package:
Yum install-y freetype* openldap*
TAR-ZXVF libmcrypt-2.5.7.tar.gz
CD libmcrypt-2.5.7
./configure
Make && make install
2. Modify the configuration file:
cp-frp/usr/lib64/libldap*/usr/lib/
Vi/etc/ld.so.conf
/usr/local/lib (Increase this line)
Ldconfig
Third, install PHP:
TAR-ZXVF php-5.5.38.tar.gz
CD php-5.5.38
./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql-- With-mysqli=/usr/local/mysql/bin/mysql_config--with-iconv-dir=/usr/local--with-freetype-dir--with-jpeg-dir-- With-png-dir--with-zlib--with-gd--enable-gd-native-ttf--with-libxml-dir=/usr--enable-xml--disable-rpath-- Enable-discard-path--enable-safe-mode--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization --with-curl--with-curlwrappers--enable-mbregex--enable-fastcgi--enable-fpm--enable-force-cgi-redirect-- Enable-mbstring--with-mcrypt--with-openssl--with-mhash--enable-pcntl--enable-sockets--with-ldap-- WITH-LDAP-SASL--with-xmlrpc--enable-zip--enable-soap-without-pear--with-gettext
Make
Make install
CP Php.ini-production/usr/local/php/etc/php.ini
cd/usr/local/php/
CP Php-fpm.conf.default php-fpm.conf
4, modify the php.ini parameters: (Zabbix environment needs to modify the parameters)
Max_execution_time = Memory_limit = 128M Post_max_size = 16M upload_max_filesize = 2M Max_input_time = Date.timezo NE = PRC
5. Start PHP:
/usr/local/php/sbin/php-fpm
Iv. installation of MySQL5.6
1. Install the dependent package:
Yum install make Bison g++ build-essential libncurses5* cmake ncurses*
2. Create related users and files:
Groupadd MySQL
useradd-g MySQL mysql-s/sbin/nologin
Mkdir-p/usr/local/mysql
Mkdir-p/usr/local/mysql/data
Mkdir-p/usr/local/mysql/log
Chown-r Mysql:mysql/usr/local/mysql
3. Install MySQL:
TAR-ZXVF mysql-5.6.28.tar.gz
CD mysql-5.6.28
Cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/usr/local/mysql/data-dsysconfdir=/etc-dwith_ Myisam_storage_engine=1-dwith_innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-dmysql_ Unix_addr=/var/lib/mysql/mysql.sock-dmysql_tcp_port=3306-denabled_local_infile=1-dwith_partition_storage_ Engine=1-dextra_charsets=all-ddefault_charset=utf8-ddefault_collation=utf8_general_ci
Make-j4 && make Install
4. Set boot and initialize MySQL
chmod +w/usr/local/mysql
Cp/root/soft/mysql-5.6.28/support-files/mysql.server/etc/init.d/mysqld
chmod 755/etc/init.d/mysqld
Ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib/libmysqlclient.so.18
Ln-s/usr/local/mysql/bin/mysql/usr/bin
Ln-s/usr/local/mysql/bin/mysqladmin/usr/bin
/usr/local/mysql/scripts/mysql_install_db--defaults-file=/etc/my.cnf--basedir=/usr/local/mysql--datadir=/usr/ Local/mysql/data--user=mysql
Vi/etc/my.cnf
5. Start MySQL:
Servier mysqld Start
6. Set the database root password:
Mysqladmin-u Root Password
7. Login Database:
Mysql-uroot-p
8. Create Zabbix Database:
Create DATABASE Zabbix default CharSet UTF8;
9. Create Zabbix database user and password:
Grant all privileges the zabbix.* to [email protected] ' localhost ' identified by ' 123456 ';
Flush privileges;
V. Installation of Zabbix server:
1. Install dependent packages
Yum Install Net-snmp net-snmp-devel-y
2, Installation Zabbix
TAR-ZXVF zabbix-3.2.5.tar.gz
CD zabbix-3.2.5
./configure--prefix=/usr/local/zabbix--enable-server--enable-agent--with-mysql=/usr/local/mysql/bin/mysql_ Config--with-net-snmp--with-libcurl--with-libxml2 make && make install
Groupadd Zabbix
Useradd zabbix-g zabbix-s/sbin/nologin
3. Import data
Cd/root/soft/zabbix-3.2.5/database/mysql
Mysql-uroot-p Zabbix < Schema.sql
Mysql-uroot-p Zabbix < Images.sql
Mysql-uroot-p Zabbix < Data.sql
4. Create Zabbix Data Catalog
Mkdir-p/data/zabbix
cp-rp/root/soft/zabbix-3.2.5/frontends/php/*/data/zabbix/
Six, configure Nginx virtual host
Mkdir/usr/local/nginx/conf/vhost
Vi/usr/local/nginx/conf/vhost/zabbix.conf
server {
Listen 8027;
server_name 192.168.109.132;
Access_log/data/zabbix_log/zabbix.log main;
Index index.html index.php index.html;
Root/data/zabbix;
Location/{
Try_files $uri $uri//index.php? $args;
}
Location ~ ^ (. +.php) (. *) $ {
Fastcgi_split_path_info ^ (. +.php) (. *) $;
Include fastcgi.conf;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param path_info $fastcgi _path_info;
}
}
Vi/usr/local/conf/nginx.conf
User www;
Worker_processes 1;
Events {
Worker_connections 1024;
}
HTTP {
Include Mime.types;
Default_type Application/octet-stream;
Log_format Main ' $remote _addr-$remote _user [$time _local] "$request" '
' $status $body _bytes_sent ' $http _referer '
' "$http _user_agent" "$http _x_forwarded_for";
Access_log Logs/access.log Main;
Sendfile on;
Keepalive_timeout 65;
server {
Listen 80;
server_name localhost;
Location/{
root HTML;
Index index.html index.htm;
}
Error_page 502 503 504/50x.html;
Location =/50x.html {
root HTML;
}
}
Include vhost/*.conf;
}
Vii. Edit the Zabbix_server.conf file and start the Zabbix
1. Configuring the Zabbix_server.conf File
Vi/usr/local/zabbix/etc/zabbix_server.conf
Logfile=/usr/local/zabbix/log/zabbix_server.log
Pidfile=/usr/local/zabbix/zabbix_server.pid
dbhost=192.168.109.132
Dbname=zabbix
Dbuser=zabbix
dbpassword=123456
Timeout=4
2. Start Zabbix
Chown-r zabbix:zabbix/usr/local, Zabbix
/usr/local/zabbix/sbin/zabbix_server-c/usr/local/zabbix/etc/zabbix_server.conf
3. Add service to boot from:
echo "/usr/local/nginx/sbin/nginx" >>/etc/rc.local
echo "/USR/LOCAL/PHP/SBIN/PHP-FPM" >>/etc/rc.local
echo "/etc/init.d/mysqld start" >>/etc/rc.local
echo "/usr/local/zabbix-3.0.3/sbin/zabbix_server" >>/etc/rc.local
Eight, configure the Web:
Browser Login: http://192.168.109.132:8027/
Tablets up to the Internet
Database host is subject to availability
Click "Download the configuration file" to download the profile
and upload to/data/zabbix/conf
Zabbix Default login account password:
Account: admin
Password: Zabbix
Nine, change to Chinese font display problem processing
Shown below:
Workaround:
Win+r open Run, input fonts, enter the Windows font directory, find Microsoft ya Black-general font, copy it to change the file name to Msyh.ttf, note the suffix TTF.
Upload the Msyh.ttf to the server Zabbix font directory:
/data/zabbix/fonts (depending on the installation directory, look for: Find/-name fonts/etc/fonts)
Modify the configuration file:/data/zabbix/include/defines.inc.php The following two lines
46:define (' Zbx_graph_font_name ', ' msyh '); Font file name
95:define (' Zbx_font_name ', ' msyh ');
Refresh Page Resolution
Client deployment:
System environment and software version:
Linux:release 6.3
Zabbix_agent:zabbix_agents_3.0.0.linux2_6.amd64.tar.gz
First, the deployment script
VI install_zabbix.sh
#!/bin/bash
Mkdir/data/zabbix-p
Cd/data/zabbix
Cp/root/soft/zabbix_agents_3.0.0.linux2_6.amd64.tar.gz./
Tar xzf zabbix_agents_3.0.0.linux2_6.amd64.tar.gz
host= ' ifconfig |grep ' bcast ' |grep-op ' (? <=inet\ addr\:) [^\]+ '
Sed "s/server=127.0.0.1/server=192.168.109.132/g"-i/data/zabbix/conf/zabbix_agentd.conf
Sed "s/serveractive=127.0.0.1/serveractive=192.168.109.132/g"-i/data/zabbix/conf/zabbix_agentd.conf
Sed "S/hostname=zabbix server/hostname= $host/g"-i/data/zabbix/conf/zabbix_agentd.conf
Sed "s/\# hostmetadata=/hostmetadata=mail/g"-i/data/zabbix/conf/zabbix_agentd.conf
Useradd zabbix-u 1001-s/sbin/nologin
Chown-r Zabbix:zabbix/data/zabbix
echo "/data/zabbix/sbin/zabbix_agentd-c/data/zabbix/conf/zabbix_agentd.conf" >>/etc/rc.local
/data/zabbix/sbin/zabbix_agentd-c/data/zabbix/conf/zabbix_agentd.conf
Ifconfig
Sleep 20
Netstat-ntdlp
zabbix3.2 Custom Template Application One, create a custom template
Configure--Templates--Create templates
Ii. defining keys and scripts on the monitored side
Monitored end ip:192.168.109.133
vi/data/zabbix/script/check_mysql.sh
#!/bin/bash
Aa= ' ps-ef|grep mysql|grep pid|wc-l ' #aa的值不同应用环境不一样
Echo $AA
Chown Zabbix:zabbix-r/data/zabbix/script/
Third, start to define the use of key on the monitored side
Vi/data/zabbix/conf/zabbix_agentd.conf
Unsafeuserparameters=1 #开启定义KEY的参数
userparameter=check.mysql,/data/zabbix/script/check_mysql.sh
Description: The key value for check.mysql,server application script is/data/zabbix/script/check_mysql.sh
#语法为: Userparameter=key, < scripts/commands > scripts or commands are all available, the above application is script
Iv. Restart the Agent service on the monitored side
Pkill-9 Zabbix
/data/zabbix/sbin/zabbix_agentd-c/data/zabbix/conf/zabbix_agentd.conf
Five, to Zabbix server-side command test is correct
zabbix_server:192.168.109.132
/usr/local/zabbix/bin/zabbix_get-s 192.168.109.133-p 10050-k "Check.mysql"
Vi. back to the Web interface defining templates and adding app sets
Web Interface url:http://192.168.109.132:8027
1. Create an app set named MySQL
Configure--templates--Apply set--Create an app set
Vii. adding a monitoring project to the application set
Configure--Templates--application sets--monitoring items--Creating monitoring items
Viii. adding triggers
Configure--templates--triggers--create triggers
Ix. Adding a custom template
Configure-to-host-select Add Hosts--templates
zabbix3.2 defining mail Alerts One, modifying the hostname and hosts of the Zabbix server
Hostname zabbix.liyj.com
Vi/etc/hosts
127.0.0.1 zabbix.liyj.com localhost.localdomain localhost
Vi/etc/sysconfig/network
Networking=yes
Hostname=zabbix.liyj.com
Second, installation SendMail
Yum-y Install SendMail
Third, modify mail access
Vi/etc/mail/access
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
connect:127.0.0.1 RELAY
Connetct:zabbix.liyj.com
Iv. Modify mail hostname
Vi/etc/mail/local-host-names
Zabbix.liyj.com
V. Start the SendMail and test
Service SendMail Start
Telnet 127.0.0.1 25
Trying 127.0.0.1 ...
Connected to 127.0.0.1.
Escape character is ' ^] '.
Zabbix.alvin.com ESMTP Postfix
Vi. Creating an alarm medium
Manage-to-alarm media type--Create media type
VII. Create an alarm action
Configure-and-Create actions
Operation Default information:
Default recipient:
Fault {TRIGGER. STATUS}, server: {HOSTNAME1} occurred: {Trigger.name} failed!
Default information:
Alarm host: {HOSTNAME1}
Alarm time: {EVENT. DATE} {EVENT. TIME}
Alarm level: {TRIGGER. SEVERITY}
Warning message: {trigger.name}
Alarm item: {TRIGGER. KEY1}
Problem Details: {item.name}:{item. VALUE}
Current status: {TRIGGER. Status}:{item. VALUE1}
Event Id:{event.id}
Restore operation default information:
Default recipient:
Restore {TRIGGER. STATUS}, server: {HOSTNAME1}: {trigger.name} restored!
Default information:
Alarm host: {HOSTNAME1}
Alarm time: {EVENT. DATE} {EVENT. TIME}
Alarm level: {TRIGGER. SEVERITY}
Warning message: {trigger.name}
Alarm item: {TRIGGER. KEY1}
Problem Details: {item.name}:{item. VALUE}
Current status: {TRIGGER. Status}:{item. VALUE1}
Event Id:{event.id}
Eight, set the receiving alarm information user and alarm level
Manage-User--Select a user--alarm media
Note: In the recipient mailbox, [email protected] set to White list
Nine, testing
SSH 192.168.109.133
Service Mysqld Stop
Service mysqld Start
Check your inbox:
Deployment of zabbix3.2, templates, email alerts in Linux environments detailed procedures