Lepus安装需要Lamp环境,Lamp环境的安装个人认为比较费劲,XAMPP的一键部署LAMP环境省心省力, lepus官网手册也建议采用XAMPP的方式安装,lepus也是在XAMPP上进行研发的,看官网安装手册,看了半天也没成功,经过多日奋战,终于实现lepus的快速,轻量化部署,并能用ie浏览器监控。

注意xampp会把apache,mysql,php都安装,所以要在干净的环境中进行安装,以免安装两个mysql,两个mysql也是可以的,我这里是干净的环境。

 

整体环境:

192.168.1.250 HE3 监控机

192.168.1.248 HE1 主 被监控机

192.168.1.249 HE2 从 被监控机

 

安装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

 


下载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~]#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@HE3lepus]# ln -s /usr/lib64/libssl.so.1.0.1e /usr/lib64/libssl.so.1.0.0

[root@HE3lepus]# 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);


被监控库HE1,HE2只需创建lepus_monitor账号即可

mysql> grant select,super,process,reload,show databases,replication client on *.* to'lepus_monitor'@'%' identified by 'MANAGER';

mysql> flush privileges;

 

[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

删除原有的,改为

<VirtualHost*:80>
    AddDefaultCharset UTF-8
    DocumentRoot "/opt/lampp/htdocs"
    ServerName mysqlmtop1.ikongjian.com
    <Directory"/opt/lampp/htdocs">
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from All
    </Directory>
    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
</VirtualHost>

 

[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

 

编辑windows中的hosts

C:\Windows\System32\drivers\etc

添加

192.168.1.250   mysqlmtop1.ikongjian.com

 

就可以在ie浏览器中进行操作了

wKioL1crGTuRiRjhAAVe4OtpPrQ483.jpg

wKiom1crGGjgKY2kAAWpwZ0Lc5A865.jpg

wKiom1crGGuD4c6HAAReD886jHg392.jpg

 wKioL1csLw7y3dZtAAer8zKpfbo227.jpg

 


xampp的帮助文档可以参考

https://www.apachefriends.org/faq_linux.html

lepus官方安装手册

http://www.lepus.cc/manual/index




------------------------------------------------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了






--------------------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;


本文出自 “岁伏” 博客,请务必保留此出处http://suifu.blog.51cto.com/9167728/1770493

posted on 2016-08-19 17:14  岁伏  阅读(317)  评论(0编辑  收藏  举报