1.安装lamp
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum localinstall mysql80-community-release-el7-3.noarch.rpm
yum install mysql-server
systemctl start mysqld
systemctl enable mysqld
grep password /var/log/mysqld.log
mysql_secure_installation
yum install php php-mysql
systemctl start httpd
systemctl enabled httpd
2.安装python模块
yum install MySQL-python.x86_64 -y
3.安装lepus
yum install git -y
cd /usr/local
git clone https://github.com/ruzuojun/lepus.git
cd lepus chmod u+x lepus*
ln -s /usr/local/lepus/lepus /usr/local/sbin/lepus ln -s /usr/local/lepus/lepus_monitor /usr/local/sbin/lepus_monitor
4.在监控机创建监控数据库
cd /usr/local/lepus/sql/
mysql -u root -p
create database lepus default character set utf8; grant select,insert,update,delete,create on lepus.* to ‘admin’@’localhost’ identified by ‘123456’; flush privileges;
use lepus; source lepus_table.sql; // 先导表结构 source lepus_data.sql; // 再导数据
5.修改配置文件
vim /usr/local/lepus/etc/config.ini
[monitor_server]
host=”127.0.0.1″ port=3306 user=”admin” passwd=”123456″ dbname=”lepus”
6.启动Lepus lepus start
7.安装web管理后台
cp -rf /usr/local/lepus/web/* /var/www/html/
vim /var/www/html/application/config/database.php
$db[‘default’][‘hostname’] = ‘localhost’; $db[‘default’][‘port’] = ‘3306’; $db[‘default’][‘username’] = ‘admin’; $db[‘default’][‘password’] = ‘123456’; $db[‘default’][‘database’] = ‘lepus’;
8.重启httpd
systemctl restart httpd
9.访问lepus
http://192.168.10.1
admin/Lepusadmin
10.在lepus上添加mysql监控实例
首先需要在被监控端授权
grant select,process,super on . to ‘testusre’@’192.168.10.1’ identified by ‘Redhat.123’;
flush privileges;
然后在web管理页面—“配置中心”—MySQL添加