Zabbix监控安装部署及警报配置
主机环境 RedHat6.5 64位
实验环境 服务端1 ip172.25.25.1 主机名:server1.example.com
服务端2 ip172.25.25.2 主机名:server2.example.com
安装包 alert-agent-4.1.3.1-linux-x64.tar.gz
fping-2.4b2-16.el6.x86_64.rpm
iksemel-1.4-2.el6.x86_64.rpm
iksemel-utils-1.4-2.el6.x86_64.rpm
php-bcmath-5.3.3-26.el6.x86_64.rpm
php-mbstring-5.3.3-26.el6.x86_64.rpm
zabbix-2.4.5-1.el6.x86_64.rpm
zabbix-agent-2.4.5-1.el6.x86_64.rpm
zabbix-get-2.4.5-1.el6.x86_64.rpm
zabbix-server-2.4.5-1.el6.x86_64.rpm
zabbix-server-mysql-2.4.5-1.el6.x86_64.rpm
zabbix-web-2.4.5-1.el6.noarch.rpm
zabbix-web-mysql-2.4.5-1.el6.noarch.rpm
防火墙状态:关闭
Selinux状态:Disabled
1.Zabbix的安装及简单的配置
服务端1
A)安装zabbix
[root@sever1 zabbix]# yum install zabbix-2.4.5-1.el6.x86_64.rpmzabbix-agent-2.4.5-1.el6.x86_64.rpm zabbix-get-2.4.5-1.el6.x86_64.rpmzabbix-server-2.4.5-1.el6.x86_64.rpm zabbix-server-mysql-2.4.5-1.el6.x86_64.rpmzabbix-web-2.4.5-1.el6.noarch.rpm zabbix-web-mysql-2.4.5-1.el6.noarch.rpmfping-2.4b2-16.el6.x86_64.rpm iksemel-1.4-2.el6.x86_64.rpm iksemel-utils-1.4-2.el6.x86_64.rpm php-* -y #安装zabbix
B)配置mysql数据库
[root@server1 ~]# mysql -predhat
mysql> create database zabbix1 character set utf8 collateutf8_bin;
Query OK, 1 row affected (0.00 sec) #创建zabbix数据库
mysql> grant all privileges on zabbix1.* to zabbix@localhostidentified by 'redhat';
Query OK, 0 rows affected (0.00 sec) #给zabbix数据库授权
mysql> Ctrl-C -- exit!
[root@server1 ~]# mysql -uzabbix -predhat #用新创建的用户测试登陆
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| zabbix1 |
+--------------------+
2 rows in set (0.00 sec)
mysql> Ctrl-C -- exit!
[root@server1 mysql]# cd/usr/share/doc/zabbix-server-mysql-2.4.5/create/
[root@server1 create]# ls
data.sql images.sql schema.sql
#将文件导入数据库
[root@server1 create]# mysql -uzabbix -predhat zabbix1<schema.sql
[root@server1 create]# mysql -uzabbix -predhat zabbix1<images.sql
[root@server1 create]# mysql -uzabbix -predhat zabbix1 <data.sql
[root@server1 zabbix]# cd /etc/httpd/conf.d/
C)配置zabbix server和zabbix agent
[root@server1 conf.d]# vim zabbix.conf #修改时区
php_value date.timezoneAsia/Shanghai
[root@server1 create]# cd /etc/zabbix/
[root@server1 zabbix]# vim zabbix_server.conf #将zabbix数据库的信息添加进去
DBName=zabbix1
DBUser=zabbix
DBPassword=redhat
[root@server1 zabbix]# vim zabbix_agentd.conf #修改主机名
Hostname=server1.example.com
D)启动zabbix-serverzabbix-agent httpd
[root@server1 conf.d]# /etc/init.d/zabbix-server start
Starting Zabbix server: [ OK ]
[root@server1 zabbix]# /etc/init.d/zabbix-agent start
Starting Zabbix agent: [ OK ]
[root@server1 conf.d]# /etc/init.d/httpd start
Starting httpd: [ OK ]
E)访问172.25.25.1/zabbix
如图:点击next
如图: 数据库名字,用户,密码(刚才在数据库里新建的),点击Test Connection检测是否连接数据库(ok表示已连接),点击next
Name可以随意填写,点击next
之后点击finsh,登陆:用户名 :Admin 密码:zabbix
登陆进去,如图: