安装XAMPP
Xampp下载地址:https://www.apachefriends.org/download.html
注意你的版本号,高版本的XAMPP中可能不是Mysql而是MariaDB
[root@HE3home]# chmod +x xampp-linux-x64-1.8.2-5-installer.run
[root@HE3home]# ./xampp-linux-x64-1.8.2-5-installer.run
[root@HE3home]# /opt/lampp/lampp start
[root@HE3 home]#vi /etc/profile 追加环境变量
export PATH=/opt/lampp/bin:$PATH
[root@HE3home]#source /etc/profile
下载MySQLdb-python.zip是lepus安装后监控mysql所必需的
[root@HE3 home]#wget http://cdn.lepus.cc/cdncache/software/MySQLdb-python.zip
[root@HE3 home]#unzip MySQLdb-python.zip
[root@HE3 home]# cd MySQLdb1-master/
[root@HE3MySQLdb1-master]# which mysql_config
/opt/lampp/bin/mysql_config
[root@HE3MySQLdb1-master]# vi site.cfg
mysql_config= /opt/lampp/bin/mysql_config
[root@HE3~]#export LD_LIBRARY_PATH=
[root@HE3~]#yum install gcc libffi-devel python-devel openssl-devel
[root@HE3~]# yum install urpmi xterm
[root@HE3MySQLdb1-master]# python setup.py build
[root@HE3MySQLdb1-master]# python setup.py install
注:lepus安装过程中如果报错,根据报错信息来操作比如
[root@HE3 lepus]# ln -s /usr/lib64/libssl.so.1.0.1e /usr/lib64/libssl.so.1.0.0
[root@HE3 lepus]# ln -s /usr/lib64/libcrypto.so.1.0.1e /usr/lib64/libcrypto.so.1.0.0
lepus安装采集器(lepus官网下载)
[root@HE3 home]#unzip lepus3.7.zip
监控库
mysql> create database lepus default character set utf8;
mysql>grant select,insert,update,delete,create on lepus.* to 'lepus_user'@'%' identified by 'MANAGER';
mysql> flush privileges;
[root@HE3lepus_v3.7]# mysql -uroot -p lepus < sql/lepus_table.sql
[root@HE3lepus_v3.7]# mysql -uroot -p lepus < sql/lepus_data.sql
mysql>use lepus
mysql>alter table mysql_status modify column max_connect_errors bigint(18);
mysql>alter table mysql_status_history modify column max_connect_errors bigint(18);
[root@HE3lepus_v3.7]# cd python/
[root@HE3 python]#chmod +x install.sh
[root@HE3 python]#./install.sh
[root@HE3 python]#vi /usr/local/lepus/etc/config.ini
[monitor_server]
host="192.168.1.250"
port=3306
user="lepus_user"
passwd="MANAGER"
dbname="lepus"
[root@HE3lepus_v3.7]# cp -r php/* /opt/lampp/htdocs/
[root@HE3lepus_v3.7]# vi /opt/lampp/htdocs/application/config/database.php
$db['default']['hostname']= '192.168.1.250';
$db['default']['port'] = '3306';
$db['default']['username']= 'lepus_user';
$db['default']['password']= 'MANAGER';
$db['default']['database']= 'lepus';
$db['default']['dbdriver']= 'mysql';
[root@HE3lepus_v3.7]# cd /usr/local/lepus/
[root@HE3 lepus]#lepus start
nohup: appendingoutput to `nohup.out'
lepus server startsuccess!
有问题看日志
[root@HE3 ~]# tail -f /usr/local/lepus/nohup.out
[root@HE3 ~]# tail -f /usr/local/lepus/logs/lepus.log
[root@HE3~]# vi /opt/lampp/etc/extra/httpd-vhosts.conf
删除原有的,改为
AddDefaultCharset UTF-8
DocumentRoot "/opt/lampp/htdocs"
ServerName mysqlmtop1.ikongjian.com
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
ErrorLog"|/usr/local/apache/bin/rotatelogs /home/logs/apache/php_%Y%m%d_error.log86400 480"
CustomLog"|/usr/local/apache/bin/rotatelogs /home/logs/apache/php_%Y%m%d_access.log86400 480" common
[root@HE3~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain
::1 localhost6 localhost6.localdomain6
192.168.1.248 HE1
192.168.1.249 HE2
192.168.1.250 HE3 mysqlmtop1.ikongjian.com
192.168.1.251 HE4
通过浏览器输入mysqlmtop1.ikongjian.com打开监控界面,即可登录系统。默认管理员账号密码admin/Lepusadmin登录后请修改管理员密码,增加普通账号。
让xampp开机自动启动
sudo ln -s /opt/lampp/lampp /etc/init.d/lampp
sudo chkconfig --add lampp
被监控库HE1,HE2只需创建lepus_monitor账号即可
mysql> grant select,super,process,reload,show databases,replication client on *.* to'lepus_monitor'@'%' identified by 'MANAGER';
mysql> flush privileges;