zabbix3 0 源码安装server端详细过程

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

安装文档地址:https://www.zabbix.com/documentation/3.0/

下载地址:http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/

 

-->背景rpm安装

上次,从rpm安装到放弃http://blog.csdn.net/mchdba/article/details/51226751 ,事后仔细想了下,虽然rpm安装不成功,但是还有别的办法可以一试,比如resource,所以准备下载tar.gz准备源码安装。


对zabbix的安装做个大概的简介,zabbix安装需要安装以下4个重要的模块

(1)zabbix_server,zabbix服务器端,提供基础服务监控

(2)zabbix_agentd,zabbix客户端,为被监控的服务器与zabbix_server保持监控联系状态

(3)php,zabbix管理工程组件,zabbix-web是php工程

(4)nginx,通过nginx来控制访问zabbix-web工程界面

(5)mysql,存储zabbix监控数据和基础信息


1,关闭selinux

[root@hch_test_121_12 zabbix-server-mysql-3.0.1]#  setenforce 0                                                                                                                                               

 

setenforce: SELinux is disabled

 

[root@hch_test_121_12  zabbix-server-mysql-3.0.1]# getenforce

 

Disabled

 

[root@hch_test_121_12  zabbix-server-mysql-3.0.1]#

 

 

2,准备安装nginx

# 为了支持rewrite功能,我们需要安装pcre                                                                                                                                                                                             

 

yum install -y pcre* 

 

# 需要ssl的支持,如果不需要ssl支持,请跳过这一步  

 

yum install -y openssl*

 

# 安装nginx:

 

tar -xvf nginx-1.8.1.tar.gz

 

cd nginx-1.8.1

 

./configure  --prefix=/usr/local/nginx-1.8.1 --with-http_ssl_module  --with-http_spdy_module --with-http_stub_status_module --with-pcre

 

 

 

#--with-http_stub_status_module:支持nginx状态查询

 

#--with-http_ssl_module:支持https

 

#--with-http_spdy_module:支持google的spdy,想了解请百度spdy,这个必须有ssl的支持

 

#--with-pcre:为了支持rewrite重写功能,必须制定pcre

 

 

 

cd /usr/local/

 

ln -s nginx-1.8.1 nginx

 

/usr/local/nginx/sbin/nginx

 

 

 

3,安装php

Php5.6.20下载地址:

http://php.net/get/php-5.6.20.tar.gz/from/a/mirror                                                                                                                                                                                             

        

 原blog地址:http://blog.csdn.net/mchdba/article/details/51263871,谢绝转载。

 

开始源码安装php:

# 准备依赖的组件包

 

yum install gcc make gd-devel  libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel -y

 

# 安装命令

 

tar -xvf php-5.6.20.tar.bz2

 

cd php-5.6.20

 

./configure   --prefix=/usr/local/php-5.6.20  --with-config-file-path=/usr/local/php-5.6.20/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=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd  --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath

 

make

 

make install

 

 

 

cd /usr/local

 

ln -s php-5.6.20 php

 

cp /soft/php-5.6.20/php.ini-production  /usr/local/php/etc/php.ini

 

cp /soft/php-5.6.20/sapi/fpm/php-fpm.conf  /usr/local/php/etc/php-fpm.conf

 

ln -s /usr/local/php/sbin/* /usr/sbin/

 

 

 

# 启动php-fpm

 

php-fpm

 

[root@hch_test_121_12 local]# php-fpm

 

[root@hch_test_121_12 local]#

 

 

 

# check下是否启动成功

 

[root@hch_test_121_12 local]# netstat  -ntpl|grep 9000

 

tcp         0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      527/php-fpm         

 

[root@hch_test_121_12 local]#

 

配置php.ini参数, vim /usr/local/php/etc/php.ini:

 

                                                                                                                                                                                                                                         
    

Pre-requisite

Minimum value

Description

PHP version

5.4.0

PHP memory_limit option

128MB

In php.ini:  memory_limit    = 128M

PHP post_max_size option

16MB

In php.ini:  post_max_size    = 16M

PHP upload_max_filesize option

2MB

In php.ini:
    upload_max_filesize = 2M

PHP max_execution_time option

300 seconds (values 0 and -1 are allowed)

In php.ini:
    max_execution_time = 300

PHP max_input_time option

300 seconds (values 0 and -1 are allowed)

In php.ini:
    max_input_time = 300

PHP session.auto_start option

must be disabled

In php.ini:
    session.auto_start = 0

Database support

One of: IBM DB2, MySQL, Oracle, PostgreSQL, SQLite

One of the following modules must be installed:
    ibm_db2, mysql, oci8, pgsql, sqlite3

bcmath

php-bcmath

mbstring

php-mbstring

PHP mbstring.func_overload option

must be disabled

In php.ini:
    mbstring.func_overload = 0

PHP always_populate_raw_post_data    option

must be disabled

Required only for PHP versions 5.6.0 or newer.
    In php.ini:
    always_populate_raw_post_data = -1

sockets

php-net-socket. Required for user script support.

gd

2.0 or higher

php-gd. PHP GD extension must support PNG images (--with-png-dir), JPEG (--with-jpeg-dir) images and    FreeType 2 (--with-freetype-dir).

libxml

2.6.15

php-xml or php5-dom

xmlwriter

php-xmlwriter

xmlreader

php-xmlreader

ctype

php-ctype

session

php-session

gettext

php-gettext
    Since Zabbix 2.2.1, the PHP gettext extension is not a mandatory requirement    for installing Zabbix. If gettext is not installed, the frontend will work    as usual, however, the translations will not be available.

 

 

4,配置nginx

修改nginx配置文件/usr/local/nginx/conf/nginx.conf:

server {

 

         listen  80;

 

          server_name   ys.zabbix.com;

 

         access_log  /usr/local/nginx/logs/zabbix.access.log;                                                                                                                                                                      

 

          

 

         index  index.php index.html index.html;

 

         root  /usr/local/nginx/html/zabbix;

 

          

 

         location  /

 

         {

 

                   try_files  $uri $uri/ /index.php?$args;

 

         }

 

          

 

         location  ~ .*\.(php)?$

 

         {

 

                   expires  -1s;

 

                   try_files  $uri =404;

 

                   fastcgi_split_path_info  ^(.+\.php)(/.+)$;

 

                   include  fastcgi_params;

 

                   fastcgi_param  PATH_INFO $fastcgi_path_info;

 

                   fastcgi_index  index.php;

 

                   fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

 

                   fastcgi_pass  127.0.0.1:9000;

 

          

 

         }

 

}

 

如果没有启用dns域名系统的话,可以在/etc/hosts加下ip地址和域名的配置:

# vim /etc/hosts

 

192.168.121.12 ys.zabbix.com                                                                                                                                                                                                                    

 

# 启动nginx服务

 

/usr/local/nginx/sbin/nginx

 

添加测试的info.php,在nginx的html目录:

mkdir -p /usr/local/nginx/html/zabbix

 

vim /usr/local/nginx/html/zabbix/info.php                                                                                                                                                                                                    

 

# info.php录入以下内容

 

<?php

 

phpinfo();

 

?>

 

 

nginx将会连接回环地址9000端口执行PHP文件,需要使用tcp/ip协议,速度比较慢.建议大家换成使用socket方式连接。将fastcgi_pass127.0.0.1:9000;改成fastcgi_passunix:/var/run/phpfpm.sock;

 

检测php+nginx是否配置成功,在浏览器打开网址:ys.zabbix.com/info.php或者http://192.168.121.12/info.php,如下所示D:\study\zabbix\2.png:

 

 

5,开始安装zabbix

注明php要5.4以上,curl需要7.20以上,下载地址是:

tar zxvf zabbix-3.0.2.tar.gz

 

cd zabbix-3.0.2

 

./configure --prefix=/usr/local/zabbix  --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp  --with-libcurl --with-libxml2

 

make

 

make install

 

 

6,准备mysql数据库

安装mysql数据库:

http://blog.csdn.net/mchdba/article/details/51138063

 

创建zabbix的数据库:

mysql> create database zabbix charset  set utf8;

 

Query OK, 1 row affected (0.00 sec)

 

 

 

mysql> grant all privileges on  zabbix.* to zabbix@'10.%' identified by 'zabbix0418';                                                                                                      

 

Query OK, 0 rows affected (0.00 sec)

 

 

 

mysql> grant all privileges on  zabbix.* to zabbix@'192.%' identified by 'zabbix0418';

 

Query OK, 0 rows affected (0.01 sec)

 

 

 

mysql>

 

PS:字符集要设置为utf8mb4,防止界面切换到中文的时候乱码。

 

导入create.sql.gz文件,建立zabbix-server的数据库(ps,以前的版本可能叫啥schema.sql之类的):

mysql> source “/data/create.sql”;                                                                                                                                                                                               

 

 

7,开始配置zabbix数据库

编辑数据库配置文件,一般默认在/etc/zabbix/目录下:

 

# vim /etc/zabbix/zabbix_server.conf                                                                                                                                                                                        

 

DBHost=192.168.121.61

 

DBName=zabbix

 

DBUser=zabbix

 

DBPassword=zabbix0418

 

DBPort=3307

 

DBSocket=/usr/local/mysql/mysql.sock

 

 

8,启动zabbix

# 启动:

 

/usr/local/zabbix/sbin/zabbix_server -c  /etc/zabbix/zabbix_server.conf

 

查看后台进程:

 

[root@hch_test_121_12 zabbix-3.0.2]# ps  -eaf|grep zabbix_server

 

zabbix    28130     1  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf

 

zabbix    28131 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: configuration syncer [waiting 60 sec  for processes]

 

zabbix    28132 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: db watchdog [synced alerts config in  0.003818 sec, idle 60 sec]

 

zabbix    28133 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: poller #1 [got 0 values in 0.000006  sec, idle 5 sec]

 

zabbix    28134 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: poller #2 [got 0 values in 0.000005  sec, idle 5 sec]

 

zabbix    28135 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: poller #3 [got 0 values in 0.000005  sec, idle 5 sec]

 

zabbix    28136 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: poller #4 [got 0 values in 0.000005  sec, idle 5 sec]

 

zabbix    28137 28130  0 17:46 ?        00:00:00 /usr/local/zabbix/sbin/zabbix_server:  poller #5 [got 0 values in 0.000006 sec, idle 5 sec]

 

zabbix    28138 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: unreachable poller #1 [got 0 values in  0.000006 sec, idle 5 sec]

 

zabbix    28139 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: trapper #1 [processed data in 0.000000  sec, waiting for connection]

 

zabbix    28140 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: trapper #2 [processed data in 0.000000  sec, waiting for connection]

 

zabbix    28141 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: trapper #3 [processed data in 0.000000  sec, waiting for connection]

 

zabbix    28142 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: trapper #4 [processed data in 0.000000  sec, waiting for connection]

 

zabbix    28144 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: trapper #5 [processed data in 0.000000  sec, waiting for connection]

 

zabbix    28145 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: icmp pinger #1 [got 0 values in  0.000007 sec, idle 5 sec]

 

zabbix    28147 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: alerter [sent alerts: 0 success, 0 fail  in 0.001611 sec, idle 30 sec]

 

zabbix    28148 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: housekeeper [startup idle for 30  minutes]

 

zabbix    28149 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: timer #1 [processed 0 triggers, 0  events in 0.000000 sec, 0 maintenances in 0.000000 sec, idle 9 sec]

 

zabbix    28150 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: http poller #1 [got 0 values in  0.001078 sec, idle 5 sec]

 

zabbix    28151 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: discoverer #1 [processed 0 rules in  0.000791 sec, idle 60 sec]

 

zabbix    28153 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: history syncer #1 [synced 0 items in  0.000001 sec, idle 1 sec]

 

zabbix    28154 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: history syncer #2 [synced 0 items in  0.000001 sec, idle 1 sec]

 

zabbix    28155 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: history syncer #3 [synced 0 items in  0.000001 sec, idle 1 sec]

 

zabbix    28157 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: history syncer #4 [synced 0 items in  0.000001 sec, idle 1 sec]

 

zabbix    28159 28130  0 17:46 ?        00:00:00 /usr/local/zabbix/sbin/zabbix_server:  escalator #1 [processed 0 escalations in 0.000517 sec, idle 3 sec]

 

zabbix    28160 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: proxy poller #1 [exchanged data with 0  proxies in 0.000004 sec, idle 5 sec]

 

zabbix    28162 28130  0 17:46 ?        00:00:00  /usr/local/zabbix/sbin/zabbix_server: self-monitoring [processed data in  0.000005 sec, idle 1 sec]

 

root      28178 18398  0 17:46 pts/2    00:00:00 grep zabbix_server

 

[root@hch_test_121_12 zabbix-3.0.2]#

 

 

9,Zabbix管理网站配置

先找zabbix的管理网站应用,默认是在源码解压缩下面的frontends/php/目录,然后copy到/usr/local/nginx/html/zabbix:

# 如果不记得源码安装目录,可以通过find / -name frontends全盘检索找到                                                                                                                                                                     

 

unalias cp

 

cp   -r -f /soft/zabbix-3.0.2/frontends/php/* /usr/local/nginx/html/zabbix/

 

单独为zabbix配置php.ini:

# vim /usr/local/php/etc/php.ini                                                                                                                                                                                                                                                  

 

max_execution_time = 300

 

memory_limit = 128M

 

post_max_size = 16M

 

upload_max_filesize = 2M

 

max_input_time = 300

 

date.timezone = PRC

 

 

然后打开网址,http://ys.zabbix.com,出现如下界面D:\study\zabbix\3.png

 

 

 

 

10,Zabbix管理界面打开失败

zabbix编译报错信息:

checking for main in -lnetsnmp... yes

 

checking for localname in struct  snmp_session... yes                                                                                                                                                                                                                 

 

checking for gawk... (cached) gawk

 

checking for curl-config... no

 

configure: error: Curl library not found

 

 

 

# 需要安装curl组件,而且需要在7.20版本以上:

 

yum install -y libcurl*

 

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow
这里写图片描述
我们对Markdown编辑器进行了一些功能拓展与语法支持,除了标准的Markdown编辑器功能,我们增加了如下几点新功能,帮助你用它写博客:
  1. 全新的界面设计 ,将会带来全新的写作体验;
  2. 在创作中心设置你喜爱的代码高亮样式,Markdown 将代码片显示选择的高亮样式 进行展示;
  3. 增加了 图片拖拽 功能,你可以将本地的图片直接拖拽到编辑区域直接展示;
  4. 全新的 KaTeX数学公式 语法;
  5. 增加了支持甘特图的mermaid语法1 功能;
  6. 增加了 多屏幕编辑 Markdown文章功能;
  7. 增加了 焦点写作模式、预览模式、简洁写作模式、左右区域同步滚轮设置 等功能,功能按钮位于编辑区域与预览区域中间;
  8. 增加了 检查列表 功能。

功能快捷键

撤销:Ctrl/Command + Z
重做:Ctrl/Command + Y
加粗:Ctrl/Command + B
斜体:Ctrl/Command + I
标题:Ctrl/Command + Shift + H
无序列表:Ctrl/Command + Shift + U
有序列表:Ctrl/Command + Shift + O
检查列表:Ctrl/Command + Shift + C
插入代码:Ctrl/Command + Shift + K
插入链接:Ctrl/Command + Shift + L
插入图片:Ctrl/Command + Shift + G

合理的创建标题,有助于目录的生成

直接输入1次#,并按下space后,将生成1级标题。
输入2次#,并按下space后,将生成2级标题。
以此类推,我们支持6级标题。有助于使用TOC语法后生成一个完美的目录。

如何改变文本的样式

强调文本 强调文本

加粗文本 加粗文本

标记文本

删除文本

引用文本

H2O is是液体。

210 运算结果是 1024.

插入链接与图片

链接: link.

图片: Alt

带尺寸的图片: Alt

当然,我们为了让用户更加便捷,我们增加了图片拖拽功能。

如何插入一段漂亮的代码片

博客设置页面,选择一款你喜欢的代码片高亮样式,下面展示同样高亮的 代码片.

// An highlighted block var foo = 'bar'; 

生成一个适合你的列表

  • 项目
    • 项目
      • 项目
  1. 项目1
  2. 项目2
  3. 项目3
  • 计划任务
  • 完成任务

创建一个表格

一个简单的表格是这么创建的:

项目Value
电脑$1600
手机$12
导管$1

设定内容居中、居左、居右

使用:---------:居中
使用:----------居左
使用----------:居右

第一列第二列第三列
第一列文本居中第二列文本居右第三列文本居左

SmartyPants

SmartyPants将ASCII标点字符转换为“智能”印刷标点HTML实体。例如:

TYPEASCIIHTML
Single backticks'Isn't this fun?'‘Isn’t this fun?’
Quotes"Isn't this fun?"“Isn’t this fun?”
Dashes-- is en-dash, --- is em-dash– is en-dash, — is em-dash

创建一个自定义列表

Markdown
Text-to- HTML conversion tool
Authors
John
Luke

如何创建一个注脚

一个具有注脚的文本。2

注释也是必不可少的

Markdown将文本转换为 HTML

KaTeX数学公式

您可以使用渲染LaTeX数学表达式 KaTeX:

Gamma公式展示 Γ ( n ) = ( n − 1 ) ! ∀ n ∈ N \Gamma(n) = (n-1)!\quad\forall n\in\mathbb N Γ(n)=(n1)!nN 是通过欧拉积分

Γ ( z ) = ∫ 0 ∞ t z − 1 e − t d t &ThinSpace; . \Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt\,. Γ(z)=0tz1etdt.

你可以找到更多关于的信息 LaTeX 数学表达式here.

新的甘特图功能,丰富你的文章

gantt
        dateFormat  YYYY-MM-DD
        title Adding GANTT diagram functionality to mermaid
        section 现有任务
        已完成               :done,    des1, 2014-01-06,2014-01-08
        进行中               :active,  des2, 2014-01-09, 3d
        计划一               :         des3, after des2, 5d
        计划二               :         des4, after des3, 5d
  • 关于 甘特图 语法,参考 这儿,

UML 图表

可以使用UML图表进行渲染。 Mermaid. 例如下面产生的一个序列图::

张三 李四 王五 你好!李四, 最近怎么样? 你最近怎么样,王五? 我很好,谢谢! 我很好,谢谢! 李四想了很长时间, 文字太长了 不适合放在一行. 打量着王五... 很好... 王五, 你怎么样? 张三 李四 王五

这将产生一个流程图。:

链接
长方形
圆角长方形
菱形
  • 关于 Mermaid 语法,参考 这儿,

FLowchart流程图

我们依旧会支持flowchart的流程图:

  • 关于 Flowchart流程图 语法,参考 这儿.

导出与导入

导出

如果你想尝试使用此编辑器, 你可以在此篇文章任意编辑。当你完成了一篇文章的写作, 在上方工具栏找到 文章导出 ,生成一个.md文件或者.html文件进行本地保存。

导入

如果你想加载一篇你写过的.md文件或者.html文件,在上方工具栏可以选择导入功能进行对应扩展名的文件导入,
继续你的创作。


  1. mermaid语法说明 ↩︎

  2. 注脚的解释 ↩︎

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值