zabbix安装与配置

来源:互联网 发布:域名交易网站 编辑:程序博客网 时间:2024/06/05 01:52

zabbix安装与配置

1.安装mysql数据

参见http://blog.csdn.net/weiwangsisoftstone/article/details/50353246

2.创建数据库以及用户

mysql> CREATE DATABASE zabbix CHARACTER SET utf8;

Query OK, 1 row affected (0.02 sec)

mysql> show databases;

mysql> GRANT ALL on zabbix.* TO zabbix@'%' IDENTIFIED BY 'zabbix';

Query OK, 0 rows affected (0.03 sec)

[root@mysqlmaster ~]# mysql -uzabbix -pzabbix

mysql> 

3.添加操作系统用户:

groupadd zabbix

useradd -g zabbix zabbix

4.zabbix安装

下载zabbix源码包

http://www.zabbix.com/download.php

解压:

[root@mysqlmaster zabbix]# tar -zxvf zabbix-2.4.7.tar.gz 

安装LAMP环境

[root@zabbix ~]# yum install -y httpd mysql mysql-server mysql-devel php php-mysql php-common php-mbstring php-gd php-odbc php-xml php-pear

(由于mysql数据库上面已经安装了,这个可以不安装mysqlmysql mysql-server mysql-devel)

安装zabbix所需的组件(server,agent)

[root@zabbix ~]# yum install -y curl curl-devel net-snmp net-snmp-devel perl-DBI

编译安装,如果是客户端安装选择--enable-agent就行了。

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

[root@mysqlmaster zabbix-2.4.7]# ./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /bin/mkdir -p

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking whether make supports nested variables... yes

configure: Configuring Zabbix 2.4.7

checking whether make sets $(MAKE)... (cached) yes

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/home/zabbix/zabbix-2.4.7':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

[root@mysqlmaster zabbix-2.4.7]# yum install gcc

报错:

checking for the linux kernel version... 2.6 family (2.6.32-279.el6.x86_64)

checking size of void *... 8

checking for mysql_config... /usr/bin/mysql_config

checking for main in -lmysqlclient... no

configure: error: Not found mysqlclient library

mysql library没有安装,我之前已经安装了mysql servermysql client

[root@mysqlmaster ~]# rpm -qa |grep MySQL*

MySQL-server-5.6.28-1.el6.x86_64

MySQL-client-5.6.28-1.el6.x86_64

[root@mysqlmaster ~]# 

mysql其他包也安装上

[root@mysqlmaster mysqlinstall]# ls

MySQL-5.6.28-1.el6.x86_64.rpm-bundle.tar  MySQL-devel-5.6.28-1.el6.x86_64.rpm     MySQL-server-5.6.28-1.el6.x86_64.rpm  MySQL-shared-compat-5.6.28-1.el6.x86_64.rpm

MySQL-client-5.6.28-1.el6.x86_64.rpm      MySQL-embedded-5.6.28-1.el6.x86_64.rpm  MySQL-shared-5.6.28-1.el6.x86_64.rpm  MySQL-test-5.6.28-1.el6.x86_64.rpm

[root@mysqlmaster mysqlinstall]# rpm -ivh *.rpm

warning: MySQL-client-5.6.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                ########################################### [100%]

       package MySQL-devel-5.6.28-1.el6.x86_64 is already installed

       package MySQL-client-5.6.28-1.el6.x86_64 is already installed

       package MySQL-server-5.6.28-1.el6.x86_64 is already installed

[root@mysqlmaster mysqlinstall]# rpm -ivh  MySQL-shared-compat-5.6.28-1.el6.x86_64.rpm 

warning: MySQL-shared-compat-5.6.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                ########################################### [100%]

   1:MySQL-shared-compat    ########################################### [100%]

[root@mysqlmaster mysqlinstall]# rpm -ivh  MySQL-shared-5.6.28-1.el6.x86_64.rpm 

warning: MySQL-shared-5.6.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                ########################################### [100%]

   1:MySQL-shared           ########################################### [100%]

[root@mysqlmaster ~]# rpm -qa |grep MySQL*

MySQL-shared-5.6.28-1.el6.x86_64

MySQL-server-5.6.28-1.el6.x86_64

MySQL-devel-5.6.28-1.el6.x86_64

MySQL-client-5.6.28-1.el6.x86_64

MySQL-shared-compat-5.6.28-1.el6.x86_64

[root@mysqlmaster ~]# 

再次执行configure通过

执行make install

[root@mysqlmaster ~]# make install

编译安装完毕

5.初始化zabbix数据(执行zabbixsql脚本)

[root@mysqlmaster mysql]# pwd

/home/zabbix/zabbix-2.4.7/database/mysql

[root@mysqlmaster mysql]# ls

data.sql  images.sql  schema.sql

[root@mysqlmaster mysql]# mysql -uzabbix -pzabbix

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.6.28-log MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use zabbix;

Database changed

mysql> source schema.sql;

mysql> source images.sql;

mysql> source data.sql;

6.设置zabbix为启动服务

[root@mysqlmaster tru64]# ls

zabbix_agentd  zabbix_server

[root@mysqlmaster tru64]# pwd

/home/zabbix/zabbix-2.4.7/misc/init.d/tru64

[root@mysqlmaster tru64]# cp zabbix_agentd /etc/init.d/

[root@mysqlmaster tru64]# cp zabbix_server /etc/init.d/

[root@mysqlmaster tru64]# chmod +x /etc/init.d/zabbix_*

添加服务:

[root@mysqlmaster init.d]# export LANG=zh_cn.GB2312

[root@mysqlmaster init.d]# chkconfig --add zabbix_agentd 

service zabbix_agentd does not support chkconfig

报不支持把如下两行添加到zabbix_serverzabbix_agentd

#chkconfig: 35 95 95

#description:zabbix Agent server 

[root@mysqlmaster init.d]# chkconfig --add zabbix_server

[root@mysqlmaster init.d]# chkconfig --add zabbix_agentd 

[root@mysqlmaster init.d]# chkconfig zabbix_server on

[root@mysqlmaster init.d]# chkconfig zabbix_agentd on

7.修改配置文件

/usr/local/etc

[root@zabbix etc]# vi zabbix_server.conf #服务端的配置

LogFile=/var/log/zabbix_server.log

DBHost=localhost

DBName=zabbix

DBUser=zabbix

DBPassword=123456

[root@zabbix etc]# more zabbix_agentd.conf #客户端配置

LogFile=/tmp/zabbix_agentd.log

Server=127.0.0.1

启动zabbix

/etc/init.d/zabbix_server start

8.安装zabbix web页面

复制php文件将frontends/php下面的php文件拷贝到web服务器html文件目录下面

[root@mysqlmaster zabbix-2.4.7]# cp -r frontends/php /var/www/html/zabbix

启动apache服务

[root@mysqlmaster zabbix-2.4.7]# /etc/init.d/httpd restart

Stopping httpd:                                            [  OK  ]

Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.100 for ServerName

8.在浏览器中打开web界面

http://192.168.1.100/zabbix/php/setup.php

 

点击next

 

修改/etc/php.ini配置文件

post_max_size =16M

max_execution_time =300

max_input_time =300

date.timezone = Asia/Shanghai

post_max_size = 32M

重启apache

[root@mysqlmaster etc]# /etc/init.d/httpd restart

还是报错Php bcmath fail

Php bcmath fail是因为包没有安装

安装php-bcmath包

[root@mysqlmaster etc]# yum install php-bcmath*

重启apache点击retry通过

[root@mysqlmaster etc]# /etc/init.d/httpd restart

 

配置数据库链接,然后test

 

配置zabbix server

 

点击next

配置文件生成fail原因是由于权限问题导致,修改权限然后重试通过

"/var/www/html/zabbix/php/conf/zabbix.conf.php" fail

[root@mysqlmaster html]# chown apache:apache -R zabbix/

 

登陆zabbix,默认用户名:Admin,密码:zabbix

 

0 0
原创粉丝点击