##############################################################
#服务端
#zabbix安装部署
#安装zabbix-release包
#创建下载安装包目录
mkdir -p /home/oldboy/tools
cd /home/oldboy/tools
#下载安装包
wget -q http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
#查看
ls -lh zabbix-release-2.4-1.el6.noarch.rpm
#安装
rpm -ivh zabbix-release-2.4-1.el6.noarch.rpm
#zabbix-release包安装结果
rpm -ql zabbix-release
ll /etc/yum.repos.d/zabbix.repo
#保留yum安装的rpm包
sed -i ‘s#keepcache=1#keepcache=0#g’ /etc/yum.conf
grep keepcache /etc/yum.conf
#keepcache=0
#开始安装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客户端与服务端
yum -y install zabbix-get #<=zabbix命令行工具
#配置zabbix服务相关
#配置并启动MySQL
\cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
vi /etc/my.cnf
#然后在[mysqld](第26行)标签下增加如下三行后保存,添加时去掉注释
[mysqld]
character-set-server = utf8
init-connect = 'SET NAMES utf8'
collation-server = utf8_general_ci
#启动zabbix存储数据的数据库MySQL
/etc/init.d/mysqld start
#……
#Please report any problems with the /usr/bin/mysqlbug script!
#查看端口
netstat -lntup|grep mysql
#进去mysql
mysql
#初始化zabbix存储数据的数据库MySQL
mysql -e "create database zabbix character set utf8 collate utf8_bin;"
mysql -e "grant all on zabbix.* to zabbix@localhost identified by 'zabbix';"
cd /usr/share/doc/zabbix-server-mysql-2.4.6/create
mysql zabbix
#mysqladmin -uroot password oldboy
#初始化apache服务的zabbix配置
sed -i 's## php_value date.timezone Europe/Riga#php_value date.timezone Asia/Shanghai#g' /etc/httpd/conf.d/zabbix.conf
grep Shanghai /etc/httpd/conf.d/zabbix.conf
#初始化zabbix server配置
cp /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.oldboy.ori
sed -i 's@# DBPassword=@DBPassword=zabbix@g' /etc/zabbix/zabbix_server.conf
grep DBPassword= /etc/zabbix/zabbix_server.conf
#修改前后对比:
diff /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.oldboy.ori
#启动zabbix server及web服务
/etc/init.d/zabbix-server start
lsof -i :10051|wc -l
#55
/etc/init.d/httpd start
lsof -i :80|wc -l
#10
######################################################
#客户端
#安装zabbix Client
#安装zabbix agent端
#官方安装参考:https://www.zabbix.com/documentation/2.4/manual/installation/install_from_packages
#linux的基础优化必须要做,时间同步、防火墙配置、selinux配置等。
#http://www.chuanke.com/3628575-138303.html
#安装zabbix-release包
mkdir -p /home/oldboy/tools
cd /home/oldboy/tools
wget http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
ls -lh zabbix-release-2.4-1.el6.noarch.rpm
rpm -ivh zabbix-release-2.4-1.el6.noarch.rpm
#zabbix-release包安装结果
rpm -ql zabbix-release
ll /etc/yum.repos.d/zabbix.repo
#2、开始安装zabbix
#1 保留yum安装的rpm包
sed -i 's#keepcache=1#keepcache=0#g' /etc/yum.conf
grep keepcache /etc/yum.conf
#keepcache=0
#2)开始安装zabbix agent
yum -y install zabbix-agent #<== ZABBIX客户端
yum -y install zabbix-get #<==zabbix命令行工具
#提示:也可以去官方下载rpm http://repo.zabbix.com/zabbix/2.4/rhel/
#3、配置zabbix agent服务相关
grep Server= /etc/zabbix/zabbix_agentd.conf
Server=
#Server=127.0.0.1 #配置文件中将注释去掉
4、启动zabbix agent
/etc/init.d/zabbix-agent start
netstat -tunlp|grep 10050
#监控日志
tailf /var/log/zabbix/zabbix_agentd.log
#26560:20151028:185412.799 Starting Zabbix Agent [Zabbix server]. Zabbix 2.4.6 #(revision 54796).
#26560:20151028:185412.799 using configuration file: #/etc/zabbix/zabbix_agentd.conf
#26560:20151028:185412.799 agent #0 started [main process]
#26564:20151028:185412.800 agent #4 started [listener #3]
#26563:20151028:185412.800 agent #3 started [listener #2]
#26565:20151028:185412.800 agent #5 started [active checks #1]
#26562:20151028:185412.801 agent #2 started [listener #1]
#至此,linux下zabbix客户端安装完毕
#提示:Zabbix Agent安装(Windows)
C:\Windows\System32>\zabbix\bin\win64\zabbix_agentd.exe -h
64位系统就切到win64目录
C:\Windows\System32>\zabbix\bin\win64\zabbix_agentd.exe -i -c \zabbix\conf\zabbix_agentd.win.conf
###################################################################
成平
http10.0.0.61zabbixdashboard.phpsid=d8b9b04319f21b46