Centos6.5 安装zabbix3

前端之家收集整理的这篇文章主要介绍了Centos6.5 安装zabbix3前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.安装PHP

Zabbix 3.0对PHP的要求最低为5.4,而CentOS6默认为5.3.3,完全不满足要求,故需要利用第三方源,将PHP升级到5.4以上,注意,不支持PHP7

rpm-ivhhttp://repo.webtatic.com/yum/el6/latest.rpm
yuminstallPHP56wPHP56w-gdPHP56w-MysqLPHP56w-bcmathPHP56w-mbstringPHP56w-xmlPHP56w-ldap
vim/etc/PHP.ini
date.timezone=Asia/Shanghai
post_max_size=32M
max_execution_time=300
max_input_time=300
always_populate_raw_post_data=-1

2.安装MysqL

MysqL建议使用5.6版本,CentOS6默认为5.1,不建议使用,性能偏低

rpm-ivhhttp://dev.MysqL.com/get/MysqL-community-release-el6-5.noarch.rpm
yuminstall-yMysqL-serverMysqL-devel

vim/etc/my.cnf
[MysqLd]
innodb_file_per_table#独立表空间模式
serviceMysqLdstart

MysqL_secure_installation#MysqL安全配置向导
Entercurrentpasswordforroot(enterfornone):<�初次运行直接回车
Setrootpassword?[Y/n]<�是否设置root用户密码,输入y并回车或直接回车
Removeanonymoususers?[Y/n]<�是否删除匿名用户,生产环境建议删除,所以直接回车
Disallowrootloginremotely?[Y/n]<�是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止
Removetestdatabaseandaccesstoit?[Y/n]<�是否删除test数据库,直接回车
Reloadprivilegetablesnow?[Y/n]<�是否重新加载权限表,直接回车

MysqL-uroot-p
MysqL>CREATEDATABASEzabbixCHARACTERSETutf8COLLATEutf8_bin;
MysqL>GRANTALLPRIVILEGESONzabbix.*TOzabbix@localhostIDENTIFIEDBY'zabbix';
MysqL>flushprivileges;
MysqL>showdatabases;
+--------------------+
|Database|
+--------------------+
|information_schema|
|MysqL|
|performance_schema|
|zabbix|
+--------------------+

3.安装Zabbix

yuminstallhttpdlibxml2-develnet-snmp-devellibcurl-devel
groupadd-g201zabbix
useradd-gzabbix-u201-mzabbix
wgethttp://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz
tarzxvfzabbix-3.0.3.tar.gz
cdzabbix-3.0.3
/usr/bin/MysqL-uzabbix-pzabbixzabbix<database/MysqL/schema.sql
/usr/bin/MysqL-uzabbix-pzabbixzabbix<database/MysqL/images.sql
/usr/bin/MysqL-uzabbix-pzabbixzabbix<database/MysqL/data.sql

./configure--prefix=/usr/local/zabbix--sysconfdir=/etc/zabbix/--enable-server--enable-agent--with-net-snmp--with-libcurl--with-MysqL--with-libxml2
make&&makeinstall
(编译zabbix如果报下面错误,就做以下操作
configure:error:NotfoundMysqLclientlibrary
#find/-namelibMysqLclient*
ln-s/usr/lib64/MysqL/libMysqLclient.so.18.1.0/usr/lib64/MysqL/libMysqLclient.so
ln-s/usr/lib64/MysqL/libMysqLclient_r.so.18.1.0/usr/lib64/MysqL/libMysqLclient_r.so)

4.配置Zabbix

vim/etc/zabbix/zabbix_server.conf
DBHost=localhost数据库ip地址
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
ListenIP=127.0.0.1,192.168.10.10zabbixserverip地址

iptables-IINPUT-ptcp-mmultiport--dports10050:10051-jACCEPT
serviceiptablessave&&serviceiptablesrestart
ln-s/usr/local/zabbix/sbin/*/usr/sbin/
cp/home/sources/zabbix-3.0.3/misc/init.d/fedora/core/zabbix_*/etc/init.d/
chmod+x/etc/init.d/zabbix_*
sed-i"s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g"/etc/init.d/zabbix_server

配置WEB
vim/etc/httpd/conf/httpd.conf
ServerName127.0.0.1
ServerName192.168.10.10
DocumentRoot"/var/www/html"

mkdir-p/var/www/html/zabbix
cp-r/home/sources/zabbix-3.0.3/frontends/PHP/*/var/www/html/zabbix/
chown-Rapache.apache/var/www/html/zabbix/
chkconfigzabbix_serveron
/etc/init.d/zabbix_serverstart
servicehttpdrestart

用浏览器访问http://192.168.10.10/zabbix,并按照提示安装:


wKiom1ewQwWzGAKfAAKTGJ0PA8A216.png

wKioL1ewQwbw4ooTAAET-tI8TB0938.png

wKioL1ewQwaQiAyAAABRfqqOcLg317.png

wKiom1ewQwfhPC6PAAEMmq5y9YY680.png



wKioL1ewQwfwx_fEAAEX-zPjeIY852.png


用户名:Admin 注A大写
密码:zabbix

wKiom1ewQ4WwFT44AAHGbIrt8Jc204.png

wKioL1ewQ4bRdHs8AAEUuhrjYPk762.png


客户端安装:



在客户端上yum install zabbix22-agent

vim /etc/zabbix_agentd.conf//更改


Server=服务端ip;

ServerActive=0.0.0.0:10050(这个我没有设置)

Hostname=aming(自定义,但要唯一)

启动客户端 /etc/init.d/zabbix-agent start


服务端上命令行测试:

zabbix_get -s 客户端ip -p10050 -k "system.hostname"

wKiom1exwHSQErSlAABhfXfSY7k503.png


错误信息:


  1. 打开网页显示zabbix is not running

<1>查看数据库没连接上, tail /tmp/zabbix_server.log(查看zabbix服务端日志)

新建数据库用户,把数据库重启,再看日志

wKioL1ex3ayj471lAAAj6n2md54236.png

<2>

vi/var/www/html/zabbix/conf/zabbix.conf.PHP

wKiom1ex3eeyk6tMAAA_GtlTe7Y875.png

猜你在找的CentOS相关文章