天兔3.8安装 centos7
1.Lepus安装需要Lamp环境,Lamp环境的安装个人认为比较费劲,XAMPP的一键部署LAMP环境省心省力, lepus官网手册也建议采用XAMPP的方式安装,lepus也是在XAMPP上进行研发的,看官网安装手册,看了半天也没成功,经过多日奋战,终于实现lepus的快速,轻量化部署,并能用ie浏览器监控。
注意xampp会把apache,mysql,php都安装,所以要在干净的环境中进行安装,以免安装两个mysql,两个mysql也是可以的,我这里是干净的环境。
2.LAMP环境搭建
安装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=$PATH:/opt/lampp/bin/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/lampp/lib
[root@HE3home]#source /etc/profile
3.安装Lepus
下载MySQLdb-python.zip是lepus安装后监控mysql所必需的 可加入天兔群去下载这个压缩包,如果不能下载,我在本文最后的附件中上传了
[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~]#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
python setup.py build会出错
Python包管理工具Distribute的安装
wget http://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz
tar xf distribute-0.6.35.tar.gz
cd distribute-0.6.35
python setup.py install
安装完distribute 就在python setup.py build就不会出错
数据库配置
监控库
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);
被监控库只需创建lepus_monitor账号即可
mysql> grant select,super,process,reload,show databases,replication client on *.* to'lepus_monitor'@'%' identified by 'MANAGER';
mysql> flush privileges;
lepus配置
[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
###监控机MySQL数据库连接地址###
[monitor_server]
host="127.0.0.1"
port=3306
user="lepus_user"
passwd="MANAGER"
dbname="lepus"
拷贝前先备份以防万一
[root@HE3lepus_v3.7]# cp -r php/* /opt/lampp/htdocs/
[root@HE3lepus_v3.7]# mkdir -p /opt/lampp/htdocs/application/config/
[root@HE3lepus_v3.7]# vi /opt/lampp/htdocs/application/config/database.php
$db['default']['hostname'] = '192.168.197.136';
$db['default']['port'] = '3306';
$db['default']['username'] = 'lepus_user';
$db['default']['password'] = 'MANAGER';
$db['default']['database'] = 'lepus';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
[root@HE3lepus_v3.7]# cd /usr/local/lepus/
[root@HE3 lepus]#lepus start
lepus server startsuccess!
BUG FIX
---------------------redis----------------------
[root@HE3 lepus]#vi check_redis.py
148
149 except Exception, e:
150 logger_msg="check redis %s:%s : %s" %(host,port,e)
151 #logger.warning(logger_msg)
152
153 try:
154 connect=0
155 sql="insert into redis_status(server_id,host,port,tags,connect) values(% s,%s,%s,%s,%s)"
151行的注释掉就解决redis不能监控slave的bug了
--redis页面显示权限拒绝
redis的php文件里的权限的行都注释了,就显示出来了
--------------------mysql--------------------
---MySQL复制监控中无法看图形
vi /opt/lampp/htdocs/application/controllers/lp_mysql.php
337行,去掉'mysql/replication',改为parent::check_privilege();
原来为parent::check_privilege('mysql/replication');
---修复mysql复制图表时间偏移导致数据不准确
影响:线型图表时间偏移
修复:修改vi /opt/lampp/htdocs/application/controllers/lp_mysql.php
352行找到public function replication()的$chart_reslut[$i]['delay']=$dbdata['delay'],修该为:
$chart_reslut[$i]['delay'] = !empty($dbdata['delay']) ? $dbdata['delay'] : 0;
---修复mysql5.7复制监控没数据
mysql> set global show_compatibility_56=on;
--------------------监控MongoDB报错------------------
如果MongoDB没有开启认证,监控会报错
2017-10-18 11:33:39 [WARNING] check mongodb xxxx:27017 : Authentication failed.
对于没有开启认证的MongoDB解决方案:
将check_mongodb.py中的 db.authenticate(user,passwd)注释掉即可登录无需用户名密码的MongoDB
----------------------------nginx.conf-------------------------
默认用nginx跑web管理台会有问题,需要加个rewrite
location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; break; } }
加入后仍然报 File not found....错误,能不能把一个正常发布在nginx下的lepus,nginx.conf配置文件发出来,共享下
vijay2015 @: 1022xiyang 2015年04月28日 09:29:161#
我这边加过之后就OK了配置如下:
server {
listen 8001;
server_name lepus;
location / {
if (!-e $request_filename)
{
rewrite ^(.*)$ /index.php?s=$1
last;
break;
}
root
/usr/local/www;
index index.php index.html
index.htm;
}
location ~ \.php$ {
root
/usr/local/www;
fastcgi_pass
127.0.0.1:9000;
fastcgi_index
index.php;
fastcgi_param
SCRIPT_FILENAME $document_root$fastcgi_script_name;
include
fastcgi_params;
}
}
~
安装Lep