企业级监控软件zabbix搭建部署之zabbix server的安装
环境:
Server:CentOS6.3_X86.64
Zabbix:zabbix-2.0.8.tar
Zabbix_agents:zabbix_agents_2.0.8.linux2_6.amd64.tar
服务器命名规则:
Zabbix-Server:192.168.100.239
Zabbix-Agent01:192.168.100.240
安装规划流程
1.需要根据服务器的命名规则来设置你的服务器的名字;
2.关闭防火墙,需要注意的是,可以根据自己设置的zabbix的Server端口和Agents的端口来开启防火墙
3.关闭Selinux
4.安装LAMP/LNMP
5.安装zabbixServer/Agetns
5.1.安装ZabbixServer---------------------------------成功 文档已写
5.2.在web页面中配置zabbixServer-------------------------成功 文档已写
5.3.安装zabbixAgents---------------------------------成功  文档已写
6.配置自定义监控模板
7.添加配置Zabbix的第一个agent
7.1.1.添加配置zabbix的第一个linux的agent---------------------------------成功  文档已写
7.1.2.添加配置zabbix的第一个windows的agents   --------------------------------
7.1.3.配置创建拓扑图---------------------------------成功  需要写PDF,相对比较简单
7.1.4.创建筛选拓扑图---------------------------------成功  需要写PDF,相对比较简单
7.1.5.针对添加的agents来自定义选择服务器的,模板
7.1.6.zabbix自定义添加监控端口,服务
8.配置zabbix触发器,以及拓扑图
9.配置Zabbix邮箱报警机制
10.配置zabbix短信报警
11.zabbbix的标准化,流程化
12.zabbix的资产管理报表审计功能
实施部署;
部署搭建ZabbixServer
01.命名服务器规则
[root@localhost ~]# hostname
Zabbix-Server
[root@localhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=Zabbix-Server
[root@localhost ~]#
02.关闭防火墙和Selinux
[root@localhost ~]# /etc/rc.d/init.d/iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@localhost ~]# setenforce 0
setenforce: SELinux is disabled
[root@localhost ~]#
03.安装LAMP环境,
需要注意的是在安装之前先安装相关的依赖包,我们在此项目中使用yum来安装配置,如果有特殊需求可以使用源码来安装部署
YUM 直接来安装LAMP 需要安装gcc gcc-c++
yum -y install zlib zlib-devel glibc glibc-devel libxml2 libxml2-devel freetype freetype-devel
yum -y install mysql mysql-server php php-mysql mysql-devel php-xmlrpc  php-xml php-odbc php-gd php-bcmath  php-mbstring httpd
YUM安装SNMP
yum -y install net-snmp net-snmp-devel curl curl-devel perl-DBI
04.测试LAMP是否正常
4.1.1.修改vim /etc/httpd/conf/httpd.conf
可以做虚拟目录也可以直接来配置,我们在这里直接做成默认的就可以
4.1.2.写一个php小程序来测试php是否正常
目录在/var/www/html/下面
4.1.3.启动服务
/etc/rc.d/init.d/httpd start
/etc/rc.d/init.d/mysqld start
然后IE打开就可以正常
05.开始安装zabbix Service
05.1.创建zabbix用过户
useradd -s /sbin/nologin zabbix
05.2.开始安装配置
[root@Zabbix-Server home]# tar xf zabbix-2.0.8.tar.gz
[root@Zabbix-Server home]# cd zabbix-2.0.8
[root@Zabbix-Server zabbix-2.0.8]# mkdir /usr/local/zabbix
[root@Zabbix-Server zabbix-2.0.8]# mysqladmin -uroot password 123.com
05.3.创建mysql数据库以及授权数据库
[root@Zabbix-Server zabbix-2.0.8]# mysql -uroot -p123.com
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.61 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database zabbix;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to 'zabbix'@localhost identified by '123.com';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on zabbix.* to 'zabbix'@192.168.100.239 identified by '123.com';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
05.3.导入zabbix数据库
[root@Zabbix-Server zabbix-2.0.8]# mysql -uroot -p123.com zabbix < /home/zabbix-2.0.8/database/mysql/schema.sql 
[root@Zabbix-Server zabbix-2.0.8]# mysql -uroot -p123.com zabbix < /home/zabbix-2.0.8/database/mysql/images.sql
[root@Zabbix-Server zabbix-2.0.8]# mysql -uroot -p123.com zabbix < /home/zabbix-2.0.8/database/mysql/data.sql
05.4.安装zabbix Server
[root@Zabbix-Server zabbix-2.0.8]# ./configure --prefix=/usr/local/zabbix/ --enable-server --enable-proxy --enable-agent --with-mysql --with-net-snmp --with-libcurl
[root@Zabbix-Server zabbix-2.0.8]# make && make install
05.5.修改配置文件vim /etc/services最后面添加
zabbix-agent            10050/tcp       #Zabbix Agent
zabbix-agent            10050/udp       #Zabbix Agent
zabbix-trapper          10051/tcp       #Zabbix Trapper
zabbix-trapper          10051/udp       #Zabbix Trapper
05.6.修改zabbix Server的配置文件,修改数据库的User password
[root@Zabbix-Server zabbix-2.0.8]# vim /usr/local/zabbix/etc/zabbix_server.conf
把其中的DBUser=root换成DBUser=zabbix
添加DBPassword或者去掉注释掉的#DBPassword
DBPassword=123.com
05.7.配置启动脚本,并且给执行权限;
[root@Zabbix-Server zabbix-2.0.8]# cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
[root@Zabbix-Server zabbix-2.0.8]# sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/' /etc/init.d/zabbix_server
[root@Zabbix-Server zabbix-2.0.8]# sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/' /etc/init.d/zabbix_agentd
[root@Zabbix-Server zabbix-2.0.8]# chmod +x /etc/init.d/zabbix_server
[root@Zabbix-Server zabbix-2.0.8]# chmod +x /etc/init.d/zabbix_agentd
[root@Zabbix-Server zabbix-2.0.8]#
05.8.启动zabbix
[root@Zabbix-Server zabbix-2.0.8]# /etc/rc.d/init.d/zabbix_server start
Starting zabbix_server:                                    [  OK  ]
[root@Zabbix-Server zabbix-2.0.8]#
05.9.web页面中配置zabbixServer
[root@Zabbix-Server zabbix-2.0.8]# cp -a frontends/php/* /var/www/html/
cp: overwrite `/var/www/html/index.php'? y
[root@Zabbix-Server zabbix-2.0.8]# /etc/rc.d/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@Zabbix-Server zabbix-2.0.8]#
05.10.修改php.ini文件
处理zabbixweb中的时区错误问题
[root@Zabbix-Server zabbix-2.0.8]# sed -i 's/^post_max_size = .*/post_max_size = 16M/' /etc/php.ini
[root@Zabbix-Server zabbix-2.0.8]# sed -i 's/max_execution_time = .*/max_execution_time = 300/' /etc/php.ini
[root@Zabbix-Server zabbix-2.0.8]# sed -n 's/^max_input_time = .*/max_input_time = 300/gp' /etc/php.ini
max_input_time = 300
[root@Zabbix-Server zabbix-2.0.8]# sed -i 's/^max_input_time = .*/max_input_time = 300/' /etc/php.ini
[root@Zabbix-Server zabbix-2.0.8]#
如果改了以上,还是报上面那个错误,就改一下文件,在代码的开始行,加入ini_set(‘date.timezone’,'Asia/Shanghai’);
添加如下一行:大概在配置文件的22行之前
# vi /var/www/html/zabbix/include/page_header.php
ini_set('date.timezone','Asia/Shanghai');
05.11.重启服务
[root@Zabbix-Server zabbix-2.0.8]# /etc/rc.d/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@Zabbix-Server zabbix-2.0.8]#
[root@Zabbix-Server ~]# /etc/rc.d/init.d/zabbix_server restart
Shutting down zabbix_server:                               [  OK  ]
Starting zabbix_server:                                    [  OK  ]
[root@Zabbix-Server ~]# /etc/rc.d/init.d/zabbix_agentd restart
Shutting down zabbix_agentd:                               [FAILED]
Starting zabbix_agentd:                                    [  OK  ]
[root@Zabbix-Server ~]#
设置成开机启动服务
[root@Zabbix-Server ~]# echo "/etc/rc.d/init.d/zabbix_agentd" >> /etc/rc.local
[root@Zabbix-Server ~]# echo "/etc/rc.d/init.d/zabbix_server" >> /etc/rc.local
05.12.创建自定义模板
针对Zabbix添加模板可以做链接--例如存在模板---Template OS Linux
我们创建一个新的模板引用关联Template OS Linux这个模板就可以使用了~~~~~
然后我们在自定义我们监控的选项,还可以定义我们选择的图片
详细截图请看word文档