环境:
代码语言:javascript复制[root@redis ~]# uname -a
Linux redis 2.6.32-696.el6.x86_64 #1 SMP Tue Mar 21 19:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@redis ~]# cat /etc/redhat-release
CentOS release 6.9 (Final)
[root@redis ~]# getenforce
Disabled
[root@redis ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
[root@redis ~]#
部署zabbix server
如果会配置yum源环境(zabbix源、repo源)的话可以直接执行:
这些也是安装zabbix server需要的一些程序,如果不会配置yum源环境,就继续向下看详细的安装步骤。
代码语言:javascript复制yum install httpd zabbix-web zabbix-server-mysql zabbix-web-mysql zabbix-get mysql-server php55w php55w-mysql php55w-common php55w-gd php55w-mbstring php55w-mcrypt php55w-devel php55w-xml php55w-bcmath zabbix-get zabbix-java-gateway wqy-microhei-fonts net-snmp net-snmp-utils -y
安装zabbix、httpd、php
代码语言:javascript复制[root@m01 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
[root@m01 ~]# yum install -y zabbix-server-mysql zabbix-web-mysql
已安装:
zabbix-server-mysql.x86_64 0:3.0.13-2.el6 zabbix-web-mysql.noarch 0:3.0.13-2.el6
作为依赖被安装:
OpenIPMI-libs.x86_64 0:2.0.19-15.el6 OpenIPMI-modalias.x86_64 0:2.0.19-15.el6
dejavu-fonts-common.noarch 0:2.33-6.el6 dejavu-sans-fonts.noarch 0:2.33-6.el6
fontpackages-filesystem.noarch 0:1.44-8.el6 fping.x86_64 0:3.10-4.el6
httpd.x86_64 0:2.4.6-67.el6.centos.6 httpd-tools.x86_64 0:2.4.6-67.el6.centos.6
iksemel.x86_64 0:1.4-6.el6 libX11.x86_64 0:1.6.5-1.el6
libX11-common.noarch 0:1.6.5-1.el6 libXau.x86_64 0:1.0.8-2.1.el6
libXpm.x86_64 0:3.5.12-1.el6 libpng.x86_64 2:1.5.13-7.el6_2
libxcb.x86_64 0:1.12-1.el6 libzip.x86_64 0:0.10.1-8.el6
mailcap.noarch 0:2.1.41-2.el6 net-snmp-libs.x86_64 1:5.7.2-28.el6
php.x86_64 0:5.4.16-42.el6 php-bcmath.x86_64 0:5.4.16-42.el6
php-cli.x86_64 0:5.4.16-42.el6 php-common.x86_64 0:5.4.16-42.el6
php-gd.x86_64 0:5.4.16-42.el6 php-ldap.x86_64 0:5.4.16-42.el6
php-mbstring.x86_64 0:5.4.16-42.el6 php-mysql.x86_64 0:5.4.16-42.el6
php-pdo.x86_64 0:5.4.16-42.el6 php-xml.x86_64 0:5.4.16-42.el6
t1lib.x86_64 0:5.1.2-14.el6 unixODBC.x86_64 0:2.3.1-11.el6
zabbix-web.noarch 0:3.0.13-2.el6
完毕!
mysql安装
代码语言:javascript复制[root@m01 ~]# yum install -y mysql-server
已安装:
mariadb-server.x86_64 1:5.5.56-2.el6
作为依赖被安装:
libaio.x86_64 0:0.3.109-13.el6
mariadb.x86_64 1:5.5.56-2.el6
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el6
perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el6
perl-DBD-MySQL.x86_64 0:4.023-5.el6
perl-DBI.x86_64 0:1.627-4.el6
perl-IO-Compress.noarch 0:2.061-2.el6
perl-Net-Daemon.noarch 0:0.48-5.el6
perl-PlRPC.noarch 0:0.2020-14.el6
完毕!
启动mysql:
代码语言:javascript复制[root@redis ~]# /etc/init.d/mysqld start
创建zabbix所需的库
代码语言:javascript复制mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
将sql文件导入数据库
代码语言:javascript复制[root@redis ~]# zcat /usr/share/doc/zabbix-server-mysql-3.0.13/create.sql.gz|mysql -uzabbix -pzabbix zabbix
配置zabbix server连接mysql
代码语言:javascript复制[root@redis ~]# sed -i.ori '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
复制zabbix到站点目录下
代码语言:javascript复制cp -R /usr/share/zabbix/ /var/www/html/
修改zabbix需要的php参数
这步也可以根据网页做。(根据网页初始化的Check of pre-requisites这一页做)
代码语言:javascript复制sed -i '/^max_execution_time/cmax_execution_time = 300' /etc/php.ini
sed -i '/^max_input_time/cmax_input_time = 300' /etc/php.ini
sed -i '/^post_max_size/cpost_max_size = 32M' /etc/php.ini
date.timezone = Asia/Shanghai --- 手动改吧
网页登陆操作
登陆账号密码:Admin zabbix
改中文
安装zabbix agent 客户端
下载安装客户端
代码语言:javascript复制[root@db03 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
[root@db03 ~]# yum install -y zabbix-agent
修改客户端配置文件
代码语言:javascript复制[root@db03 ~]# sed -i.ori 's#Server=127.0.0.1#Server=172.16.1.88#' /etc/zabbix/zabbix_agentd.conf
启动zabbix-agent
代码语言:javascript复制/etc/init.d/zabbix-agent start
检查zabbix是否可以监控(只能在server端操作)
代码语言:javascript复制yum install zabbix-get -y
zabbix_get -s 172.16.1.61 -p 10050 -k
网页添加监控
主机名称:要与zabbix-agent.conf中Hostname指定的名字一样或者填写主机ip,设置这个主要是为了让zabbix server程序调用的
可见名称:显示在zabbix网页上的,给我们看的