lepus(天兔)
概念:是一套开源的数据库监控平台,目前支持mysql oracle SqlServer redis mongdb 等数据库监控和警告
要求:安装lepus并监控mysql
搭建lepus需要(lamp)
1、安装lamp和依赖关系
[root@localhost ~]# yum -y install httpd php php-mysql mariadb-server mariadb-devel python-devel gcc gcc-c++
2、安装python的基础模块
[root@localhost ~]# unzip MySQL-python-1.2.5.zip
[root@localhost ~]# cd MySQL-python-1.2.5/
[root@localhost MySQL-python-1.2.5]# which mysql_config
/usr/bin/mysql_config
[root@localhost MySQL-python-1.2.5]# vim site.cfg
13 mysql_ config = /usr/bin/mysql_config
[root@localhost MySQL-python-1.2.5]# cd
[root@localhost ~]# tar -zxf pip-19.3.1.tar.gz
[root@localhost ~]# cd pip-19.3.1/
[root@localhost pip-19.3.1]# python setup.py build
[root@localhost pip-19.3.1]# python setup.py install
[root@localhost pip-19.3.1]# cd /root/MySQL-python-1.2.5/
[root@localhost MySQL-python-1.2.5]# python setup.py build
[root@localhost MySQL-python-1.2.5]# python setup.py install
[root@localhost MySQL-python-1.2.5]# cd
[root@localhost ~]# unzip Lepus-3.7.zip
[root@localhost python]# python test_driver_mysql.py
MySQL python drivier is ok!
3、安装lepus的采集器
[root@localhost python]# systemctl start mariadb.service
[root@localhost python]# mysqladmin -uroot password '123456';
[root@localhost python]# mysql -uroot -p123456
MariaDB [(none)]> create database lepus default character set utf8;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on lepus.* to 'lepus'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
[root@localhost python]# cd ../sql/
[root@localhost sql]# mysql -u lepus -p123456 lepus < lepus_table.sql
[root@localhost sql]# mysql -u lepus -p123456 lepus < lepus_data.sql
[root@localhost sql]# cd ../python/
[root@localhost python]# chmod +x install.sh
[root@localhost python]# ./install.sh
[root@localhost python]# cd /usr/local/lepus/
[root@localhost lepus]# vim etc/config.ini
###监控机MySQL数据库连接地址###
[monitor_server]
host="127.0.0.1"
port=3306
user="lepus"
passwd="123456"
dbname="lepus"
[root@localhost lepus]# lepus start
nohup: 把输出追加到"nohup.out"
lepus server start success!
4、安装web的管理平台
[root@localhost lepus]# cd
[root@localhost ~]# cd lepus_v3.7/php/
[root@localhost php]# cp -a . /var/www/html/
[root@localhost php]# systemctl start httpd
[root@localhost php]# cd /var/www/html/
[root@localhost html]# vim application/config/database.php
53 $db['default']['username'] = 'lepus';
54 $db['default']['password'] = '123456';
55 $db['default']['database'] = 'lepus';
[root@localhost html]# systemctl stop firewalld
[root@localhost html]# setenforce 0
[root@localhost html]# firefox http://127.0.0.1
默认管理员账号:admin
密码:Lepusadmin
5、添加要监控的数据库实例