前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【沙恩说】ZABBIX全栈级监控实践(八)Zabbix的源码编译安装

【沙恩说】ZABBIX全栈级监控实践(八)Zabbix的源码编译安装

作者头像
Zabbix
发布2021-02-03 11:08:53
7270
发布2021-02-03 11:08:53
举报
文章被收录于专栏:Zabbix中国官方

ZABBIX全栈级监控实践

八)Zabbix的源码编译安装

《ZABBIX全栈级监控实践》系列将由浅入深探讨如何实现ZABBIX全栈级别的监控。

本文是《ZABBIX全栈级监控实践》的第八篇:主要讨论如何通过源文件对Zabbix进行源码编译安装。

作者介绍:蔡翔华(Shawn沙恩),高效运维社区金牌讲师,国内首批ZCP,Zabbix中文手册及EXIN DevOps手册官方译者。积极投入Zabbix社区建设,在多个技术大会上进行技术分享,有丰富的Zabbix开源监控平台的全栈式监控经验。拥有DevOps Master,Zabbix认证专家,ITIL,MCSE,RHCE,VCP等认证。

01

概述

Zabbix提供了多种安装方式,上一篇中,我们使用了Zabbix Appliance对Zabbix进行了快速上手尝试。Zabbix Appliance适合想一窥Zabbix的大致功能,对Zabbix有初步学习、了解的实验环境下使用。所有的配置(从数据库、到前端web)都进行了预配置(preconfigured),从而实现了即插即用的特性。最新的Appliance给予Ubuntu Linux和MySQL数据库实现,适合用于评估。

但Appliance不适合用于生产环境。对于生产环境,建议通过源码编译来安装Zabbix。源码编译包可在https://www.zabbix.com/download_sources中找到。

本文讨论源码编译的安装方式及编译过程中所需要注意的事项。

02

Zabbix源码编译安装

Zabbix源码编译安装的详细步骤,在这里不赘述,可参考

https://www.zabbix.com/documentation/3.4/manual/installation/install。

基本的思路是:

配置源代码

如:

./configure --enable-server --enable-agent--with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

这意味着将在当前的Host上安装Zabbix Server和Zabbix Agent,同时以mysql为后端数据库,启用ipv6,并启用net-snmp、curl和xml2库。

make install

配置完后,通过make install命令完成Zabbix相应组件(Agent、Server、Proxy等)和特性的安装。

03

遇到的问题

写到这里,似乎一切都很顺利,但会碰到一些问题。

在部署过程中,一方面由于监控需求的不断提升,可能原先只需要监控操作系统,但都后期需要通过JMX监控JAVA,通过IPMI监控带外设备。如果在编译的配置过程中没有指定对应的参数,则无法启用相应功能,需要重新进行配置并编译安装。

由于官方没有罗列configure有哪些配置参数,在此进行一个简单罗列。

1)安装目录调优

Fine tuning ofthe installation directories:

--bindir=DIR user executables [EPREFIX/bin]

--sbindir=DIR system admin executables[EPREFIX/sbin]

--libexecdir=DIR program executables [EPREFIX/libexec]

--sysconfdir=DIR read-only single-machine data[PREFIX/etc]

--sharedstatedir=DIR modifiable architecture-independent data[PREFIX/com]

--localstatedir=DIR modifiable single-machine data[PREFIX/var]

--runstatedir=DIR modifiable per-process data[LOCALSTATEDIR/run]

--libdir=DIR object code libraries [EPREFIX/lib]

--includedir=DIR C header files [PREFIX/include]

--oldincludedir=DIR C header files for non-gcc [/usr/include]

--datarootdir=DIR read-only arch.-independent data root[PREFIX/share]

--datadir=DIR read-only architecture-independentdata [DATAROOTDIR]

--infodir=DIR info documentation[DATAROOTDIR/info]

--localedir=DIR locale-dependent data [DATAROOTDIR/locale]

--mandir=DIR man documentation [DATAROOTDIR/man]

--docdir=DIR documentation root[DATAROOTDIR/doc/zabbix]

--htmldir=DIR html documentation [DOCDIR]

--dvidir=DIR dvi documentation [DOCDIR]

--pdfdir=DIR pdf documentation [DOCDIR]

--psdir=DIR ps documentation [DOCDIR]

2)常用的特性

OptionalFeatures:

--disable-option-checking ignore unrecognized --enable/--with options

--disable-FEATURE do not include FEATURE (same as--enable-FEATURE=no)

--enable-FEATURE[=ARG] include FEATURE [ARG=yes]

--enable-silent-rules less verbose build output (undo: "makeV=1")

--disable-silent-rules verbose build output (undo: "makeV=0")

--enable-dependency-tracking

do not reject slowdependency extractors

--disable-dependency-tracking

speeds up one-timebuild

--disable-largefile omit support for large files

--enable-static Build statically linked binaries

--enable-server Turn on build of Zabbix server

--enable-proxy Turn on build of Zabbix proxy

--enable-agent Turn on build of Zabbix agent andclient utilities

--enable-java Turn on build of Zabbix Java gateway

--enable-ipv6 Turn on support of IPv6

3) 常用的包

OptionalPackages:

--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]

--without-PACKAGE do not use PACKAGE (same as--with-PACKAGE=no)

--with-ibm-db2[=ARG] use IBM DB2 CLI from given sqllib directory

(ARG=path); use/home/db2inst1/sqllib (ARG=yes);

disable IBM DB2support (ARG=no)

--with-ibm-db2-include[=DIR]

use IBM DB2 CLI headers from given path

--with-ibm-db2-lib[=DIR]

use IBM DB2 CLIlibraries from given path

--with-mysql[=ARG] use MySQL client library [default=no],optionally

specify path tomysql_config

--with-oracle[=ARG] use Oracle OCI API from given Oracle home

(ARG=path); useexisting ORACLE_HOME (ARG=yes);

disable Oracle OCIsupport (ARG=no)

--with-oracle-include[=DIR]

use Oracle OCI API headersfrom given path

--with-oracle-lib[=DIR] use Oracle OCI APIlibraries from given path

--with-postgresql[=ARG] use PostgreSQLlibrary [default=no], optionally

specify path topg_config

--with-sqlite3[=ARG] use SQLite 3 library [default=no],optionally

specify the prefixfor sqlite3 library

4)其他功能

If you want touse Jabber protocol for messaging:

--with-jabber[=DIR] Include Jabber support [default=no]. DIRis the

iksemel libraryinstall directory.

If you want touse XML library:

--with-libxml2[=ARG] use libxml2 client library [default=no],optionally

specify path toxml2-config

If you want touse unixODBC library:

--with-unixodbc[=ARG] use ODBC driver against unixODBC package

[default=no],optionally specify full path to

odbc_config binary.

If you want touse Net-SNMP library:

--with-net-snmp[=ARG] use Net-SNMP package [default=no],optionally

specify path to net-snmp-config

If you want touse SSH2 based checks:

--with-ssh2[=DIR] use SSH2 package [default=no], DIR isthe SSH2

library installdirectory.

If you want tocheck IPMI devices:

--with-openipmi[=DIR] Include OPENIPMI support [default=no]. DIRis the

OPENIPMI base installdirectory, default is to

search through anumber of common places for the

OPENIPMI files.

If you want tospecify zlib installation directories:

--with-zlib=DIR use zlib from given base installdirectory (DIR),

default is to searchthrough a number of common

places for the zlibfiles.

--with-zlib-include=DIR use zlib includeheaders from given path.

--with-zlib-lib=DIR use zlib libraries from given path.

If you want tospecify pthread installation directories:

--with-libpthread[=DIR] use libpthread fromgiven base install directory

(DIR), default is tosearch through a number of

common places for thelibpthread files.

--with-libpthread-include[=DIR]

use libpthread include headersfrom given path.

--with-libpthread-lib[=DIR]

use libpthreadlibraries from given path.

If you want tospecify libevent installation directories:

--with-libevent[=DIR] use libevent from given base installdirectory

(DIR), default is tosearch through a number of

common places for thelibevent files.

--with-libevent-include[=DIR]

use libevent includeheaders from given path.

--with-libevent-lib[=DIR]

use libeventlibraries from given path.

If you want touse encryption provided by mbed TLS (PolarSSL) library:

--with-mbedtls[=DIR] use mbed TLS (PolarSSL) package [default=no],DIR is

the libpolarsslinstall directory.

If you want touse encryption provided by GnuTLS library:

--with-gnutls[=DIR] use GnuTLS package [default=no], DIR isthe

libgnutls installdirectory.

If you want touse encryption provided by OpenSSL library:

--with-openssl[=DIR] use OpenSSL package [default=no], DIR isthe libssl

and libcrypto installdirectory.

If you want tocheck LDAP servers:

--with-ldap[=DIR] Include LDAP support [default=no]. DIRis the LDAP

base installdirectory, default is to search through

a number of commonplaces for the LDAP files.

If you want touse cURL library:

--with-libcurl[=DIR] use cURL package [default=no], optionallyspecify

path to curl-config

If you want tospecify libpcre installation directories:

--with-libpcre[=DIR] use libpcre from given base installdirectory (DIR),

default is to searchthrough a number of common

places for thelibpcre files.

--with-libpcre-include[=DIR]

use libpcre includeheaders from given path.

--with-libpcre-lib[=DIR]

use libpcre librariesfrom given path.

If you want tospecify iconv installation directories:

--with-iconv[=DIR] use iconv from given base installdirectory (DIR),

default is to search througha number of common

places for the iconvfiles.

--with-iconv-include[=DIR]

use iconv includeheaders from given path.

--with-iconv-lib[=DIR] use iconv libraries from given path.

04

常用的编译参数

Configure可以配置的参数有100多个,以下整理出常用的参数,供参考:

1. 启用Server/Proxy/Agent或者JMX支持

构建Zabbix Server--enable-server

构建ZabbixProxy --enable-proxy

构建ZabbixAgent --enable-agent

构建Zabbix Javagateway --enable-java

支持ipv6 --enable-ipv6

2. 不同的数据库类型支持

支持DB2

--with-ibm-db2[=ARG]

--with-ibm-db2-include[=DIR]

--with-ibm-db2-lib[=DIR]

支持mysql

--with-mysql[=ARG]

支持Oracle

--with-oracle[=ARG]

--with-oracle-include[=DIR]

--with-oracle-lib[=DIR]

支持Postgresql

--with-postgresql[=ARG]

支持SQLite3

--with-sqlite3[=ARG]

3.高级特性支持

支持UnixODBC

--with-unixodbc[=ARG]

支持snmp

--with-net-snmp[=ARG]

支持SSH2

--with-ssh2[=DIR]

支持IPMI

--with-openipmi[=DIR]

支持LDAP

--with-ldap[=DIR]

05

总结

总的来说,通过上述的这些编译参数可以看到,Zabbix是一个模块化的监控平台。它支持且集成了各种开发协议(IPMI, JMX, SNMP等)和平台(MySQL, DB2, SQLite3等)。在Zabbix不断的迭代和升级的过程中,将会集成越来越多的主流方案(如ELK,InfluxDB等)。希望这篇文章,对大家在编译安装的过程,能有一定的启发。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2019-03-01,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Zabbix开源社区 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 MySQL
腾讯云数据库 MySQL(TencentDB for MySQL)为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。其具备6大企业级特性,包括企业级定制内核、企业级高可用、企业级高可靠、企业级安全、企业级扩展以及企业级智能运维。通过使用腾讯云数据库 MySQL,可实现分钟级别的数据库部署、弹性扩展以及全自动化的运维管理,不仅经济实惠,而且稳定可靠,易于运维。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档