Zabbix实战部署

栏目: 服务器 · 发布时间: 7年前

内容简介:Zabbix实战部署Zabiix是一个高度集成的企业级开源网络监控解决方案 ,提供分布式监控及集中的web管理界面。部署准备:

Zabbix实战部署

Zabiix是一个高度集成的企业级开源网络监控解决方案 ,提供分布式监控及集中的web管理界面。

部署准备:

Zabbix实战部署

关闭防火墙和安全linux

[root@localhost ~]# systemctl stop firewalld

[root@localhost ~]# setenforce 0

Zabbix通过c/s模式采集数据,通过b/s模式在web端展示和配置,需要使用LAMP平台来承载数据库和web界面。

部署:

1.本地仓库yum安装LAMP平台

[root@localhost ~]# yum install -y httpd mariadb-server mariadb php php-mysql php-gd libjpeg

php-ldap php-odbc php-pear php-xml php-xmlrpc php-mhash

[root@localhost ~]# vi /etc/httpd/conf/httpd.conf

Zabbix实战部署

[root@localhost ~]# vi /etc/php.ini //时区修改为中国PRC

Zabbix实战部署

开启httpd服务与数据库:

[root@localhost ~]# systemctl start httpd

[root@localhost ~]# systemctl start mariadb

查看httpd服务与数据库是否开启

[root@localhost ~]# netstat -anpt | grep 80

LISTEN 1102/httpd

[root@localhost ~]# netstat -anpt | grep 3306

tcp 0 0 0.0.0.0:3306 0.0.0.0:

LISTEN 1355/mysqld

[root@localhost ~]# mysql_secure_installation //初始化数据库,系统自带命令

设置密码,后面(y/n):选y。

Zabbix实战部署

MariaDB [(none)]> CREATE DATABASE zabbix character set utf8 collate utf8_bin;

TO 'zabbix'@'%' IDENTIFIED BY 'admin123';

MariaDB [(none)]> flush privileges; //创建zabbix数据库,开启权限及远程登陆账号及密码,刷新权限

MariaDB [(none)]> exit //退出

[root@localhost ~]# vi /var/www/html/index.php

$link=mysql_connect('192.168.100.20','zabbix','admin123');

if($link) echo "

Success!!

";

else echo "Fail!!";

mysql_close();

?> //http:192.168.100.20验证 php 连接数据库是否正常

Zabbix实战部署

测试成功!!!搭建LAMP平台成功

2.部署zabbix-server服务器(192.168.100.20上操作)

[root@localhost ~]# vi /etc/yum.repos.d/CentOS-Base.repo //添加阿里云源区域

[Ali]

name=CentOS-$releasever - Base

baseurl= http://mirrors.aliyun.com/centos/$releasever/os/$basearch/

gpgcheck=1

gpgkey= http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

[root@localhost ~]# systemctl restart network //重启网卡,添加一张桥接模式网卡

[root@localhost ~]# ping www.baidu.com //确保网络畅通

PING www.a.shifen.com (119.75.217.26) 56(84) bytes of data.

64 bytes from 119.75.217.26 (119.75.217.26): icmp_seq=1 ttl=50 time=25.2 ms

64 bytes from 119.75.217.26 (119.75.217.26): icmp_seq=2 ttl=50 time=26.4 ms

[root@localhost ~]# yum makecache //加载元数据缓存

[root@localhost ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm //自动生成yum源文件,需保证系统可以上网

[root@localhost ~]# yum install -y php-mbstring php-bcmath //安装必备插件

[root@localhost ~]# yum install zabbix-server-mysql zabbix-web-mysql –y //安装zabbix服务器和web页面支持

[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql-4.0.0/create.sql.gz | mysql -uzabbix -p zabbix //导入zabbix监控数据库

Enter password: //输入admin123 ,上面授权的密码

[root@localhost ~]# grep -n '^'[a-Z] /etc/zabbix/zabbix_server.conf //查看未注释行

[root@localhost ~]# vi /etc/zabbix/zabbix_server.conf

DBPassword=admin123 //125行去掉注释添加密码,只需要修改这一行

[root@localhost ~]# vi /etc/httpd/conf.d/zabbix.conf //修改时区

php_value date.timezone Asia/Shanghai //去掉前面注释,改成上海

[root@localhost ~]# systemctl enable zabbix-server //设置zabbix自启

[root@localhost ~]# systemctl start zabbix-server //启动zabbix服务器

[root@localhost ~]# netstat -anpt | grep zabbix //工作在10051端口上

[root@localhost ~]# systemctl restart httpd.service //重启httpd服务

http:192.168.100.20/zabbix/ //安装后登陆,用户名及密码默认Admin:zabbix

Zabbix实战部署

点Next step安装

Zabbix实战部署

密码还是admin123

Zabbix实战部署 Zabbix实战部署 Zabbix实战部署 Zabbix实战部署

成功进入zabbix服务器监控页面

3.部署zabbix-agent客户机(192.168.100.60上操作)

[root@localhost ~]# vi /etc/yum.repos.d/CentOS-Base.repo //添加阿里云源区域

[Ali]

name=CentOS-$releasever - Base

baseurl= http://mirrors.aliyun.com/centos/$releasever/os/$basearch/

gpgcheck=1

gpgkey= http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

[root@localhost ~]# systemctl restart network //重启网卡,添加一张桥接模式网卡

[root@localhost ~]# ping www.baidu.com //确保网络畅通

PING www.a.shifen.com (119.75.217.26) 56(84) bytes of data.

64 bytes from 119.75.217.26 (119.75.217.26): icmp_seq=1 ttl=50 time=25.2 ms

64 bytes from 119.75.217.26 (119.75.217.26): icmp_seq=2 ttl=50 time=26.4 ms

[root@localhost ~]# yum makecache //加载元数据缓存

[root@localhost ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm //自动生成yum源文件,需保证系统可以上网

[root@localhost ~]# yum install -y zabbix-agent //下载zabbix客户端

Zabbix实战部署 Zabbix实战部署

[root@localhost ~]# systemctl enable zabbix-agent.service //开机自启

[root@localhost ~]# systemctl restart zabbix-agent.service //重启zabbix客户端

[root@localhost ~]# netstat -anpt | grep zabbix //默认工作在10050端口上

到这192.168.100.60zabbix客户机就配置好了我们到web界面监控

Zabbix实战部署 Zabbix实战部署

***注意先选小“加”在添加蓝色的“加”才算添加成功

Zabbix实战部署

成功添加被监控主机

下面我们在zabbix-agent客户机安装好httpd服务

[root@localhost ~]# yum install -y httpd

[root@localhost ~]# systemctl start httpd

Zabbix实战部署

开启成功

我们到zabbix-server Web界面看是否警告解除

Zabbix实战部署

明显没有警告了,,警告解除。到此我们的zabbix监控部署就完成了,还有细节方面各种监控都可以自己探索


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Programming Python

Programming Python

Mark Lutz / O'Reilly Media / 2006-8-30 / USD 59.99

Already the industry standard for Python users, "Programming Python" from O'Reilly just got even better. This third edition has been updated to reflect current best practices and the abundance of chan......一起来看看 《Programming Python》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器