基础准备

硬件需求


数据库需求

 

软件需求

其他软件需求


安装

安装方式

  • source code
  • 编译好的二进制包
  • rpm或者deb

源码编译安装部署zabbix以及附件

前提准备

  • 最小化安装操作系统
  • 分配好IP(内网外网ip设定)
  • 关闭selinux
  • 关闭firewalld
  • 时间同步
  1. [root@linux-node1 conf]# yum -y install ntp ntpdate
  2. [root@linux-node1 conf]# systemctl restart ntpd
  3. [root@linux-node1 conf]# ntpdate time.windows.com #时间同步
3
 
1
  1. [root@linux-node1 conf]# yum -y install ntp ntpdate
2
  1. [root@linux-node1 conf]# systemctl restart ntpd
3
  1. [root@linux-node1 conf]# ntpdate time.windows.com     #时间同步

zabbix-server安装

环境准备

  • OS:CentOS Linux release 7.3.1611 (Core)
  • zabbix:https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX Latest Stable/3.2.7/zabbix-3.2.7.tar.gz
  • Nginx:http://www.nginx.org/download/nginx-1.12.1.tar.gz
  • mysql:https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
  • php:http://cn2.php.net/distributions/php-5.6.31.tar.xz
  • jdk1.8:http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.rpm?AuthParam=1504418803_96caf675c8af37c08b7a8890c20e0ec8
  • hostname:linux-node1
  • IP:192.168.56.11
  • baseurl:/opt
  1. [root@linux-node1 ~]# hostname
  2. linux-node1
  3. [root@linux-node1 ~]# hostname -I
  4. 192.168.56.11 192.168.64.129
  5. [root@linux-node1 ~]# mkdir /opt/tools
  6. [root@linux-node1 ~]# cd /opt/tools
  7. [root@linux-node1 tools]# wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX Latest Stable/3.2.7/zabbix-3.2.7.tar.gz
  8. [root@linux-node1 tools]# wget http://www.nginx.org/download/nginx-1.12.1.tar.gz
  9. [root@linux-node1 tools]# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
  10. [root@linux-node1 tools]# wget http://cn2.php.net/distributions/php-5.6.31.tar.xz
  11. [root@linux-node1 tools]# wget http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.rpm?AuthParam=1504418803_96caf675c8af37c08b7a8890c20e0ec8
  12. [root@linux-node1 tools]# rpm -ivh jdk-8u144-linux-x64.rpm
  13. [root@linux-node1 ~]# yum -y install gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel gd curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel gcc gcc-c++ cmake ncurses-devel bison zlib-devel libaio gd curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel bzip2 bzip2-devel
yum -y install gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel gd curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel gcc gcc-c++ cmake ncurses-devel bison zlib-devel libaio gd curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel bzip2 bzip2-devel
  1. x
1
  1. [root@linux-node1 ~]# hostname
2
  1. linux-node1
3
  1. [root@linux-node1 ~]# hostname -I
4
  1. 192.168.56.11 192.168.64.129
5
  1. [root@linux-node1 ~]# mkdir /opt/tools
6
  1. [root@linux-node1 ~]# cd /opt/tools
7
  1. [root@linux-node1 tools]# wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX Latest Stable/3.2.7/zabbix-3.2.7.tar.gz
8
  1. [root@linux-node1 tools]# wget http://www.nginx.org/download/nginx-1.12.1.tar.gz
9
  1. [root@linux-node1 tools]# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
10
  1. [root@linux-node1 tools]# wget http://cn2.php.net/distributions/php-5.6.31.tar.xz
11
  1. [root@linux-node1 tools]# wget http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.rpm?AuthParam=1504418803_96caf675c8af37c08b7a8890c20e0ec8
12
  1. [root@linux-node1 tools]# rpm -ivh jdk-8u144-linux-x64.rpm
13
  1. [root@linux-node1 ~]# yum -y install gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel gd curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel gcc gcc-c++ cmake ncurses-devel bison zlib-devel libaio gd curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel bzip2 bzip2-devel

nginx安装

  1. [root@linux-node1 ~]# cd /opt/tools/
  2. [root@linux-node1 tools]# tar xf nginx-1.12.1.tar.gz
  3. [root@linux-node1 tools]# cd nginx-1.12.1
  4. [root@linux-node1 nginx-1.12.1]# vim src/core/nginx.h
  5. #define nginx_version 998
  6. #define NGINX_VERSION "9.9.8"
  7. #define NGINX_VER "Apache/" NGINX_VERSION
  8. #define NGINX_VAR "Apache"
  9. [root@linux-node1 nginx-1.12.1]# vim src/http/ngx_http_header_filter_module.c
  10. static u_char ngx_http_server_string[] = "Server: Apache" CRLF;
  11. [root@linux-node1 nginx-1.12.1]# vim src/http/ngx_http_special_response.c
  12. static u_char ngx_http_error_full_tail[] =
  13. "<hr><center>" NGINX_VER "</center>" CRLF
  14. "</body>" CRLF
  15. "</html>" CRLF
  16. ;
  17. static u_char ngx_http_error_build_tail[] =
  18. "<hr><center>" NGINX_VER_BUILD "</center>" CRLF
  19. "</body>" CRLF
  20. "</html>" CRLF
  21. [root@linux-node1 nginx-1.12.1]# ./configure --prefix=/opt/application/nginx --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-pcre --with-http_gzip_static_module --with-http_random_index_module --with-http_sub_module --with-http_dav_module --with-http_ssl_module
  22. [root@linux-node1 nginx-1.12.1]# make && make install
  1. x
 
1
  1. [root@linux-node1 ~]# cd /opt/tools/
2
  1. [root@linux-node1 tools]# tar xf nginx-1.12.1.tar.gz
3
  1. [root@linux-node1 tools]# cd nginx-1.12.1
4
  1. [root@linux-node1 nginx-1.12.1]# vim src/core/nginx.h
5
  1. #define nginx_version       998
6
  1. #define NGINX_VERSION     "9.9.8"
7
  1. #define NGINX_VER         "Apache/" NGINX_VERSION
8
  1. #define NGINX_VAR         "Apache"
9
  1. [root@linux-node1 nginx-1.12.1]# vim src/http/ngx_http_header_filter_module.c
10
  1. static u_char ngx_http_server_string[] = "Server: Apache" CRLF;
11
  1. [root@linux-node1 nginx-1.12.1]# vim src/http/ngx_http_special_response.c
12
  1. static u_char ngx_http_error_full_tail[] =
13
  1. "<hr><center>" NGINX_VER "</center>" CRLF
14
  1. "</body>" CRLF
15
  1. "</html>" CRLF
16
  1. ;
17
  1. static u_char ngx_http_error_build_tail[] =
18
  1. "<hr><center>" NGINX_VER_BUILD "</center>" CRLF
19
  1. "</body>" CRLF
20
  1. "</html>" CRLF
21
  1. [root@linux-node1 nginx-1.12.1]# ./configure --prefix=/opt/application/nginx --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-pcre --with-http_gzip_static_module --with-http_random_index_module --with-http_sub_module --with-http_dav_module --with-http_ssl_module
22
  1. [root@linux-node1 nginx-1.12.1]# make && make install

mysql安装

  1. [root@linux-node1 ~]# groupadd mysql
  2. [root@linux-node1 ~]# useradd -g mysql -s /sbin/nologin -M mysql
  3. [root@linux-node1 ~]# cd /opt/tools/
  4. [root@linux-node1 tools]# tar xf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
  5. [root@linux-node1 tools]# mv mysql-5.7.19-linux-glibc2.12-x86_64 /opt/application/mysql
  6. [root@linux-node1 tools]# cd /opt/application/mysql
  7. [root@linux-node1 mysql]# useradd -s /sbin/nologin -M mysql
  8. [root@linux-node1 mysql]# /opt/application/mysql/bin/mysqld --user=mysql --basedir=/opt/application/mysql --datadir=/opt/application/data --initialize
  9. 2017-09-02T14:59:34.959312Z 1 [Note] A temporary password is generated for root@localhost: VOFZIVorO4,W #此处有密码则表示安装成功
  10. [root@linux-node1 mysql]# ln -s /opt/application/mysql/bin/* /usr/bin/
  11. [root@linux-node1 mysql]# vim /etc/my.cnf #修改配置文件
  12. [client]
  13. port = 3306
  14. socket = /tmp/mysql.sock
  15. [mysqld]
  16. port = 3306
  17. socket = /tmp/mysql.sock
  18. skip-external-locking
  19. key_buffer_size = 16M
  20. max_allowed_packet = 1M
  21. table_open_cache = 64
  22. sort_buffer_size = 512K
  23. net_buffer_length = 8K
  24. read_buffer_size = 256K
  25. read_rnd_buffer_size = 512K
  26. myisam_sort_buffer_size = 8M
  27. symbolic-links = 0
  28. log-bin=mysql-bin
  29. binlog_format=mixed
  30. server-id = 1
  31. [mysqldump]
  32. quick
  33. max_allowed_packet = 16M
  34. [mysql]
  35. no-auto-rehash
  36. [myisamchk]
  37. key_buffer_size = 20M
  38. sort_buffer_size = 20M
  39. read_buffer = 2M
  40. write_buffer = 2M
  41. [mysqlhotcopy]
  42. interactive-timeout
  43. [root@linux-node1 mysql]# vim /opt/application/mysql/support-files/mysql.server
  44. basedir=/opt/application/mysql/
  45. datadir=/opt/application/data/
  46. [root@linux-node1 mysql]# cp /opt/application/mysql/support-files/mysql.server /etc/init.d/mysql
  47. [root@linux-node1 mysql]# /etc/init.d/mysql start
  48. Starting MySQL.Logging to '/opt/application/data/linux-node1.err'.
  49. SUCCESS! #启动成功
  50. [root@linux-node1 mysql]# mysql -pVOFZIVorO4,W #进入程序
  51. Enter password:
  52. Welcome to the MySQL monitor. Commands end with ; or \g.
  53. Your MySQL connection id is 3
  54. Server version: 5.7.19-log
  55. Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  56. Oracle is a registered trademark of Oracle Corporation and/or its
  57. affiliates. Other names may be trademarks of their respective
  58. owners.
  59. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  60. mysql> set password = password('woshiniba8');
  61. mysql> alter user 'root'@'localhost' password expire never;
  62. mysql> grant all privileges on *.* to root@'localhost' identified by 'woshiniba8';
  63. mysql> flush privileges;
  64. mysql> exit
 
1
  1. [root@linux-node1 ~]# groupadd mysql
2
  1. [root@linux-node1 ~]# useradd -g mysql -s /sbin/nologin -M mysql
3
  1. [root@linux-node1 ~]# cd /opt/tools/
4
  1. [root@linux-node1 tools]# tar xf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
5
  1. [root@linux-node1 tools]# mv mysql-5.7.19-linux-glibc2.12-x86_64 /opt/application/mysql
6
  1. [root@linux-node1 tools]# cd /opt/application/mysql
7
  1. [root@linux-node1 mysql]# useradd -s /sbin/nologin -M mysql
8
  1. [root@linux-node1 mysql]# /opt/application/mysql/bin/mysqld --user=mysql --basedir=/opt/application/mysql --datadir=/opt/application/data --initialize
9
  1. 2017-09-02T14:59:34.959312Z 1 [Note] A temporary password is generated for root@localhost: VOFZIVorO4,W           #此处有密码则表示安装成功
10
  1. [root@linux-node1 mysql]# ln -s /opt/application/mysql/bin/* /usr/bin/
11
  1. [root@linux-node1 mysql]# vim /etc/my.cnf                                                           #修改配置文件
12
  1. [client]
13
  1. port = 3306
14
  1. socket = /tmp/mysql.sock
15
  1. [mysqld]
16
  1. port = 3306
17
  1. socket = /tmp/mysql.sock
18
  1. skip-external-locking
19
  1. key_buffer_size = 16M
20
  1. max_allowed_packet = 1M
21
  1. table_open_cache = 64
22
  1. sort_buffer_size = 512K
23
  1. net_buffer_length = 8K
24
  1. read_buffer_size = 256K
25
  1. read_rnd_buffer_size = 512K
26
  1. myisam_sort_buffer_size = 8M
27
  1. symbolic-links = 0
28
  1. log-bin=mysql-bin
29
  1. binlog_format=mixed
30
  1. server-id = 1
31
  1. [mysqldump]
32
  1. quick
33
  1. max_allowed_packet = 16M
34
  1. [mysql]
35
  1. no-auto-rehash
36
  1. [myisamchk]
37
  1. key_buffer_size = 20M
38
  1. sort_buffer_size = 20M
39
  1. read_buffer = 2M
40
  1. write_buffer = 2M
41
  1. [mysqlhotcopy]
42
  1. interactive-timeout
43
  1. [root@linux-node1 mysql]# vim /opt/application/mysql/support-files/mysql.server
44
  1. basedir=/opt/application/mysql/
45
  1. datadir=/opt/application/data/
46
  1. [root@linux-node1 mysql]# cp /opt/application/mysql/support-files/mysql.server /etc/init.d/mysql
47
  1. [root@linux-node1 mysql]# /etc/init.d/mysql start
48
  1. Starting MySQL.Logging to '/opt/application/data/linux-node1.err'.
49
  1. SUCCESS!                      #启动成功
50
  1.  
51
  1. [root@linux-node1 mysql]# mysql -pVOFZIVorO4,W   #进入程序
52
  1. Enter password:
53
  1. Welcome to the MySQL monitor. Commands end with ; or \g.
54
  1. Your MySQL connection id is 3
55
  1. Server version: 5.7.19-log
56
  1. Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
57
  1. Oracle is a registered trademark of Oracle Corporation and/or its
58
  1. affiliates. Other names may be trademarks of their respective
59
  1. owners.
60
  1. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
61
  1. mysql> set password = password('woshiniba8');
62
  1. mysql> alter user 'root'@'localhost' password expire never;
63
  1. mysql> grant all privileges on *.* to root@'localhost' identified by 'woshiniba8';
64
  1. mysql> flush privileges;
65
  1. mysql> exit

php安装

  • libiconv字符集转换库
  1. [root@linux-node1 ~]# cd /opt/tools/
  2. [root@linux-node1 tools]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
  3. [root@linux-node1 tools]# tar xf libiconv-1.14.tar.gz
  4. [root@linux-node1 tools]# cd libiconv-1.14
  5. [root@linux-node1 libiconv-1.14]# ./configure --prefix=/usr/local/libiconv
  6. [root@linux-node1 libiconv-1.14]# vim srclib/stdio.in.h 修改698行如下:
  7. #if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
  8. _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
  9. #endif
  10. [root@linux-node1 libiconv-1.14]# make && make install
  1. x
 
1
  1. [root@linux-node1 ~]# cd /opt/tools/
2
  1. [root@linux-node1 tools]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
3
  1. [root@linux-node1 tools]# tar xf libiconv-1.14.tar.gz
4
  1. [root@linux-node1 tools]# cd libiconv-1.14
5
  1. [root@linux-node1 libiconv-1.14]# ./configure --prefix=/usr/local/libiconv
6
  1. [root@linux-node1 libiconv-1.14]# vim srclib/stdio.in.h 修改698行如下:
7
  1. #if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)  
8
  1.       _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
9
  1. #endif
10
  1. [root@linux-node1 libiconv-1.14]# make && make install

  • libmcrypt加密算法拓展库
  1. [root@linux-node1 ~]# cd /opt/tools/
  2. [root@linux-node1 tools]# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
  3. [root@linux-node1 tools]# tar xf libmcrypt-2.5.7.tar.gz
  4. [root@linux-node1 tools]# cd libmcrypt-2.5.7
  5. [root@linux-node1 libmcrypt-2.5.7]# ./configure && make && make install
  1. x
 
1
  1. [root@linux-node1 ~]# cd /opt/tools/
2
  1. [root@linux-node1 tools]# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
3
  1. [root@linux-node1 tools]# tar xf libmcrypt-2.5.7.tar.gz
4
  1. [root@linux-node1 tools]# cd libmcrypt-2.5.7
5
  1. [root@linux-node1 libmcrypt-2.5.7]# ./configure && make && make install

  • php安装
  1. [root@linux-node1 ~]# cd /opt/tools/
  2. [root@linux-node1 tools]# tar xf php-5.6.31.tar.xz
  3. [root@linux-node1 tools]# cd php-5.6.31
  4. [root@linux-node1 php-5.6.31]# ./configure --prefix=/opt/application/php --with-config-file-path=/opt/application/php/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql --with-mysqli --with-mysql --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath
  5. [root@linux-node1 php-5.6.31]# make && make install
  1. x
 
1
  1. [root@linux-node1 ~]# cd /opt/tools/
2
  1. [root@linux-node1 tools]# tar xf php-5.6.31.tar.xz
3
  1. [root@linux-node1 tools]# cd php-5.6.31
4
  1. [root@linux-node1 php-5.6.31]# ./configure --prefix=/opt/application/php --with-config-file-path=/opt/application/php/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql --with-mysqli --with-mysql --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath
5
  1. [root@linux-node1 php-5.6.31]# make && make install

  • zabbix安装(安装好server,agent,java-proxy,snmp,mysql等插件)
  1. [root@linux-node1 ~]# groupadd zabbix
  2. [root@linux-node1 ~]# useradd -g zabbix -s /sbin/nologin zabbix
  3. [root@linux-node1 ~]# cd /opt/tools/
  4. [root@linux-node1 tools]# tar xf zabbix-3.2.7.tar.gz
  5. [root@linux-node1 tools]# cd zabbix-3.2.7
  6. [root@linux-node1 zabbix-3.2.7]# yum -y install curl libcurl-devel net-snmp net-snmp-devel perl-DBI libdbi-dbd-mysql mysql-devel gcc gcc++ make libxml2 libxml2-devel java-devel
  7. [root@linux-node1 zabbix-3.2.7]# ./configure --prefix=/opt/application/zabbix --enable-server --enable-java --enable-proxy --enable-agent --with-net-snmp --with-mysql=/opt/application/mysql/bin/mysql_config --with-libcurl --with-libxml2
  8. [root@linux-node1 zabbix-3.2.7]# make && make install
  9. [root@linux-node1 zabbix-3.2.7]# mkdir /opt/application/nginx/html/zabbix/
  10. [root@linux-node1 zabbix-3.2.7]# cp -r frontends/php/* /opt/application/nginx/html/zabbix/
  11. [root@linux-node1 zabbix-3.2.7]# l -s /opt/application/zabbix/sbin/* /usr/local/sbin/
  12. [root@linux-node1 zabbix-3.2.7]# ln -s /opt/application/zabbix/bin/* /usr/local/bin/
  13. [root@linux-node1 zabbix-3.2.7]# echo "/opt/application/mysql/lib" >> /etc/ld.so.conf
  14. [root@linux-node1 zabbix-3.2.7]# ldconfig ll
l
 
1
  1. [root@linux-node1 ~]# groupadd zabbix
2
  1. [root@linux-node1 ~]# useradd -g zabbix -s /sbin/nologin zabbix
3
  1. [root@linux-node1 ~]# cd /opt/tools/
4
  1. [root@linux-node1 tools]# tar xf zabbix-3.2.7.tar.gz
5
  1. [root@linux-node1 tools]# cd zabbix-3.2.7
6
  1. [root@linux-node1 zabbix-3.2.7]# yum -y install curl libcurl-devel net-snmp net-snmp-devel perl-DBI libdbi-dbd-mysql mysql-devel gcc gcc++ make libxml2 libxml2-devel java-devel
7
  1. [root@linux-node1 zabbix-3.2.7]# ./configure --prefix=/opt/application/zabbix --enable-server --enable-java --enable-proxy --enable-agent --with-net-snmp --with-mysql=/opt/application/mysql/bin/mysql_config --with-libcurl --with-libxml2
8
  1. [root@linux-node1 zabbix-3.2.7]# make && make install
9
  1. [root@linux-node1 zabbix-3.2.7]# mkdir /opt/application/nginx/html/zabbix/
10
  1. [root@linux-node1 zabbix-3.2.7]# cp -r frontends/php/* /opt/application/nginx/html/zabbix/
11
  1. [root@linux-node1 zabbix-3.2.7]# l -s /opt/application/zabbix/sbin/* /usr/local/sbin/
12
  1. [root@linux-node1 zabbix-3.2.7]# ln -s /opt/application/zabbix/bin/* /usr/local/bin/
13
  1. [root@linux-node1 zabbix-3.2.7]# echo "/opt/application/mysql/lib" >> /etc/ld.so.conf
14
  1. [root@linux-node1 zabbix-3.2.7]# ldconfig ll

服务配置以及启动

nginx配置与启动

  1. [root@linux-node1 ~]# vim /opt/application/nginx/conf/nginx.conf
  2. server {
  3. listen 8888;
  4. root html/zabbix/;
  5. location ~ \.php$ {
  6. fastcgi_pass 127.0.0.1:9000;
  7. fastcgi_index index.php;
  8. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  9. include fastcgi_params;
  10. }
  11. }
  12. [root@linux-node1 ~]# /opt/application/nginx/sbin/nginx
  13. [root@linux-node1 ~]# ps -ef | grep nginx
  14. root 48031 1 0 12:50 ? 00:00:00 nginx: master process /opt/application/nginx/sbin/nginx
  15. nobody 48032 48031 0 12:50 ? 00:00:00 nginx: worker process
  16. root 48140 19734 0 13:20 pts/0 00:00:00 grep --color=auto nginx
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
  1. x
1
  1. [root@linux-node1 ~]# vim /opt/application/nginx/conf/nginx.conf
2
  1. server {
3
  1.       listen       8888;
4
  1.       root   html/zabbix/;      
5
  1.       location ~ \.php$ {
6
  1.               fastcgi_pass   127.0.0.1:9000;
7
  1.               fastcgi_index index.php;
8
  1.               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
9
  1.               include       fastcgi_params;
10
  1.     }
11
  1. }
12
  1. [root@linux-node1 ~]# /opt/application/nginx/sbin/nginx
13
  1. [root@linux-node1 ~]# ps -ef | grep nginx
14
  1. root      48031      1  0 12:50 ?        00:00:00 nginx: master process /opt/application/nginx/sbin/nginx
15
  1. nobody    48032  48031  0 12:50 ?        00:00:00 nginx: worker process
16
  1. root      48140  19734  0 13:20 pts/0    00:00:00 grep --color=auto nginx
mysql数据配置
  1. [root@linux-node1 ~]# mysql -pwoshiniba8
  2. mysql> create database zabbix character set utf8; #创建库
  3. mysql> grant all on zabbix.* to zabbix@'localhost' identified by 'woshiniba8'; # 权限分配
  4. mysql> flush privileges;
  5. mysql> exit
  6. [root@linux-node1 ~]# cd /opt/tools/zabbix-3.2.7/database/mysql/
  7. [root@linux-node1 mysql]# mysql -uzabbix -pwoshiniba8 zabbix < schema.sql
  8. [root@linux-node1 mysql]# mysql -uzabbix -pwoshiniba8 zabbix < images.sql
  9. [root@linux-node1 mysql]# mysql -uzabbix -pwoshiniba8 zabbix < data.sql
  1. x
 
1
  1. [root@linux-node1 ~]# mysql -pwoshiniba8
2
  1. mysql> create database zabbix character set utf8;      #创建库
3
  1. mysql> grant all on zabbix.* to zabbix@'localhost' identified by 'woshiniba8';   #   权限分配
4
  1. mysql> flush privileges;
5
  1. mysql> exit
6
  1. [root@linux-node1 ~]# cd /opt/tools/zabbix-3.2.7/database/mysql/
7
  1. [root@linux-node1 mysql]# mysql -uzabbix -pwoshiniba8 zabbix < schema.sql
8
  1. [root@linux-node1 mysql]# mysql -uzabbix -pwoshiniba8 zabbix < images.sql
9
  1. [root@linux-node1 mysql]# mysql -uzabbix -pwoshiniba8 zabbix < data.sql

php的配置与启动

  1. [root@linux-node1 ~]# cp /opt/tools/php-5.6.31/php.ini-production /opt/application/php/etc/php.ini
  2. [root@linux-node1 ~]# vim /opt/application/php/etc/php.ini
  3. max_execution_time = 300 Default is 30
  4. memory_limit = 128M no change, default is 128M
  5. post_max_size = 16M (default is 8M)
  6. upload_max_filesize = 2M no change, default is 2M
  7. max_input_time = 300 (default is 60)
  8. date.timezone = Asia/Shanghai (default is empty)
  9. always_populate_raw_post_data = -1
  10. [root@linux-node1 ~]# echo "/opt/web/php/sbin/php-fpm" >> /etc/rc.local
  11. [root@linux-node1 ~]# cp /opt/application/php/etc/php-fpm.conf.default /opt/application/php/etc/php-fpm.conf
  12. [root@linux-node1 ~]# cp /opt/application/php/sbin/php-fpm /etc/init.d/php-fpm
  13. [root@linux-node1 ~]# chmod +x /etc/init.d/php-fpm
  14. [root@linux-node1 ~]# /etc/init.d/php-fpm
  15. [root@linux-node1 ~]# ps -ef | grep php #检测
  16. root 48134 1 0 13:20 ? 00:00:00 php-fpm: master process (/opt/application/php/etc/php-fpm.conf)
  17. nobody 48135 48134 0 13:20 ? 00:00:00 php-fpm: pool www
  18. nobody 48136 48134 0 13:20 ? 00:00:00 php-fpm: pool www
  19. root 48138 19734 0 13:20 pts/0 00:00:00 grep --color=auto php
  1. x
 
1
  1. [root@linux-node1 ~]# cp /opt/tools/php-5.6.31/php.ini-production /opt/application/php/etc/php.ini
2
  1. [root@linux-node1 ~]# vim /opt/application/php/etc/php.ini
3
  1. max_execution_time = 300 Default is 30
4
  1. memory_limit = 128M no change, default is 128M
5
  1. post_max_size = 16M (default is 8M)
6
  1. upload_max_filesize = 2M no change, default is 2M
7
  1. max_input_time = 300   (default is 60)
8
  1. date.timezone = Asia/Shanghai   (default is empty)
9
  1. always_populate_raw_post_data = -1
10
  1. [root@linux-node1 ~]# echo "/opt/web/php/sbin/php-fpm" >> /etc/rc.local
11
  1. [root@linux-node1 ~]# cp /opt/application/php/etc/php-fpm.conf.default /opt/application/php/etc/php-fpm.conf
12
  1. [root@linux-node1 ~]# cp /opt/application/php/sbin/php-fpm /etc/init.d/php-fpm
13
  1. [root@linux-node1 ~]# chmod +x /etc/init.d/php-fpm
14
  1. [root@linux-node1 ~]# /etc/init.d/php-fpm
15
  1. [root@linux-node1 ~]# ps -ef | grep php       #检测
16
  1. root      48134      1  0 13:20 ?        00:00:00 php-fpm: master process (/opt/application/php/etc/php-fpm.conf)
17
  1. nobody    48135  48134  0 13:20 ?        00:00:00 php-fpm: pool www
18
  1. nobody    48136  48134  0 13:20 ?        00:00:00 php-fpm: pool www
19
  1. root      48138  19734  0 13:20 pts/0    00:00:00 grep --color=auto php

zabbix-sever配置与启动:

注意:当系统版本是centos7.0或者7.1的话,需要升级trousers,否则启动会报错
  1. [root@linux-node1 ~]# cd /opt/application/zabbix/etc/
  2. [root@linux-node1 etc]# vim zabbix_server.conf
  3. LogFile=/opt/application/zabbix/logs/zabbix_server.log
  4. PidFile=/tmp/zabbix_server.pid
  5. DBHost=localhost
  6. DBName=zabbix
  7. DBUser=zabbix
  8. DBPassword=woshiniba8
  9. [root@linux-node1 ~]# mkdir /opt/application/zabbix/logs/
  10. [root@linux-node1 sbin]# chmod 777 /opt/application/zabbix/logs/ -R
  11. [root@linux-node1 ~]# /opt/application/zabbix/sbin/zabbix_server #服务启动
11
 
1
  1. [root@linux-node1 ~]# cd /opt/application/zabbix/etc/
2
  1. [root@linux-node1 etc]# vim zabbix_server.conf
3
  1. LogFile=/opt/application/zabbix/logs/zabbix_server.log
4
  1. PidFile=/tmp/zabbix_server.pid
5
  1. DBHost=localhost
6
  1. DBName=zabbix
7
  1. DBUser=zabbix
8
  1. DBPassword=woshiniba8
9
  1. [root@linux-node1 ~]# mkdir /opt/application/zabbix/logs/
10
  1. [root@linux-node1 sbin]# chmod 777 /opt/application/zabbix/logs/ -R
11
  1. [root@linux-node1 ~]# /opt/application/zabbix/sbin/zabbix_server     #服务启动

zabbix-agent配置与启动

zabbix-server同样也需要监控自己
  1. [root@linux-node1 ~]# cd /opt/application/zabbix/etc/
  2. [root@linux-node1 etc]# vim zabbix_agentd.conf
  3. LogFile=/opt/application/zabbix/logs/zabbix_agentd.log
  4. Server=127.0.0.1
  5. ServerActive=127.0.0.1
  6. Hostname=Zabbix server
  7. [root@linux-node1 etc]# /opt/application/zabbix/sbin/zabbix_agentd #服务启动
7
 
1
  1. [root@linux-node1 ~]# cd /opt/application/zabbix/etc/
2
  1. [root@linux-node1 etc]# vim zabbix_agentd.conf
3
  1. LogFile=/opt/application/zabbix/logs/zabbix_agentd.log
4
  1. Server=127.0.0.1
5
  1. ServerActive=127.0.0.1
6
  1. Hostname=Zabbix server
7
  1. [root@linux-node1 etc]# /opt/application/zabbix/sbin/zabbix_agentd         #服务启动

web界面登录配置

  • 配置检查
  • 连接数据库
  • server详细信息
  • 继续下一步
  • 安装
 此时有报错:可以按照上面的步骤下载zabbix.conf.php传到/opt/application/nginx/html/zabbix/conf/
  • 登录
  • darshboard
 

zabbix客户端安装

客户端准备环境

  1. [root@linux-node2 ~]# yum -y install gcc gcc-devel c++
  2. [root@linux-node2 ~]# mkdir /opt/{application,tools}
  3. [root@linux-node2 tools]# wget http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.rpm?AuthParam=1504418803_96caf675c8af37c08b7a8890c20e0ec8
  4. [root@linux-node2 tools]# rpm -ivh jdk-8u144-linux-x64.rpm
  5. [root@linux-node2 tools]# wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX Latest Stable/3.2.7/zabbix-3.2.7.tar.gz
  6. [root@linux-node1 tools]# useradd -s /sbin/nologin zabbix
6
 
1
  1. [root@linux-node2 ~]# yum -y install gcc gcc-devel c++
2
  1. [root@linux-node2 ~]# mkdir /opt/{application,tools}
3
  1. [root@linux-node2 tools]# wget http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.rpm?AuthParam=1504418803_96caf675c8af37c08b7a8890c20e0ec8
4
  1. [root@linux-node2 tools]# rpm -ivh jdk-8u144-linux-x64.rpm
5
  1. [root@linux-node2 tools]# wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX Latest Stable/3.2.7/zabbix-3.2.7.tar.gz
6
  1. [root@linux-node1 tools]# useradd -s /sbin/nologin zabbix

客户端安装

  1. [root@linux-node2 ~]# cd /opt/tools/
  2. [root@linux-node2 tools]# tar xf zabbix-3.2.7.tar.gz
  3. [root@linux-node2 zabbix-3.2.7]# ./configure --prefix=/opt/application/zabbix-agent --enable-agent --enable-java
  4. [root@linux-node2 zabbix-3.2.7]# make && make install
./configure --prefix=/opt/application/zabbix-agent --enable-agent --enable-java
  1. x
1
  1. [root@linux-node2 ~]# cd /opt/tools/
2
  1. [root@linux-node2 tools]# tar xf zabbix-3.2.7.tar.gz
3
  1. [root@linux-node2 zabbix-3.2.7]# ./configure --prefix=/opt/application/zabbix-agent --enable-agent --enable-java
4
  1. [root@linux-node2 zabbix-3.2.7]# make && make install
客户端配置
  1. [root@linux-node2 ~]# cd /opt/application/zabbix-agent/etc/
  2. [root@linux-node2 etc]# vim zabbix_agentd.conf
  3. LogFile=/opt/application/zabbix-agent/logs/zabbix_agentd.log
  4. Server=192.168.56.11
  5. Hostname=Zabbix server
  6. [root@linux-node2 etc]# mkdir /opt/application/zabbix-agent/logs
  7. [root@linux-node2 etc]# chmod 777 -R /opt/application/zabbix-agent/logs
  8. [root@linux-node2 etc]# groupadd zabbix
  9. [root@linux-node2 etc]# useradd -g zabbix -s /sbin/nologin -M zabbix
  10. [root@linux-node2 etc]# /opt/application/zabbix-agent/sbin/zabbix_agentd
 
1
  1. [root@linux-node2 ~]# cd /opt/application/zabbix-agent/etc/
2
  1. [root@linux-node2 etc]# vim zabbix_agentd.conf
3
  1. LogFile=/opt/application/zabbix-agent/logs/zabbix_agentd.log
4
  1. Server=192.168.56.11
5
  1. Hostname=Zabbix server
6
  1. [root@linux-node2 etc]# mkdir /opt/application/zabbix-agent/logs
7
  1. [root@linux-node2 etc]# chmod 777 -R /opt/application/zabbix-agent/logs
8
  1. [root@linux-node2 etc]# groupadd zabbix
9
  1. [root@linux-node2 etc]# useradd -g zabbix -s /sbin/nologin -M zabbix
10
  1. [root@linux-node2 etc]# /opt/application/zabbix-agent/sbin/zabbix_agentd

添加第一台监控主机

  • 登录zabbix-darshboard
  • 添加主机
  • 主机信息填写

  • 配置模板
 
至此,第一台机器监控就告一段落

 

 

zabbix源码编译安装以及添加第一台host监控的更多相关文章

  1. Zabbix 源码编译安装

    简介: Zabbix 分布式监控系统,源码编译安装记录 ( 记不得是第多少次了 ) 下载地址:http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX ...

  2. nginx在centos 7中源码编译安装【添加grpc的支持】

    安装依赖软件 1.安装编译工具gcc gcc是一个开源编译器集合,用于处理各种各样的语言:C.C++.Java.Ada等,在linux世界中是最通用的编译器,支持大量处理器:x86.AMD64.Pow ...

  3. 保姆级教程——Ubuntu16.04 Server下深度学习环境搭建:安装CUDA8.0,cuDNN6.0,Bazel0.5.4,源码编译安装TensorFlow1.4.0(GPU版)

    写在前面 本文叙述了在Ubuntu16.04 Server下安装CUDA8.0,cuDNN6.0以及源码编译安装TensorFlow1.4.0(GPU版)的亲身经历,包括遇到的问题及解决办法,也有一些 ...

  4. zstack源码编译安装(1.7.x版本)

    图片没粘贴过来,请看本人gitbook吧https://www.gitbook.com/book/jingtyu/how-to-learn-zstack-code 运行环境 zstack的安装方式有很 ...

  5. ambari 2.5.0源码编译安装

    参考:https://www.ibm.com/developerworks/cn/opensource/os-cn-bigdata-ambari/index.html Ambari 是什么 Ambar ...

  6. 源码编译安装MySQL8.0.20

    1 概述 本文章主要讲述了如何从源码编译安装MySQL社区版8.0.20,首先会介绍一些编译安装的相关知识,然后开始编译安装 2 源码编译安装的相关知识 2.1 make与configure make ...

  7. LAMP架构—源码编译安装 (爱情受过伤,为爱跳过鸭绿江)

    LAMP架构--源码编译安装 1.LAMP架构概述 2.编译安装Apache httpd 服务 3.编译安装mysql 服务 4.编译安装PHP 解析服务 5.利用LAMP搭建论坛 1.LAMP架构概 ...

  8. Centos7.X 源码编译安装subversion svn1.8.x

    说明:SVN(subversion)的运行方式有两种:一种是基于Apache的http.https网页访问形式:还有一种是基于svnserve的独立服务器模式.SVN的数据存储方式也有两种:一种是在B ...

  9. centos6.5环境源码编译安装mysql5.6.34

    centos6.5环境源码编译安装mysql5.6.34 源码下载地址http://dev.mysql.com/downloads/mysql/5.6.html#downloads 选择Generic ...

随机推荐

  1. Python - 基本数据类型及其常用的方法之字典和布尔值

    字典 特点:{"key1": value1, "key2":value2}  , 键值对中的值可以为任何数据类型,键不能为列表.字典(无法哈希),布尔值可以为键 ...

  2. 修改CentOS6.5主机名引起MySQL5.6.35服务问题

    本来是心血来潮修改CentOS6.5的主机名 /****** 修改CentOS6.5默认主机名 ******/ .备份系统网络配置文件 [root@localhost ~]# cp /etc/sysc ...

  3. Python模块安装方式

    一.方法1: 单文件模块直接把文件拷贝到 $python_dir/lib/python3.4/site-packages/ 二.方法2: 多文件模块,带setup.py 下载模块包,进行解压,进入模块 ...

  4. LA3029 City Game

    Bob is a strategy game programming specialist. In his new city building game the gaming environment ...

  5. 用惯了jquery, 想用angularjs 还真不好理解

    jquery 比较直白,什么都是操作dom 节点. angularjs 就好比 thinkphp, ci 等框架,有自己约定的格式和方式.需要遵循它的规则,研究中... 比如说我,用了很长事件的jqu ...

  6. Spring.Net2.0+NHibernate4.0 +Asp.Net Mvc4 一

    1.创建项目结构 控制器:    SN.Controllers 数据访问 :SN.Dao 实体映射: SN.Models 服务层:     SN.Servers 视图层:   SN.Web 2.添加需 ...

  7. 2018-8-10-如何移动-nuget-缓存文件夹

    title author date CreateTime categories 如何移动 nuget 缓存文件夹 lindexi 2018-08-10 19:16:51 +0800 2018-2-13 ...

  8. 一个基于swoole的作业调度组件,已经实现了redis和rabitmq队列消息存储。

    https://github.com/kcloze/swoole-jobs 一个基于swoole的作业调度组件,已经实现了redis和rabitmq队列消息存储.参考资料:swoole https:/ ...

  9. ubuntu设置终端命令历史记录

    ----------------------------------------------- HISTTIMEFORMAT='%F %T ' # 使用HISTTIMEFORMAT在历史中显示TIME ...

  10. 模拟4题解 T3奇袭

    T3奇袭 题目描述 由于各种原因,桐人现在被困在Under World(以下简称UW)中,而UW马上 要迎来最终的压力测试——魔界入侵. 唯一一个神一般存在的Administrator被消灭了,靠原本 ...