官方網站:http://www.lepus.cc 開源企業級數據庫監控系統 簡潔、直觀、強大的開源數據庫監控系統,MySQL/Oracle/MongoDB/Redis一站式性能監控,讓數據庫監控更簡單 Git倉庫地址:https://gitee.com/ruzuojun/Lepusphp
簡單介紹: Lepus(天兔)數據庫企業監控系統是一套由專業DBA針對互聯網企業開發的一款專業、強大的企業數據庫監控管理系統,企業經過Lepus能夠對數據庫的實時健康和各類性能指標進行全方位的監控。目前已經支持MySQL、Oracle、MongoDB、Redis數據庫的全面監控. Lepus能夠在數據庫出現故障或者潛在性能問題時,根據用戶設置及時將數據庫的異常進行報警通知到數據庫管理員進行處理和優化,幫助企業解決數據庫性能監控問題,及時發現性能和瓶頸,避免由數據庫潛在問題形成的直接經濟損失。Lepus可以查看各類實時性能狀態指標,而且對監控、性能數據進行統計分析,從運維者到決策者多個層面的視角,查看相關報表。幫助決策者對將來數據庫容量進行更好的規劃,從而下降了硬件成本。css
1.1.1:下載軟件: Xampp下載地址:https://www.apachefriends.org/download.htmlhtml
[root@mysql-m ~]# ll
1 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
複製代碼
準備好相關軟件python
1.1:2:官方提供的集成環境腳本安裝mysql
[root@mysql-m ~]# chmod +x ./xampp-linux-x64-5.6.32-0-installer.run
[root@mysql-m ~]# 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
[root@mysql-m ~]# ./xampp-linux-x64-5.6.32-0-installer.run
複製代碼
https://github.com/farcepest/MySQLdb1/archive/master.zip 下載地址 1.2.1:安裝依賴包linux
[root@mysql-m ~]# yum install gcc gcc-c++ python-devel -y-y
複製代碼
安裝依賴包c++
1.2.2:安裝python-mysql模塊 注:此模塊也能夠在後面配置監控MYSQL時安裝git
[root@mysql-m ~]# unzip MySQLdb1-master.zip
[root@mysql-m ~]# cd MySQLdb1-master
[root@mysql-m MySQLdb1-master]# which mysql_config
/usr/local/mysql/bin/mysql_config
[root@mysql-m 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
修改配置同上
[root@mysql-m 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
複製代碼
1.2.3:安裝過程報錯解決方案 http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz 下載setuptols安裝github
[root@mysql-m ~]# tar zxf setuptools-0.6c11.tar.gz
[root@mysql-m ~]# cd setuptools-0.6c11
[root@mysql-m setuptools-0.6c11]# python setup.py install
複製代碼
繼續安裝便可
1.3.1:建立數據庫並受權用戶web
mysql> create database lepus default character set utf8;
Query OK, 1 row affected (0.06 sec)
mysql> grant all privileges on lepus.* to lepus@"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)
複製代碼
1.3.2:初始化數據庫
[root@mysql-m ~]# unzip Lepus數據庫企業監控系統3.7版本官方下載.zip
[root@mysql-m sql]# mysql -uroot -p lepus < ./lepus_table.sql
Enter password:
[root@mysql-m sql]# mysql -uroot -p lepus < ./lepus_data.sql
Enter password:
複製代碼
各數據庫說明:http://www.dbarun.com/docs/lepus/appendix/database/
1.3.3:安裝Lepus軟件
[root@mysql-m lepus_v3.7]# cd python/
[root@mysql-m python]# python test_driver_mysql.py
libmysqlclient.so.20: cannot open shared object file: No such file or directory
[root@mysql-m python]# find / -name "libmysqlclient.so.20"
/usr/local/mysql-5.7.17-linux-glibc2.5-x86_64/lib/libmysqlclient.so.20
[root@mysql-m python]# ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib64/
複製代碼
測試鏈接
[root@mysql-m python]# python test_driver_mysql.py
MySQL python drivier is ok!
複製代碼
安裝Lepus
[root@mysql-m ~]# cd lepus_v3.7/
[root@mysql-m lepus_v3.7]# cd python/
[root@mysql-m python]# chmod +x install.sh
[root@mysql-m 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.
複製代碼
1.3.4:修改配置文件
[root@mysql-m python]# cd /usr/local/lepus/
[root@mysql-m python]# vim etc/config.ini
###監控機MySQL數據庫鏈接地址###
[monitor_server]
host="192.168.22.171"
port=3306
user="lepus"
passwd="123456"
dbname="lepus"
複製代碼
啓動服務
[root@mysql-m lepus]# lepus start
nohup: appending output to `nohup.out'
lepus server start success!
複製代碼
1.4.1:拷貝PHP程序文件
[root@mysql-m lepus_v3.7]# cp -ra php/* /opt/lampp/htdocs/
cp: overwrite `/opt/lampp/htdocs/index.php'? y
[root@mysql-m lepus_v3.7]# cd /opt/lampp/htdocs/
[root@mysql-m 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
複製代碼
1.4.2:配置數據庫鏈接配置文件
[root@mysql-m 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';
複製代碼
1.4.3:登錄WEB管理後臺
Admin/Lepusadmin 登陸後進行修改