天天看点

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

一、简介

        Lepus(天兔)数据库企业监控系统是一套由专业DBA针对互联网企业开发的一款专业、强大的企业数据库监控管理系统,企业通过Lepus可以对数据库的实时健康和各种性能指标进行全方位的监控。目前已经支持MySQL、Oracle、MongoDB、Redis数据库的全面监控。

        Lepus可以在数据库出现故障或者潜在性能问题时,根据用户设置及时将数据库的异常进行报警通知到数据库管理员进行处理和优化,帮助企业解决数据库性能监控问题,及时发现性能和瓶颈,避免由数据库潜在问题造成的直接经济损失。

        Lepus能够查看各种实时性能状态指标,并且对监控、性能数据进行统计分析,从运维者到决策者多个层面的视角,查看相关报表,帮助决策者对未来数据库容量进行更好的规划,从而降低了硬件成本。

1、官网:http://www.lepus.cc/

2、官方文档:http://www.dbarun.com/

3、下载地址:

http://www.lepus.cc/soft/index

二、基础环境

1、VMware 版本:VMware Workstation Pro15

2、系统说明

系统:CentOS-7-x86_64-Minimal-1708

下载地址: 

 http://archive.kernel.org/centos-vault/7.4.1708/isos/x86_64/   

3、安装虚拟机

安装过程可参考:

https://blog.csdn.net/llwy1428/article/details/89328381

4、工具:xshell5

三、安装部署

1、虚拟机网络配置

https://blog.csdn.net/llwy1428/article/details/85058028

2、安装基本工具

[[email protected] ~]# yum install -y wget zip unzip git php httpd net-tools mariadb* python-dev*  epel-release

3、永久关闭 SELINUX(重启生效)

https://blog.csdn.net/llwy1428/article/details/100938748

临时关闭 SELINUX

[[email protected] ~]# setenforce 0

4、关闭防火墙

关闭防火墙    : systemctl stop firewalld
查看状态      : systemctl status firewalld
开机禁用      : systemctl disable firewalld
           

其他防火墙操作请参考

https://blog.csdn.net/llwy1428/article/details/99676257

5、安装  MariaDb(Mysql)数据库

https://blog.csdn.net/llwy1428/article/details/84965680

6、下载安装 Lepus

(1)创建目录

[[email protected] ~]# mkdir /opt/lepus/

[[email protected] ~]# cd /opt/lepus/

(2)下载 Lepus 文件

[[email protected] ~]# wget http://www.lepus.cc/soft/download/18

(3)解压

[[email protected] lepus]# unzip 18

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

(4)在监控机创建监控数据库,并授权。

[[email protected] ~]# mysql -uroot -proot

MariaDB [(none)]> create database lepus default character set utf8;

MariaDB [(none)]> flush privileges;

MariaDB [(none)]> exit;

[[email protected] ~]# mysql -uroot -p lepus < /opt/lepus/mysql -uroot -p lepus < /opt/lepus/lepus/sql/lepus_table.sql/sql/lepus_table.sql

Enter password:root

[[email protected] ~]# mysql -uroot -p lepus < /opt/lepus/mysql -uroot -p lepus < /opt/lepus/lepus/sql/lepus_table.sql/sql/lepus_data.sql

Enter password:root

(5)可以使用 Navicat 等第三方工具查看导入的初始表

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

(6)执行 Lepus 的安装脚本

[[email protected] ~]# cd /opt/lepus/Lepus_v3.8_beta/python/

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

(7)修改权限

[[email protected] python]# chmod +x ./install.sh

(8)执行脚本

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

(9)修改配置文件

[[email protected] ~]# cd /usr/local/lepus/

[[email protected] lepus]# vim etc/config.ini

###被监控机MySQL数据库连接地址###
[monitor_server]
# 数据库(集群)所在节点的 ip 地址
host="192.168.11.61"
port=3306
user="root"
passwd="root"
dbname="lepus"
           

(10)创建超链接

[[email protected] lepus]# ln -s /usr/local/lepus/lepus /etc/init.d/

7、下载并配置  MySQL-python

(1)进入指定目录

[[email protected] ~]# cd /opt/lepus/

(2)下载工具 https://pypi.org/project/MySQL-python

[[email protected] lepus]# wget https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip

(3)解压缩

[[email protected] lepus]# unzip MySQL-python-1.2.5.zip

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

[[email protected] ~]# cd /opt/lepus/MySQL-python-1.2.5

(4)查找 mysql_config 文件位置

[[email protected] ~]# which mysql_config

/usr/bin/mysql_config

(5)编辑配置文件  site.cfg

[[email protected] ~]# vim /opt/lepus/MySQL-python-1.2.5/site.cfg

(6)最后增加一行

mysql_config = /usr/bin/mysql_config

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

(7)安装依赖

[[email protected] MySQL-python-1.2.5]# yum install -y python-pip python-devel

(8)更改权限

[[email protected] MySQL-python-1.2.5]# chmod 755 setup.py

(9)执行编译

[[email protected] MySQL-python-1.2.5]# python setup.py build

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

(10)执行安装

[[email protected] MySQL-python-1.2.5]# python setup.py install

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta
记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

8、测试 Lepus 是否安装成功

(1)进入安装后的 lepus 目录

[[email protected] ~]# cd /usr/local/lepus/

(2)更改权限

[[email protected] lepus]# chmod 755 test_driver_mysql.py

(3)执行测试脚本

[[email protected] lepus]# ./test_driver_mysql.py 

MySQL python drivier is ok!

9、启动 Lepus 服务

[[email protected] ~]# cd /usr/local/lepus/

[[email protected] lepus]# ./lepus start

lepus server start success!

查看帮助

[[email protected] lepus]# ./lepus --help

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

10、配置  WEB  管理

(1)进入源码路径中,找到 web 页面相关文件

[[email protected] ~]# cd /opt/lepus/Lepus_v3.8_beta/php/

[[email protected] php]# ll

total 12

drwxr-xr-x. 15 root root  215 May  1  2016 application

-rw-r--r--.  1 root root 6604 Jan 23  2016 index.php

-rw-r--r--.  1 root root 2547 Jan 23  2016 license.txt

drwxr-xr-x.  8 root root  130 May  1  2016 system

(2)复制 web 页面相关文件到 /var/www/html/  (httpd的默认路径)

[[email protected] php]# cp -a . /var/www/html/

[[email protected] ~]# ll /var/www/html/

total 12

drwxr-xr-x. 15 root root  215 May  1  2016 application

-rw-r--r--.  1 root root 6604 Jan 23  2016 index.php

-rw-r--r--.  1 root root 2547 Jan 23  2016 license.txt

drwxr-xr-x.  8 root root  130 May  1  2016 system

(3)配置 WEB 页面的数据连接

[[email protected] ~]# vim /var/www/html/application/config/database.php

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

(4)启动 httpd 服务

[[email protected] ~]# systemctl start httpd

(5)开机启动 httpd 服务

[[email protected] ~]# systemctl enable httpd

(6)查看服务启动所用的端口

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

11、浏览器查看

(1)在浏览器地址栏录入地址    http://192.168.11.61/

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

(2)默认管理员  账号/密码  admin/Lepusadmin

登录后首页

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

(3)设置监控 Mysql 数据库

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

(4)填写 Mysql 数据库连接信息

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

(5)查看监控监控状态

记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta
记一次 Centos7 安装 lepus 天兔数据库监控系统 v3.8_beta

其他状态图:略。

至此  Centos7  安装 lepus 天兔数据库监控系统,操作完毕!

参考:

https://www.cnblogs.com/ssgeek/p/9310726.html

https://blog.csdn.net/weixin_33736048/article/details/93099639

资源地址:

https://pypi.org/project/MySQL-python/