Server:zabbix服务的服务器 采用mysql存储监控数据并使用nginx+php的方式呈现。
Agent 被监控设备上的zabbix代理
SNMP 指支持SNMP协议的设备
IPMI:设备的物理性能监控
LNMP架构安装配置方法 http://9272317.blog.51cto.com/9262317/1826042
php依赖的包
yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
错误:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决办法:
rpm -ivh epel-release- 6-7.noarch.rpm yum install -y libmcrypt-devel
下载zabbix版本
cd cd /usr/local/src/ wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.0.6/zabbix-2.0.6.tar.gz/download
***************正式安装server端************************
yum -y install curl curl-devel net-snmp net-snmp-devel perl-DBI groupadd zabbix ; useradd -g zabbix zabbix ; usermod -s /sbin/nologin zabbix
*********server配置*************
1.进入mysql –uroot -p,创建zabbix数据库,执行授权命令:
create database zabbix; grant all on zabbix.* to zabbix@localhost identified by ‘123456‘;
cd /usr/local/src/;tar zxvf zabbix-2.0.6.tar.gz;cd zabbix-2.0.6; mysql -uzabbix -p123456 zabbix < database/mysql/schema.sql mysql -uzabbix -p123456 zabbix < database/mysql/images.sql mysql -uzabbix -p123456 zabbix < database/mysql/data.sql
./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-mysql -- enable-ipv6 --with-net-snmp --with-libcurl &&make install ln -s /usr/local/zabbix/sbin/zabbix_server /usr/local/sbin/
2.安装完毕
vim /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456
拷贝zabbix_server脚本,启动zabbix_server, 默认端口为10051
cp /usr/local/src/zabbix-2.0.6/misc/init.d/tru64/zabbix_server
/etc/init.d/zabbix_server chmod a+x /etc/init.d/zabbix_server
配置nginx发布zabbix php代码
--------------------------------------------------
cp -a /usr/local/src/zabbix-2.0.6/frontends/php/* /usr/local/nginx/html /usr/local/nginx/sbin/nginx /etc/init.d/nginxd restart
*************** Agent客户端如下配置 ******************
yum -y install curl curl-devel net-snmp net-snmp-devel perl-DBI groupadd zabbix ; useradd -g zabbix zabbix ; usermod -s /sbin/nologin zabbix
tar zxvf zabbix-2.0.6.tar.gz cd zabbix-2.0.6;./configure --prefix=/usr/local/zabbix --enable-agent &&make install
vim /usr/local/zabbix/etc/zabbix_agentd.conf
LogFile=/tmp/zabbix_agentd.log
Server=192.168.1.5 指向服务器的ip
ServerActive=192.168.1.5
cd zabbix-2.0.6; cp /usr/local/src/zabbix-2.0.6/misc/init.d/tru64/zabbix_agentd /etc/init.d/zabbix_agentd; chmod o+x /etc/init.d/zabbix_agentd
*******************************************************************
启动所有服务安装zabbix
重启服务端zabbix_server:
/etc/init.d/zabbix_server restart /etc/init.d/nginxd restart ; /etc/init.d/mysqld restart
即可。
重启客户端zabbix_agentd:
/etc/init.d/zabbix_agentd restart
浏览器访问zabbix
安装访问之前需要装的依赖包
yum install php-mbstring php-bcmath php-gd php-xml -y yum install gd gd-devel -y
修改php错误参数
sed -i ‘/post_max_size/s/8/16/g;/max_execution_time/s/30/300/g;/max_input_time/s/60/300/g;‘ /usr/local/php/php.ini
安装过程中的报错:
1.date(): It is not safe to rely on the system‘s timezone settings. You are *required*
to use the date.timezone setting or the date_default_timezone_set() function. In case
you used any of those methods and you are still getting this warning, you most likely
misspelled the timezone identifier. We selected ‘Asia/Chongqing‘ for ‘CST/8.0/no DST‘
instead [include/page_header.php:185]
解决办法:
vim /usr/local/php/php.ini
date.timezone =PRC
/etc/init.d/nginxd restart && /etc/init.d/php-fpm
2.提示 conffiguration file "var/www/html/conf/zabbix.conf./php" create.fail
cd /usr/local/nginx/html/ conf cp zabbix.conf.php.example zabbix.conf.php vim zabbix.conf.php
------<?php // Zabbix GUI configuration file global $DB; $DB["TYPE"] = ‘MYSQL‘; $DB["SERVER"] = ‘localhost‘; $DB["PORT"] = ‘0‘; $DB["DATABASE"] = ‘zabbix‘; $DB["USER"] = ‘zabbix‘; $DB["PASSWORD"] = ‘123456‘; // SCHEMA is relevant only for IBM_DB2 database $DB["SCHEMA"] = ‘‘; $ZBX_SERVER = ‘localhost‘; $ZBX_SERVER_PORT = ‘10051‘; $ZBX_SERVER_NAME = ‘‘; $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; ?>---------------核实下内容信息是否正确
点击retry重试;
访问ip:192.168.xxx.xxx
默认用户名和密码:admin 、zabbix
****************** web 界面 乱码修改 **********************
1. 进入 mysql;
show variables like "%char%";
vim /etc/my.cnf
----------------->
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character_set_server = utf8 ---新增项
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysql] ---新增项
default-character-set = utf8 ---新增项
<-----------------
======================================================
如果还有乱码我们需要导出我们的数据库,修改字符集
mysqldump -uroot -p zabbix >zabbix.sql
--导出数据库
sed -i ‘s/latin1/utf8/g‘ zabbix.sql
--修改字符集
进入mysql ;drop database zabbix;
在创建 create database zabbix;
exit mysql
再导入数据库
原文地址:http://9272317.blog.51cto.com/9262317/1826420