1. 程式人生 > >強大的開源企業級資料庫監控利器Lepus

強大的開源企業級資料庫監控利器Lepus

Lepus監控簡單介紹

官方網站:http://www.lepus.cc

開源企業級資料庫監控系統

簡潔、直觀、強大的開源資料庫監控系統,MySQL/Oracle/MongoDB/Redis一站式效能監控,讓資料庫監控更簡單

Git倉庫地址:https://gitee.com/ruzuojun/Lepus

簡單介紹:

Lepus(天兔)資料庫企業監控系統是一套由專業DBA針對網際網路企業開發的一款專業、強大的企業資料庫監控管理系統,企業通過Lepus可以對資料庫的實時健康和各種效能指標進行全方位的監控。目前已經支援MySQL、Oracle、MongoDB、Redis資料庫的全面監控. Lepus可以在資料庫出現故障或者潛在效能問題時,根據使用者設定及時將資料庫的異常進行報警通知到資料庫管理員進行處理和優化,幫助企業解決資料庫效能監控問題,及時發現效能和瓶頸,避免由資料庫潛在問題造成的直接經濟損失。Lepus能夠檢視各種實時效能狀態指標,並且對監控、效能資料進行統計分析,從運維者到決策者多個層面的視角,檢視相關報表。幫助決策者對未來資料庫容量進行更好的規劃,從而降低了硬體成本。

安裝所需的基礎環境

Xampp下載地址:https://www.apachefriends.org/download.html

[[email protected] ~]# ll

total 781780

-rw-r--r--  1 root root  6760286 Dec 11  2017 Lepus資料庫企業監控系統3.7版本官方下載.zip

-rw-r--r--  1 root root 139708140 Dec 11  2017 xampp-linux-x64-5.6.32-0-installer.run

###準備好相關軟體


官方提供的整合指令碼安裝

[[email protected] ~]# chmod +x ./xampp-linux-x64-5.6.32-0-installer.run

[[email protected] ~]# ll xampp-linux-x64-5.6.32-0-installer.run

-rwxr-xr-x 1 root root 139708140 Dec 11  2017 xampp-linux-x64-5.6.32-0-installer.run

[[email protected] ~]# ./xampp-linux-x64-5.6.32-0-installer.run

安裝所需的python模組

https://github.com/farcepest/MySQLdb1/archive/master.zip 下載地址

安裝依賴包

[[email protected] ~]# yum install gcc gcc-c++ python-devel -y-y    

#安裝依賴包

安裝python-mysql模組

注:此模組也可以在後面配置監控MYSQL時安裝

[[email protected] ~]# unzip MySQLdb1-master.zip

[[email protected] ~]# cd MySQLdb1-master

[[email protected] MySQLdb1-master]# which mysql_config

/usr/local/mysql/bin/mysql_config

[[email protected] MySQLdb1-master]# vim site.cfg

[options]

# The path to mysql_config.

# Only use this if mysql_config is not on your PATH, or you have some weird

# setup that requires it.

mysql_config = /usr/local/mysql/bin/mysql_config

修改配置同上

[[email protected] MySQLdb1-master]# python setup.py build

Traceback (most recent call last):

File "setup.py", line 7, in <module>

import setuptools

ImportError: No module named setuptools

安裝過程報錯解決方案

http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz

下載setuptols安裝

[[email protected] ~]# tar zxf setuptools-0.6c11.tar.gz

[[email protected] ~]# cd setuptools-0.6c11

[[email protected] setuptools-0.6c11]# python setup.py install

繼續安裝

至此相關的基礎環境與所需的相關模組安裝完成

安裝配置Lepus監控服務

建立資料庫並授權使用者

mysql> create database lepus default character set utf8;

Query OK, 1 row affected (0.06 sec)


mysql> grant all privileges on lepus.* to [email protected]"192.168.22.%" identified by '123456';

Query OK, 0 rows affected, 1 warning (0.09 sec)


mysql> flush privileges;

Query OK, 0 rows affected (0.09 sec)


初始化資料庫

[[email protected] ~]# unzip Lepus資料庫企業監控系統3.7版本官方下載.zip

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

Enter password:

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

Enter password:

各資料庫說明:http://www.dbarun.com/docs/lepus/appendix/database/


測試模組連線

[[email protected] lepus_v3.7]# cd python/

[[email protected] python]# python test_driver_mysql.py

libmysqlclient.so.20:cannot open shared object file:No such file or directory

###出現報錯

[[email protected] python]# find / -name "libmysqlclient.so.20"

/usr/local/mysql-5.7.17-linux-glibc2.5-x86_64/lib/libmysqlclient.so.20

[[email protected] python]# ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib64/


安裝Lepus

[[email protected] ~]# cd lepus_v3.7/

[[email protected] lepus_v3.7]# cd python/

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

[[email protected] python]# ./install.sh

[note] lepus will be install on basedir: /usr/local/lepus

[note] /usr/local/lepus directory does not exist,will be created.

[note] /usr/local/lepus directory created success.

[note] wait copy files.......

[note] change script permission.

[note] create links.

[note] install complete.


修改配置檔案

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

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

###監控機MySQL資料庫連線地址###

[monitor_server]

host="192.168.22.171"

port=3306

user="lepus"

passwd="123456"

dbname="lepus"

啟動服務

[[email protected] lepus]# lepus start

nohup: appending output to `nohup.out'

lepus server start success!


配置Lepus的WEB管理端

拷貝PHP程式檔案

[[email protected] lepus_v3.7]# cp -ra php/* /opt/lampp/htdocs/

cp: overwrite `/opt/lampp/htdocs/index.php'? y

[[email protected] lepus_v3.7]# cd /opt/lampp/htdocs/

[[email protected] htdocs]# ll

total 72

drwxr-xr-x 15 root   root    4096 Feb  9  2015 application

-rw-r--r--  1 root   root    3607 Feb 27  2017 applications.html

-rw-r--r--  1 root   root     177 Feb 27  2017 bitnami.css

drwxr-xr-x 20 root   root    4096 Dec  8 08:07 dashboard

-rw-r--r--  1 root   root   30894 May 11  2007 favicon.ico

drwxr-xr-x  2 root   root    4096 Dec  8 08:07 img

-rw-r--r--  1 root   root    6605 Feb  9  2015 index.php

-rw-r--r--  1 root   root    2547 Feb  9  2015 license.txt

drwxr-xr-x  8 root   root    4096 Feb  9  2015 system

drwxr-xr-x  2 daemon daemon  4096 Dec  8 08:07 webalizer

配置資料庫連線配置檔案

[[email protected] htdocs]# vim application/config/database.php

$active_group = 'default';

$active_record = TRUE;

$db['default']['hostname'] = '192.168.22.171';

$db['default']['port']     = '3306';

$db['default']['username'] = 'lepus';

$db['default']['password'] = '123456';

$db['default']['database'] = 'lepus';

$db['default']['dbdriver'] = 'mysql';

登陸WEB管理後臺

注:此報錯3.7版本存在,升級到3.8版本後沒有出現,其它版本不清楚


解決方案如下

[[email protected] ~]# vim /opt/lampp/htdocs/system/core/Common.php +257

註釋原來的配置  #return $_config[0] =& $config;

修改成  $_config[0] = & $config;return $_config[0];


Admin/Lepusadmin 登入後進行修改

至此整個安裝與過程結束.


原文地址:

https://mp.weixin.qq.com/s?__biz=MzI0MDQ4MTM5NQ==&mid=2247485130&idx=1&sn=3cf2865a83e42d7e40f5933ce2acc81f&chksm=e91b63d6de6ceac016157af4181bf34fa104f926a8e6c71a08f04f806649952a8d066e04e52d&mpshare=1&scene=23&srcid=0226twy22hgPrTc3x4uIUXqv#rd


這個工具還是不錯的,可以對系統應用中的 :Mysql,Redis,MongoDB 等做很好的監控。