Linux系统——zabbix监控软件安装布署
zabbix安装需要LAMP或LNMP环境,并且对这些软件的版本也有一定的要求,并且PHP编译安装时需要一些指定 的模块,否则可能会安装不上,具体需求请参考官方文档
1、安装系统环境说明
代码语言:javascript复制[root@Centos ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@Centos ~]# uname -r
2.6.32-431.el6.x86_64
Apache版本
代码语言:javascript复制[root@Centos /]# ls -ld /application/apache
lrwxrwxrwx. 1 root root 25 Sep 12 03:44 /application/apache -> /application/apache2.4.23
MySQL版本
代码语言:javascript复制[root@Centos /]# ls -ld /application/mysql-5.1.73
drwxr-xr-x. 11 mysql mysql 4096 Sep 19 09:16 /application/mysql-5.1.73
PHP版本
代码语言:javascript复制[root@Centos ~]# /application/php/bin/php -v
PHP 5.3.27 (cli) (built: Nov 15 2016 13:03:18)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
安装一些必要的包软件
代码语言:javascript复制yum install net-snmp net-snmp-devel libcurl-devel -y
2、下载安装zabbix软件
创建用户
代码语言:javascript复制[root@Centos zabbix-2.4.8]# groupadd zabbix
[root@Centos zabbix-2.4.8]# useradd -g zabbix zabbix
下载软件
代码语言:javascript复制wget http://prdownloads.sourceforge.net/zabbix/zabbix-2.4.8.tar.gz
编译安装
代码语言:javascript复制./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-net-snmp --with-mysql=/application/mysql-5.1.73/bin/mysql_config --with-libcurl
Configuration:
Detected OS: linux-gnu
Install path: /usr/local/zabbix
Compilation arch: linux
Compiler: gcc
Compiler flags: -g -O2 -I/application/mysql-5.1.73/include/mysql -g -DUNIV_LINUX -I/usr/include/rpm -I/usr/local/include -I/usr/lib64/perl5/CORE -I. -I/usr/include
Enable server: yes
Server details:
With database: MySQL
WEB Monitoring: cURL
Native Jabber: no
SNMP: yes
IPMI: no
SSH: no
ODBC: no
Linker flags: -rdynamic -L/application/mysql-5.1.73/lib/mysql -L/usr/lib64
Libraries: -lm -ldl -lrt -lresolv -lmysqlclient -lnetsnmp -lcurl
Enable proxy: no
Enable agent: yes
Agent details:
Linker flags: -rdynamic
Libraries: -lm -ldl -lrt -lresolv -lcurl
Enable Java gateway: no
LDAP support: no
IPv6 support: no
***********************************************************
* Now run 'make install' *
* *
* Thank you for using Zabbix! *
* <http://www.zabbix.com> *
***********************************************************
[root@Centos tools]# tar zxf zabbix-2.4.8.tar.gz
[root@Centos tools]#cd zabbix-2.4.8
[root@Centos zabbix-2.4.8]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-net-snmp --with-mysql=/application/mysql-5.1.73/bin/mysql_config --with-libcurl
[root@Centos zabbix-2.4.8]# make && make install
3、配置zabbix
配置启动文件
代码语言:javascript复制[root@Centos zabbix-2.4.8]# cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
[root@Centos zabbix-2.4.8]# cp misc/init.d/tru64/zabbix_agentd /etc/init.d/
[root@Centos zabbix-2.4.8]# chmod 755 /etc/init.d/zabbix_server
[root@Centos zabbix-2.4.8]# chmod 755 /etc/init.d/zabbix_agentd
拷贝配置文件到WEB目录下
代码语言:javascript复制[root@Centos zabbix-2.4.8]# cp -r frontends/php /application/apache/htdocs/zabbix
创建数据库与用户
代码语言:javascript复制mysql> create database zabbix default charset utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on zabbix.* to zabbixuser@localhost identified by 'zabbixuser';
Query OK, 0 rows affected (0.06 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.06 sec)
初始化数据库
代码语言:javascript复制[root@Centos zabbix-2.4.8]# mysql zabbix <./database/mysql/schema.sql
[root@Centos zabbix-2.4.8]# mysql zabbix <./database/mysql/images.sql
[root@Centos zabbix-2.4.8]# mysql zabbix <./database/mysql/data.sql
修改配置文件
代码语言:javascript复制vi /etc/init.d/zabbix_agentd
DAEMON=/usr/local/zabbix-2.4.8/sbin/zabbix_agentd
[root@Centos etc]# egrep -v "^#.*|^$" zabbix_server.conf
ListenPort=10051
LogFile=/tmp/zabbix_server.log
DebugLevel=4
PidFile=/tmp/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbixuser
DBPassword=zabbixuser
DBSocket=/tmp/mysql.sock
DBPort=3306
StartPollers=15
StartIPMIPollers=15
StartPingers=2
StartDiscoverers=2
StartHTTPPollers=2
启动服务
代码语言:javascript复制[root@Centos etc]# /etc/init.d/zabbix_server start
Starting zabbix_server: /etc/init.d/functions: line 546: /usr/local/sbin/zabbix_server: No such file or directory [FAILED]
修改启动文件
代码语言:javascript复制[root@Centos etc]# vi /etc/init.d/zabbix_server 546
#!/bin/bash
#
# chkconfig: - 90 10
# description: Starts and stops Zabbix Server using chkconfig
# Tested on Fedora Core 2 - 5
# Should work on all Fedora Core versions
#
# @name: zabbix_server
# @author: Alexander Hagenah <hagenah@topconcepts.com>
# @created: 18.04.2006
#
# Modified for Zabbix 2.0.0
# May 2012, Zabbix SIA
#
# Source function library.
. /etc/init.d/functions
# Variables
# Edit these to match your system settings
# Zabbix-Directory
BASEDIR=/usr/local 修改成BASEDIR=/usr/local/zabbix
# Binary File
BINARY_NAME=zabbix_server
[root@Centos etc]# /etc/init.d/zabbix_server start
Starting zabbix_server: [ OK ]
4、打开浏览器进行相关设置
需要修改php.ini文件
代码语言:javascript复制post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
进入php的源码目录下切换到mysqli模块下
代码语言:javascript复制[root@Centos ext]# cd mysqli
[root@Centos mysqli]# /application/php/bin/phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
[root@Centos mysqli]# ./configure --prefix=/usr/local/mysqli --with-php-config=/application/php/bin/php-config --with-mysqli=/application/mysql-5.1.73/bin/mysql_config
[root@Centos mysqli]# make && make install
[root@Centos mysqli]# cd ../
[root@Centos ext]# cd bcmath/
[root@Centos bcmath]# /application/php/bin/phpize Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
[root@Centos bcmath]# ./configure --prefix=/usr/local/bcmath --with-php-config=/application/php/bin/php-config
[root@Centos bcmath]# make && make install
[root@Centos bcmath]# cd ../
[root@Centos ext]# cd gettext/
[root@Centos gettext]# /application/php/bin/phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
[root@Centos gettext]# ./configure --prefix=/usr/local/gettext --with-php-config=/application/php/bin/php-config
[root@Centos gettext]# make && make install
[root@Centos gettext]# ll /application/php-5.3.27/lib/php/extensions/no-debug-zts-20090626/
total 728
-rwxr-xr-x 1 root root 145372 Nov 15 15:17 bcmath.so
-rwxr-xr-x 1 root root 42037 Nov 15 15:18 gettext.so
-rwxr-xr-x 1 root root 549483 Nov 15 15:15 mysqli.so
修改php.ini文件未行加上模块
代码语言:javascript复制extension=mysqli.so
extension=bcmath.so
extension=gettext.so
重启httpd服务
错误解决了下一步即可
填写数据库信息
这里点击下载配置文件,然后上传到站点目录下,Retry即可
默认用户:Admin 密码:zabbix
登陆成功,至此所有安装结束