zabbix搭建
Posted taotao12
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix搭建相关的知识,希望对你有一定的参考价值。
1. 安装zabbix 安装zabbix服务端
[root@linux-node1 ~]# mkdir -p /home/lxy/tools [root@linux-node1 ~]# cd /home/lxy/tools/ [root@linux-node1 tools]# wget -q http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm [root@linux-node1 tools]# rpm -ivh zabbix-release-2.4-1.el6.noarch.rpm [root@linux-node1 tools]# rpm -ql zabbix-release /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX /etc/yum.repos.d/zabbix.repo /usr/share/doc/zabbix-release-2.4 /usr/share/doc/zabbix-release-2.4/GPL [root@linux-node1 tools]# ll /etc/yum.repos.d/zabbix.repo -rw-r--r-- 1 root root 401 9月 11 2014 /etc/yum.repos.d/zabbix.repo
2.开始安装zabbix
(1)保留yum安装的rpm包 [root@linux-node1 tools]# sed -i \'s#keepcache=1#keepcache=0#g\' /etc/yum.conf [root@linux-node1 tools]# grep keepcache /etc/yum.conf keepcache=0
(2)开始安装zabbix
yum -y install zabbix zabbix-server zabbix-server-mysql #<==ZABBIX SERVER相关 yum -y install zabbix-web zabbix-web-mysql #<==Apache、php Web界面环境 yum -y install zabbix-agent #<== ZABBIX客户端 yum -y install mysql-server mysql #<==MySQL客户端与服务端
1)配置mysql [root@linux-node1 tools]# \\cp /usr/share/mysql/my-medium.cnf /etc/my.cnf [root@linux-node1 tools]# vim /etc/my.cnf 在[mysqld](第26行)标签下增加如下三行后保存 [mysqld] character-set-server = utf8 init-connect = \'SET NAMES utf8\' collation-server = utf8_general_ci [root@linux-node1 tools]# /etc/init.d/mysqld start (2)初始化数据库环境 创建数据库 mysql> create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec) 授权数据库 mysql> grant all on zabbix.* to zabbix@localhost identified by \'zabbix\'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; 导入表结构 [root@linux-node1 tools]# cd /usr/share/doc/zabbix-server-mysql-2.4.6/create/ [root@linux-node1 create]# mysql -u root -p zabbix < schema.sql [root@linux-node1 create]# mysql -u root -p zabbix < images.sql [root@linux-node1 create]# mysql -u root -p zabbix < data.sql [root@linux-node1 create]# mysqladmin -uroot password 123456
4)更改zabbix server配置 [root@linux-node1 ~]# cp /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.bak [root@linux-node1 ~]# sed -i \'s@# DBPassword=@DBPassword=zabbix@g\' /etc/zabbix/zabbix_server.conf [root@linux-node1 ~]# sed -i \'s@# DBHost=localhost@DBHost=localhost@g\' /etc/zabbix/zabbix_server.conf ------------------------------------------------- vim /etc/zabbix/zabbix_server.conf LogFile=/var/log/zabbix/zabbix_server.log DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix 5)启动相关服务 [root@linux-node1 ~]# /etc/init.d/zabbix-server start Starting Zabbix server: [确定] [root@linux-node1 ~]# /etc/init.d/httpd start 正在启动 httpd: [确定] [root@linux-node1 ~]# lsof -i:10051|wc -l 55 [root@linux-node1 ~]# lsof -i:80|wc -l
输入你服务的ip地址/zabbix
报错了如下
解决如下
更改php.ini配置文件的设置,去掉date.timezone的注释,将时区改为Asia/Shanghai
重启httpd服务
[root@localhost create]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: httpd: Could not reliably determine the server\'s fully qualified domain name, using localhost.localdomain for ServerName
[ OK ]
点击"Retry"重新进行检查,顺利通过检查
web界面显示密码不正确,怎么登不进去
[root@localhost create]# echo -n taotao | openssl md5
[root@localhost create]# mysql -u root -p
密码:123456
update users set passwd=\'a7f0b75a4e2b10650936c72f90b03cff\' where userid = \'1\';
重启服务:service httpd restart
关闭防火墙:service iptables stop
查看日志路径: tail -30 /var/log/zabbix/zabbix_server.log
以上是关于zabbix搭建的主要内容,如果未能解决你的问题,请参考以下文章