ZabbixManual1.4/Installation/zh

来自Ubuntu中文
Firehare留言 | 贡献2007年9月11日 (二) 13:00的版本 →‎软件要求
跳到导航跳到搜索

{{#ifexist: :ZabbixManual1.4/Installation/zh/zh | | {{#ifexist: ZabbixManual1.4/Installation/zh/zh | | {{#ifeq: {{#titleparts:ZabbixManual1.4/Installation/zh|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:ZabbixManual1.4/Installation/zh|1|-1|}} | zh | | }}


如何获取 ZABBIX

在 Zabbix 主页 http://www.zabbix.com 上找到当版版本及其下载说明。

要求

硬件要求

存储要求

ZABBIX 对物理内存和硬盘存储容量都有要求,128 MB 的物理内存和至少 256 MB 空闲的硬盘空间是将一个好的开始点。不过,其所需磁盘空间的大小显然有赖于主机及其所需监控参数的数量。如果您想保留监控参数一个较长的历史记录,那么您应该考虑至少 2 到 3 G 的空间用以保存数据库中的历史记录。

Each ZABBIX daemon process requires several connections to a database server. Amount of memory allocated for the connection depends on configuration of the database engine. 每个 Zabbix 守护程序进程都需要几条到数据库服务器的连接。分配给连接的内存总量也有赖于数据库引擎的配置。


注意: 您的物理内存越多,那么您数据库(因此 Zabbix)运行的也就越快!


CPU 要求

ZABBIX,特别是 ZABBIX 数据库可能要求大量的 CPU 资源,这有赖于监控参数的数量以及所选数据库的引擎。

其他硬件

为使用Zabbix 内建的 SMS 通知,要求使用一个串行通信口和一个串行 GSM 调制器。

硬件配置的范例

下表提供了一些硬件配置:

Name 操作系统 CPU/内存 数据库 被监测主机数
小型 Ubuntu Linux P2 350MHz/256MB MySQL MyISAM 20
中型 Ubuntu Linux 64 bit AMD Athlon 3200+/2GB MySQL MyISAM 500
大型 Ubuntu Linux 64 bit Intel Dual Core 6400/4GB/RAID MySQL MyISAM or PostgreSQL >1000
Very large RedHat Enterprise Intel Xeon 2 CPU/8GB/RAID MySQL MyISAM or PostgreSQL >10000

注意: 实际配置特别有赖于激活监测项的数目以及刷新率。It is recommended to keep database engine on a separate box for large installations.


支持的操作系统

出于监测服务器的安全需求和对关键任务的判断,Unix 是唯一能够持续提供必要的性能、容错能力以及恢复能力的操作系统。ZABBIX 支持目前市场上的主流版本。

ZABBIX 在以下操作系统中测试过:

  • AIX
  • FreeBSD
  • HP-UX
  • Linux
  • Mac OS/X
  • OpenBSD
  • SCO Open Server
  • Solaris

注意: ZABBIX 也可能在其它的类 Unix 操作系统中良好运行。


软件需求

ZABBIX 是基于最新的 Apache Web 服务器、主流的数据库引擎以及 PHP 脚本语言编译的。

运行 ZABBIX 需要下列软件:

软件 版本 说明
Apache 1.3.12 或以后版本
PHP 4.3 或以后版本
PHP 模块:

php-gd php-bcmath

4.3 或以后版本 PHP GD 模块必须支持 PNG 图片
MySQL

php-mysql

3.22 或以后版本 使用 MySQL 作为 ZABBIX 后台数据库时被要求
Oracle

php-sqlora8

9.2.0.4 或以后版本 使用 Oracle 作为 ZABBIX 后台数据库时被要求
PostgreSQL

php-pgsql

7.0.2 或以后版本 使用 PostgreSQL 作为 ZABBIX 后台数据库时被要求。使用 PostgreSQL 8.x 或以后版本以获取更好的性能。
SQLite

php-sqlite3

3.3.5 或以后版本 使用 SQLite 作为 ZABBIX 后台数据库时被要求

注意: ZABBIX 在使用 Apache、MySQL、Oracle 或 PostgreSQL 的以前版本也可能正常运行。


客户端 WEB 浏览器

要求支持 HTML 和 PNG 图片。MS Explorer(5.xx 和 6.xx)以及 Mozilla 1.x 上运行正常。必须支持 Cookies 和 JavaScript。其它浏览器也能支持 Zabbix

数据库引擎的选择

ZABBIX 支持四种数据库引擎:

  • MySQL
  • Oracle
  • PostgreSQL
  • SQLite

每种数据库引擎都有它自己的优势,我们不好说哪一种最好。

选择数据库引擎主要看以下几个方面:

  • 您硬件的性能
  • 自由或商业的数据库引擎
  • ZABBIX 服务器的繁忙程度

下表为选择数据库引擎提供一般性的建议

ZABBIX 服务器的用途 选择的数据库引擎
重负载节点/单机 MySQL MyISAM
轻负载节点/单机 PostgreSQL

MySQL MyISAM

远程零管理节点 PostgreSQL

SQLite

单独轻负载 MySQL MyISAM

时间同步

对于运行 Zabbix 的服务器来说拥有精确的系统时间是十分重要的。Timed 是最通用的守护进程之一,以同步主机与其他机器的时间。

组件

ZABBIX 组件

Zabbix 包含了几个重要的组件,其功能大致说明如下:

ZABBIX 服务器

这是 Zabbix 软件的核心部分。服务器可以使用简单的服务检查来远程检查网络服务(如 Web 服务和 mail 服务),但它也是核心组件以便代理报告可用性以及完整的信息和状态。服务器是存放所有配置、状态和操作数据的中心库,同时它也是 Zabbix 软件中的实体,在被监测系统产生问题时主动向管理员报警。

Zabbix 可以执行无代理监测,同时也可以监测使用 SNMP 代理的网络设备。

ZABBIX 代理

为了主动监测网络系统上的本地资源和应用程序(如硬件、内存、处理器状态等),那些系统必须运行 Zabbix 代理。代理将从所运行的系统上收集可操作信息,并将这些数据报告给 Zabbix,以便做进一步处理。万一出现失败(如硬盘满或服务进程崩溃),Zabbix 服务器能主动向特定机器的管理员报告失败。

Zabbix 代理使用本地系统调用来收集统计信息,所以其效率是十分高的。

Web 界面

为了能够方便地访问监测数据,同时可以从任何地方和任何平台来配置 Zabbix,Zabbix 提供了基于 Web 的界面。该界面是 Zabbix 服务器的一部分,并且通常(但不必需)运行在与 Zabbix 服务器相同的物理机器上。


注意: 使用 SQLite 时,Zabbix 前端必须运行在相同的物理机器上。


从源安装

软件要求

从源代码编译 Zabbix 服务器或代理需要其它软件。

编译 ZABBIX 需要以下软件: 下列数据库引擎之一:

  MySQL 头文件和库文件
  要求 3.22 或以后版本
  Oracle 头文件和库文件
  要求 Sqlora8 头文件或库文件
  PostgreSQL 头文件和库文件
  要求 7.0.2 或以后版本。 考虑使用 PostgreSQL 8.x 以获得更好的性能。
  SQLite 头文件和库文件
  要求 3.3.5 或以后版本

注意: 通常做为 mysql-dev、postgresql-dev或sqlite3-dev 包的一部分。


NET-SNMP (或 UCD-SNMP) 头文件和库文件

要求支持 SNMP,可选

Iksemel 头文件和库文件

要求支持 Jabber 消息,可选

Libcurl 头文件和库文件

Web 监测模块需要,可选

C 编译器

要求 C 编译器。 GNU C 编译器是开放平台的最好选择。其他(HP、IBM)的 C 编译器也许一样好用。

GNU Make

要求 GNU make 以便处理 Zabbix Make 文件

Structure of ZABBIX distribution

doc

The directory contains this Manual in different formats

src

The directory contains sources for all ZABBIX processes except frontends.

src/zabbix_server

The directory contains Makefile and sources for zabbix_server.

src/zabbix_agent

The directory contains Makefile and sources for zabbix_agent and zabbix_agentd.

src/zabbix_sender

The directory contains Makefile and sources for zabbix_sender.

include

The directory contains include ZABBIX files.

misc

misc/init.d

The directory contains start-up scripts for different platforms.

misc/pinger

  1. The directory contains scripts for ICMP pinging, pinger.pl.

frontends

frontends/php

The directory contains sources for PHP frontend.

create

The directory contains SQL script for initial database creation.

create/mysql

MySQL database schema.

create/postgresql

PostgreSQL database schema.

create/data

Data for initial database creation.

upgrades

The directory contains upgrade procedures for different versions of ZABBIX.

ZABBIX Server

Server side

Step 1 Create the ZABBIX superuser account

This is the user the server will run as. For production use you should create a dedicated unprivileged account ('zabbix' is commonly used). Running ZABBIX as 'root','bin', or any other account with special rights is a security risk. Do not do it!


Note: ZABBIX server process (zabbix_server) is protected from being run under root account.


Step 2 Untar ZABBIX sources

shell> gunzip zabbix.tar.gz && tar -xvf zabbix.tar


Step 3 Create the ZABBIX database

ZABBIX comes with SQL scripts used to create the required database schema and also to insert a default configuration. There are separate scripts for MySQL and PostgreSQL.

For MySQL:

shell> mysql -u<username> -p<password>
mysql> create database zabbix;
mysql> quit;
shell> cd create/mysql
shell> cat schema.sql |mysql -u<username> -p<password> zabbix
shell> cd ../data
shell> cat data.sql |mysql -u<username> -p<password> zabbix
shell> cat images_mysql.sql |mysql -u<username> -p<password> zabbix

For PostgreSQL:

shell> psql -U <username>
psql> create database zabbix;
psql> \q
shell> cd create/postgresql
shell> cat schema.sql|psql -U <username> zabbix
shell> cd ../data
shell> cat data.sql|psql -U <username> zabbix
shell> cat images_pgsql.sql |psql -U <username> zabbix

For SQLite:

shell> cd create/sqlite
shell> cat schema.sql | sqlite3 /var/lib/sqlite/zabbix.db
shell> cd ../data
shell> cat data.sql | sqlite3 /var/lib/sqlite/zabbix.db
shell> cat images.sql | sqlite3 /var/lib/sqlite/zabbix.db

Note: The database will be automatically created if not exists.


Step 4 Configure and compile the source code for your system

The sources must be compiled for both the server (monitoring machine) as well as the clients (monitored machines). To configure the source for the server, you must specify which database will be used.

shell> ./configure --enable-server --with-mysql --with-net-snmp –with-jabber –with-libcurl # for MySQL + Jabber + WEB monitoring

or

shell> ./configure --enable-server --with-pgsql --with-net-snmp –with-jabber –with-libcurl # for PostgreSQL + Jabber + WEB monitoring

or

shell> ./configure --enable-server --with-oracle=/home/zabbix/sqlora8 --with-net-snmp –with-jabber –with-libcurl # for Oracle + Jabber + WEB monitoring


Note: Use flag --with-oracle to specify location of sqlora8 library. The libary is required for Oracle support. The library can be found at libsqlora8 homepage



Note: Use flag --enable-static to statically link libraries. If you plan to distribute compiled binaries among different servers, you must use this flag to make these binaries work without required libraries. --enable-static does not work under Solaris. Flag --with-ucd-snmp can be used instead of --with-net-snmp. If no SNMP support required, both --with-net-snmp and --with-ucd-snmp may be skipped.


However, if you want to compile client binaries along with server binaries, run:

shell> ./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-jabber –with-libcurl

Parameter —enable-static may be used to force static linkage.

Step 5 Make and install everything

shell> make install

By default,

make install

will install all the files in /usr/local/bin, /usr/local/lib etc. You can specify an installation prefix other than /usr/local using --prefix

Step 6 Configure /etc/services

The step is not real requirement. However, it is recommended. On the client (monitored) machines, add the following lines to /etc/services:

zabbix_agent 10050/tcp
zabbix_trap 10051/tcp

Step 7 Configure /etc/inetd.conf

If you plan to use zabbix_agent instead of the recommended zabbix_agentd, the following line must be added:

zabbix_agent stream tcp nowait.3600 zabbix /opt/zabbix/bin/zabbix_agent

Restart inetd

shell> killall -HUP inetd

Modify default settings in configuration files

Step 8 Configure /etc/zabbix/zabbix_agent.conf

You need to configure this file for every host having zabbix_agent installed. The file should contain IP address of ZABBIX server. Connections from other hosts will be denied. You may take misc/conf/zabbix_agent.conf as example.

Step 9 Configure /etc/zabbix/zabbix_agentd.conf

You need to configure this file for every host with zabbix_agentd installed. The file should contain the IP address of the ZABBIX server. Connectionsfrom other hosts will be denied. You may take misc/conf/zabbix_agentd.conf as example.

Step 10 Configure /etc/zabbix/zabbix_server.conf

For small installations (up to ten monitored hosts), default parameters are sufficient. However, you should change default parameters to maximize performance from ZABBIX. See section [Performance tuning] for more details.

You may take misc/conf/zabbix_server.conf as example.

Step 11 Run server processes

Run zabbix_server on server side.

shell> cd bin
shell> ./zabbix_server

Step 12 Run agents

Run zabbix_agentd where necessary.

shell> cd bin
shell> ./zabbix_agentd

ZABBIX Agent

Client side

Step 1 Create the ZABBIX account

This is the user the agent will run as. For production use you should create a dedicated unprivileged account (“zabbix” is commonly used). ZABBIX agents have protection against running under root account.

Step 2 Untar ZABBIX sources

shell> gunzip zabbix.tar.gz && tar xvf zabbix.tar

Step 3 Configure and compile the source code for your system

The sources must be compiled for the client only. To configure the source for the client:

shell> ./configure --enable-agent

Note: Use flag --enable-static to statically link libraries. If you plan to distribute compiled binaries among different servers, you must use this flag to make these binaries work without required libraries.

Step 4 Build agent

shell> make

Copy created binaries from bin/ to /opt/zabbix/bin or any other directory Other common directories are /usr/local/bin or /usr/local/zabbix/bin.

Step 5 Configure /etc/services

The step is not real requirement. However, it is recommended. On the client (monitored) machines, add the following lines to /etc/services:

zabbix_agent 10050/tcp
zabbix_trap 10051/tcp

Step 6 Configure /etc/inetd.conf

If you plan to use zabbix_agent instead of the recommended zabbix_agentd, the following line must be added:

zabbix_agent stream tcp nowait.3600 zabbix /opt/zabbix/bin/zabbix_agent

Restart inetd

shell> killall -HUP inetd

Step 7 Configure /etc/zabbix/zabbix_agent.conf

You need to configure this file for every host having zabbix_agent installed. The file should contain IP address of ZABBIX server. Connections from other hosts will be denied. Note, that no end of line character should present in the file.

You may take misc/conf/zabbix_agent.conf as example.

Step 8 Configure /etc/zabbix/zabbix_agentd.conf

You need to configure this file for every host with zabbix_agentd installed. The file should contain IP address of ZABBIX server. Connections from other hosts will be denied. You may take misc/conf/zabbix_agentd.conf as example.

Step 9 Run zabbix_agentd on all monitored machines

shell> /opt/zabbix/bin/zabbix_agentd

Note: You should not run zabbix_agentd if you have chosen to use zabbix_agent!


ZABBIX WEB Interface

Step 1 Point your browser to ZABBIX URL.

Step 2 Read and accept GPL v2.

Step 3 Make sure that all software pre-requisites are met.

Step 4 Configure database settings. ZABBIX database must already be created.

Step 5 See summary of settings.

Step 6 Download configuration file and place it under conf/.

Step 7 Check if everything is fine.


Step 9 For distributed monitoring only!

If used in a distributed environment you have to run:

shell> ./zabbix_server –n <nodeid>

where Node ID is an unique Node identificator. For example:

shell> ./zabbix_server –n 1

This will convert database data for use with Node ID ‘1’ and also adds a local node.


Step 10 ZABBIX frontend is ready! Default username is ‘Admin’ with no password.