Linux部署Zabbix集中监控系统

Zabbix是一个基于Web界面的分布式系统监控与网络设备监控系统,它能够监控各种网络参数,并提供灵活的通知机制,以使管理员能快速定位故障并解决由zabbix server 端与zabbix agent组成,可通过SNMP、zabbix、agent 、ping、端口监视等方法实现对远程主机与网络设备的监控。

zabbix特点

支持自动发现网络设备和服务器

支持分布式监控

可设置报警阈值

可以通过多种方式进行数据收集

可定制报警方式

实时的绘图功能

通过Web监控系统与设置

zabbix官网: https://www.zabbix.com

系统环境 主机IP服务
监控端   192.168.26.161   lamp、zabbix-server  
被监控端   192.168.26.163   zabbix-agent  
实验步骤

关闭所有主机的防火墙和安全性策略

systemctl stop firewalld.service
setenforce 0 

一、Server端安装配置LAMP环境,以满足zabbix的代码部署要求 1.安装lamp相关软件包

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

2.编辑修改httpd、php配置文件

vi /etc/httpd/conf/httpd.conf
ServerName
DirectoryIndex index.html index.php

vi /etc/php.ini
date.timezone = PRC    //设置中国时区

3.启动http服务与mariadb服务

systemctl start httpd.service
systemctl start mariadb.service

netstat -ntap | egrep '(80|3306)'  //查看端口

4.MySQL初始化安装 mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): // 回车键
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

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] n    //是否移除anonymous用户
 ... skipping.

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] n      //是否允许root用户远程登录
 ... skipping.

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] n    //是否移除test数据库
 ... skipping.

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!

5.登录mysql,创建zabbix数据库及创建zabbix用户并设置密码

mysql -u root -p

CREATE DATABASE zabbix character set utf8 collate utf8_bin;
GRANT all privileges ON *.* TO 'zabbix'@'%' IDENTIFIED BY 'admin123';
flush privileges;

6.创建mysql数据库的测试网页文件

vi /var/www/html/index.php

<?php
phpinfo();
$link=mysql_connect('192.168.26.161','zabbix','admin123');
if($link) echo "<h1>Success!!</h1>";
else echo "Fail!!";
mysql_close();
?>

部署Zabbix集中监控系统

7.客户端访问index.php网页

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/9854404210366d3dab02b5288775f1f4.html