博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
zabbix服务器搭建
阅读量:5158 次
发布时间:2019-06-13

本文共 7515 字,大约阅读时间需要 25 分钟。

zabbix服务器源码安装

参看 这里不做过多的翻译,我的系统是centos6.5,安装的时候是base安装,所以要装一些其他依赖包,除此之外,还有一些php插件:

extension=bcmath.soextension=gd.soextension=gettext.soextension=mysqli.so

下面介绍一下二次编译php插件的方法:

[root@mediawiki bcmath]# which php-config/usr/local/php/bin/php-config[root@mediawiki bcmath]# /usr/local/php/bin/phpizeConfiguring for:PHP Api Version:         20100412Zend Module Api No:      20100525Zend Extension Api No:   220100525[root@mediawiki bcmath]# ./configure  --with-php-config=/usr/local/php/bin/php-config[root@mediawiki bcmath]# make[root@mediawiki bcmath]# make installInstalling shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/echo "extension=bcmath.so" >> /usr/local/php/php.ini

PHP gd FreeType support,从官网下载:http://jaist.dl.sourceforge.net/project/freetype/freetype2/2.5.5/freetype-2.5.5.tar.bz2

下面几个重要的插件支持

zabbixPHP gd JPEG supportPHP gd FreeType supportPHP gettextwget http://down1.chinaunix.net/distfiles/jpegsrc.v6b.tar.gz# tar -xf jpegsrc.v6b.tar.gz # ./configure --prefix=/usr/local/jpeg-6b# make# mkdir -p /usr/local/jpeg-6b/man/man1/# mkdir -p /usr/local/jpeg-6b/bin/# make install wget http://jaist.dl.sourceforge.net/project/freetype/freetype2/2.5.5/freetype-2.5.5.tar.bz2# ./configure --prefix=/usr/local/freetype# make# make install # ./configure --with-php-config=/usr/local/php/bin/php-config --with-jpeg-dir=/usr/local/jpeg-6b/ --with-freetype-dir=/usr/local/freetype/# make# make install mysql_connect(): No such file or directory [include/db.inc.php:77]Error connecting to database [No such file or directory]vim php.inimysqli.default_socket = /data/mysql/mysql.sock

 

我知道,到这里有些同学犯困惑了,找不到php.ini文件,学生还是提倡多看官方文档的介绍:http://php.net/manual/en/function.phpinfo.php

按照上面的介绍,写个php页面<?php echo phpinfo(); ?>,再从浏览器访问该页面就能看到

zabbix下载安装
1.下载zabbix
下载地址  http://www.zabbix.com/download.php,在此我使用zabbix-2.0.13.tar.gz
#wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.0.13/zabbix-2.0.13.tar.gz
    
2.安装zabbix所需的组件
#yum -y install curl curl-devel net-snmp net-snmp-devel perl-DBI php-gd php-xml php-bcmath 
 
3.数据库创建并导入数据
#tar zxf zabbix-2.0.13.tar.gz#cd zabbix-2.0.13#mysql -uroot -p>create database zabbix;>grant all on zabbix.* to zabbix@localhost identified by 'redhat';>flush privileges;# mysql -uzabbix -predhat zabbix < schema.sql# mysql -uzabbix -predhat zabbix < images.sql #mysql -uzabbix -predhat zabbix < data.sql

 //为zabbix创建自己的数据库,以便zabbix可以把收集到的数据信息存放在那里调用。

 
4.编译安装
#./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-proxy --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl
//--prefix指定zabbix安装目录,--enable-server 支持zabbix服务器
--enable-agent支持zabbix代理
--enable-proxy 支持zabbix代理服务器
--with-mysql 使用MySQL客户端库可以选择指定路径mysql_config
--with-net-snmp 使用net - snmp软件包,择性地指定路径NET - SNMP配置
 --with-libcurl 使用curl包
#make && make install
 
5. 编译安装完毕后,在/usr/local/zabbix下面有下面几个目录:
root@192.168.100.252:/usr/local# tree zabbix/ -L 2zabbix/├── bin│   ├── zabbix_get│   └── zabbix_sender├── etc│   ├── zabbix_agent.conf│   ├── zabbix_agent.conf.d│   ├── zabbix_agentd.conf  客户端配置文件│   ├── zabbix_agentd.conf.d  自定义监控文件存放目录│   ├── zabbix_proxy.conf  │   ├── zabbix_proxy.conf.d│   ├── zabbix_server.conf  服务器端配置文件│   └── zabbix_server.conf.d├── sbin│   ├── zabbix_agent│   ├── zabbix_agentd│   ├── zabbix_proxy│   └── zabbix_server├── scripts└── share    ├── man    └── zabbix11 directories, 10 files

服务器端配置文件:

root@192.168.100.252:/usr/local# egrep -v "(^#|^$)" zabbix/etc/zabbix_server.confLogFile=/tmp/zabbix_server.logDBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=redhatDBSocket=/data/mysql/mysql.sockDBPort=3306

启动服务端进程:

root@192.168.100.252:/usr/local# cd zabbix/sbin/root@192.168.100.252:/usr/local/zabbix/sbin# ./zabbix_server

 

 
5. 从编译生成的文件中取出客户端文件,传送到客户端机器,目录下文件如下:
root@192.168.100.246:/usr/local/zabbix# tree -L 2.├── bin│   ├── zabbix_get│   └── zabbix_sender├── etc│   ├── zabbix_agent.conf│   ├── zabbix_agent.conf.d│   ├── zabbix_agentd.conf│   └── zabbix_agentd.conf.d├── sbin│   ├── zabbix_agent│   └── zabbix_agentd└── scripts    └── monitor_mysql.sh6 directories, 7 files 
客户端配置文件:
root@192.168.100.246:/usr/local# egrep -v "(^#|^$)" zabbix/etc/zabbix_agentd.confLogFile=/tmp/zabbix_agentd.logServer=192.168.100.252Hostname=server 246Timeout=30Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/

启动客户端进程:

root@192.168.100.246:/usr/local# cd zabbix/sbin/root@192.168.100.246:/usr/local/zabbix/sbin# ./zabbix_agentd

 

6. 配置lighttpd启动zabbix前端web显示
6.1 编译安装lighttpd
1. Upload fcgi-2.4.0.tar.gz , unzip , then./configuremakemake install2. UpLoad pcre-8.11.tar.gz , unzip, then:./configuremakemake install3. UpLoad lighttpd-1.4.28.tar.gz, unzip, then:./configure --with-openssl --prefix=/usr/local/services/lighttpd    makemake install

6.2 配置lighttpd,启动进程

root@192.168.100.252:/usr/local/services/lighttpd/sbin# egrep -v "(^#|^$)" zabbix_httpd.conf server.max-fds = 10240server.max-connections = 4096server.max-keep-alive-requests = 0server.event-handler = "linux-sysepoll"server.network-backend = "linux-sendfile"server.modules = (  "mod_cgi",  "mod_fastcgi",  "mod_accesslog",  "mod_expire",  "mod_access",  "mod_compress",  "mod_rewrite")server.document-root = "/data/release/htdocs"server.port= 8001server.errorlog = "/data/release/lighttpd_logs/error.log"accesslog.filename = "/data/release/lighttpd_logs/access.log"server.core-files = "enable"index-file.names = ( "index.php", "index.html" )mimetype.assign = (  ".gz"           => "application/x-gzip",  ".swf"          => "application/x-shockwave-flash",  ".tar.gz"       => "application/x-tgz",  ".tgz"          => "application/x-tgz",  ".tar"          => "application/x-tar",  ".zip"          => "application/zip",  ".mp3"          => "audio/mpeg",  ".m3u"          => "audio/x-mpegurl",  ".wma"          => "audio/x-ms-wma",  ".wax"          => "audio/x-ms-wax",  ".wav"          => "audio/x-wav",  ".gif"          => "image/gif",  ".jpg"          => "image/jpeg",  ".jpeg"         => "image/jpeg",  ".png"          => "image/png",  ".css"          => "text/css",  ".html"         => "text/html",  ".htm"          => "text/html",  ".js"           => "text/javascript",  ".text"         => "text/plain",  ".txt"          => "text/plain",  ".dtd"          => "text/xml",  ".xml"          => "text/xml",  ".mpeg"         => "video/mpeg",  ".mpg"          => "video/mpeg",  ".avi"          => "video/x-msvideo",  ".wmv"          => "video/x-ms-wmv",  ".bz2"          => "application/x-bzip",  ".tbz"          => "application/x-bzip-compressed-tar",  ".tar.bz2"      => "application/x-bzip-compressed-tar")static-file.exclude-extensions = ( ".fcgi", ".php", ".cgi", ".pl" )cgi.assign = (".pl" => "/usr/bin/perl",".php" => "/usr/local/php/bin/php-cgi")fastcgi.server = ( ".php" =>                   ( "localhost" =>                     (                       "host" => "127.0.0.1",                       "port" => 1026,                       "bin-path" => "/usr/local/php/bin/php-cgi"                     )                   )                )url.rewrite-once = (                     "^/wiki/upload/(.+)" => "/wiki/upload/$1",                     "^/$" => "/w/index.php",                     "^/wiki/([^?]*)(?:\?(.*))?" => "/w/index.php?title=$1&$2"                   )expire.url = ("/images/" => "access 1 months","/scripts/" => "access 1 months","/img/" => "access 1 months","/js/" => "access 1 months","/css/" => "access 1 months")

 

6.3 启动lighttpd进程
# ./zabbix_lighttpd -f zabbix_httpd.conf 
 

转载于:https://www.cnblogs.com/forilen/p/4263610.html

你可能感兴趣的文章
Python基础
查看>>
开发中用到的工具
查看>>
linux支持的machine-types
查看>>
(原)使用intel的ipp库计算卷积及相关
查看>>
Activity的Task详解
查看>>
[搬运工系列]-JMeter(三)参数传递
查看>>
最长公共子序列(动态规划)
查看>>
android开发系列日志--(3)
查看>>
面试题
查看>>
[转] Java se 7新特性研究(二)
查看>>
修改电脑hosts文件
查看>>
#TS# get/set
查看>>
移动端开发模式
查看>>
红黑树原理、AVL树区别
查看>>
MySQL->索引的维护[20180504]
查看>>
第三章知识梳理
查看>>
在windows下安装dig工具
查看>>
django返回json格式的数据的方法
查看>>
Python使用struct处理二进制(pack和unpack用法)
查看>>
Enterprise Library6.0之缓存模块
查看>>