分布式系统监控Zabbix的安装

Linux下常用的系统监控软件有Nagios、Cacti、Zabbix、Monit等,这些开源的软件,可以帮助我们更好的
管理机器,在第一时间内发现,并警告系统维护人员。
今天开始研究下Zabbix,使用Zabbix的目的,是为了能够更好的监控mysql数据库服务器,并且能够生成
图形报表,虽然Nagios也能够生成图形报表,但没有Zabbix这么强大。
首先,我们先来介绍下Zabblx:

Zabbix简介:

zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。
zabbix由zabbix server与可选组件zabbix agent两部门组成。
zabbix server可以通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络状态的监视。
zabbix agent需要安装在被监视的目标服务器上,它主要完成对硬件信息或与操作系统有关的内存,CPU等信息的收集。

zabbix的主要特点:

 - 安装与配置简单,学习成本低
- 支持多语言(包括中文)
- 免费开源
- 自动发现服务器与网络设备
- 分布式监视以及WEB集中管理功能
- 可以无agent监视
- 用户安全认证和柔软的授权方式
- 通过WEB界面设置或查看监视结果
- email等通知功能

Zabbix主要功能:

CPU负荷
内存使用
磁盘使用
网络状况
端口监视
日志监视

官方也提供了安装资料:http://www.zabbix.com/wiki/howto/monitor
实验环境:

server3:  172.25.38.3  agent端  企业6
loaclhost: 172.25.38.11      企业7

zabbix的安装:

[root@localhost ~]# ls
fping-3.10-1.el7.x86_64.rpm
iksemel-1.4-2.el7.centos.x86_64.rpm
php-bcmath-5.4.16-21.el7.x86_64.rpm
php-common-5.4.16-21.el7.x86_64.rpm
php-mbstring-5.4.16-21.el7.x86_64.rpm
tidb-ansible-master.zip
tidb-latest-linux-amd64
tidb-latest-linux-amd64.tar.gz
zabbix-agent-3.4.6-1.el7.x86_64.rpm
zabbix-get-3.4.6-1.el7.x86_64.rpm
zabbix-java-gateway-3.4.6-1.el7.x86_64.rpm
zabbix-proxy-mysql-3.4.6-1.el7.x86_64.rpm
zabbix-server-mysql-3.4.6-1.el7.x86_64.rpm
zabbix-web-3.4.6-1.el7.noarch.rpm
zabbix-web-mysql-3.4.6-1.el7.noarch.rpm
[root@localhost ~]# yum install -y zabbix-server-mysql-3.4.6-1.el7.x86_64.rpm zabbix-web-3.4.6-1.el7.noarch.rpm zabbix-web-mysql-3.4.6-1.el7.noarch.rpm fping-3.10-1.el7.x86_64.rpm iksemel-1.4-2.el7.centos.x86_64.rpm php-*

这里写图片描述

[root@localhost zabbix]# systemctl start mariadb  开启数据库
[root@localhost zabbix]# mysql_secure_installation   初始化安装

Set root password? [Y/n] Y   设置密码
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

这里写图片描述

[root@localhost zabbix]# mysql -pwestos
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'westos'; 授权
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> quit
Bye

这里写图片描述

[root@localhost zabbix]# ls
web                 zabbix_java_gateway.conf         zabbix_server.conf
zabbix_agentd.conf  zabbix_java_gateway_logback.xml
zabbix_agentd.d     zabbix_proxy.conf
[root@localhost zabbix]# cd web/
[root@localhost web]# ls
maintenance.inc.php
[root@localhost web]# cd ..
[root@localhost zabbix]# cd zabbix_agentd.d/
[root@localhost zabbix_agentd.d]# ls
userparameter_mysql.conf
[root@localhost zabbix_agentd.d]# cd ..
[root@localhost zabbix]# cd
[root@localhost ~]# cd /etc/zabbix/
[root@localhost zabbix]# ls
web                 zabbix_java_gateway.conf         zabbix_server.conf
zabbix_agentd.conf  zabbix_java_gateway_logback.xml
zabbix_agentd.d     zabbix_proxy.conf
[root@localhost zabbix]# cd /usr/share/
[root@localhost share]# cd doc/

这里写图片描述

[root@localhost doc]# cd zabbix-server-mysql-3.4.6/
[root@localhost zabbix-server-mysql-3.4.6]# ls
AUTHORS  ChangeLog  COPYING  create.sql.gz  NEWS  README
[root@localhost zabbix-server-mysql-3.4.6]# zcat create.sql.gz | mysql -u zabbix -p zabbix
Enter password: 

这里写图片描述

[root@localhost zabbix-server-mysql-3.4.6]# ls
AUTHORS  ChangeLog  COPYING  create.sql.gz  NEWS  README
[root@localhost zabbix-server-mysql-3.4.6]# cd /etc/zabbix/
[root@localhost zabbix]# ls
web                 zabbix_java_gateway.conf         zabbix_server.conf
zabbix_agentd.conf  zabbix_java_gateway_logback.xml
zabbix_agentd.d     zabbix_proxy.conf
[root@localhost zabbix]# ls
web                 zabbix_java_gateway.conf         zabbix_server.conf
zabbix_agentd.conf  zabbix_java_gateway_logback.xml
zabbix_agentd.d     zabbix_proxy.conf
[root@localhost zabbix]# vim zabbix_server.conf

这里写图片描述
这里写图片描述

[root@localhost zabbix]# ll /var/lib/mysql/mysql.sock 
srwxrwxrwx 1 mysql mysql 0 Aug 14 15:15 /var/lib/mysql/mysql.sock
[root@localhost zabbix]# cd /etc/httpd/
[root@localhost httpd]# ls
conf  conf.d  conf.modules.d  logs  modules  run
[root@localhost httpd]# cd conf.d/
[root@localhost conf.d]# ls
autoindex.conf  php.conf  README  userdir.conf  welcome.conf  zabbix.conf
[root@localhost conf.d]# vim zabbix.conf 

这里写图片描述

[root@localhost conf.d]# systemctl start zabbix-server
[root@localhost conf.d]# systemctl start httpd

这里写图片描述

[root@localhost conf.d]# getenforce 
Disabled
[root@localhost conf.d]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
[root@localhost conf.d]# cd
[root@localhost ~]# ls
fping-3.10-1.el7.x86_64.rpm
iksemel-1.4-2.el7.centos.x86_64.rpm
php-bcmath-5.4.16-42.el7.x86_64.rpm
php-mbstring-5.4.16-42.el7.x86_64.rpm
zabbix-agent-3.4.6-1.el7.x86_64.rpm
zabbix-get-3.4.6-1.el7.x86_64.rpm
zabbix-java-gateway-3.4.6-1.el7.x86_64.rpm
zabbix-proxy-mysql-3.4.6-1.el7.x86_64.rpm
zabbix-server-mysql-3.4.6-1.el7.x86_64.rpm
zabbix-web-3.4.6-1.el7.noarch.rpm
zabbix-web-mysql-3.4.6-1.el7.noarch.rpm
[root@localhost ~]# yum install zabbix-agent-3.4.6-1.el7.x86_64.rpm
[root@localhost ~]# systemctl start zabbix-agent

这里写图片描述
在浏览器进行安装配置zabbix:
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值