环境:
[root@redis ~]# uname -a
Linux redis 2.6.-.el6.x86_64 # SMP Tue Mar :: UTC 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源环境,就继续向下看详细的安装步骤。
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
[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 :3.0.-.el6 zabbix-web-mysql.noarch :3.0.-.el6 作为依赖被安装:
OpenIPMI-libs.x86_64 :2.0.-.el6 OpenIPMI-modalias.x86_64 :2.0.-.el6
dejavu-fonts-common.noarch :2.33-.el6 dejavu-sans-fonts.noarch :2.33-.el6
fontpackages-filesystem.noarch :1.44-.el6 fping.x86_64 :3.10-.el6
httpd.x86_64 :2.4.-.el6.centos. httpd-tools.x86_64 :2.4.-.el6.centos.
iksemel.x86_64 :1.4-.el6 libX11.x86_64 :1.6.-.el6
libX11-common.noarch :1.6.-.el6 libXau.x86_64 :1.0.-2.1.el6
libXpm.x86_64 :3.5.-.el6 libpng.x86_64 :1.5.-.el6_2
libxcb.x86_64 :1.12-.el6 libzip.x86_64 :0.10.-.el6
mailcap.noarch :2.1.-.el6 net-snmp-libs.x86_64 :5.7.-.el6
php.x86_64 :5.4.-.el6 php-bcmath.x86_64 :5.4.-.el6
php-cli.x86_64 :5.4.-.el6 php-common.x86_64 :5.4.-.el6
php-gd.x86_64 :5.4.-.el6 php-ldap.x86_64 :5.4.-.el6
php-mbstring.x86_64 :5.4.-.el6 php-mysql.x86_64 :5.4.-.el6
php-pdo.x86_64 :5.4.-.el6 php-xml.x86_64 :5.4.-.el6
t1lib.x86_64 :5.1.-.el6 unixODBC.x86_64 :2.3.-.el6
zabbix-web.noarch :3.0.-.el6 完毕!
安装过程
mysql安装
[root@m01 ~]# yum install -y mysql-server
已安装:
mariadb-server.x86_64 :5.5.-.el6 作为依赖被安装:
libaio.x86_64 :0.3.-.el6
mariadb.x86_64 :5.5.-.el6
perl-Compress-Raw-Bzip2.x86_64 :2.061-.el6
perl-Compress-Raw-Zlib.x86_64 :2.061-.el6
perl-DBD-MySQL.x86_64 :4.023-.el6
perl-DBI.x86_64 :1.627-.el6
perl-IO-Compress.noarch :2.061-.el6
perl-Net-Daemon.noarch :0.48-.el6
perl-PlRPC.noarch :0.2020-.el6 完毕!
安装过程
启动mysql:
[root@redis ~]# /etc/init.d/mysqld start
创建zabbix所需的库
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, row affected (0.00 sec) mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, rows affected (0.00 sec) mysql> exit
Bye
将sql文件导入数据库
[root@redis ~]# zcat /usr/share/doc/zabbix-server-mysql-3.0./create.sql.gz|mysql -uzabbix -pzabbix zabbix
配置zabbix server连接mysql
[root@redis ~]# sed -i.ori '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
复制zabbix到站点目录下
\cp -R /usr/share/zabbix/ /var/www/html/
修改zabbix需要的php参数
这步也可以根据网页做。(根据网页初始化的Check of pre-requisites这一页做)
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 客户端
下载安装客户端
[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
修改客户端配置文件
[root@db03 ~]# sed -i.ori 's#Server=127.0.0.1#Server=172.16.1.88#' /etc/zabbix/zabbix_agentd.conf
启动zabbix-agent
/etc/init.d/zabbix-agent start
检查zabbix是否可以监控(只能在server端操作)
yum install zabbix-get -y
zabbix_get -s 172.16.1.61 -p -k
网页添加监控
主机名称:要与zabbix-agent.conf中Hostname指定的名字一样或者填写主机ip,设置这个主要是为了让zabbix server程序调用的
可见名称:显示在zabbix网页上的,给我们看的