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=/opt/lampp/bin/
export LD_LIBRARY_PATH=/opt/lampp/lib
[root@HE3home]#source /etc/profile
下载MySQLdb-python.zip
[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
注:如果报错,根据报错信息来操作比如
[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采集器
[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浏览器中进行操作了
Xampp下载地址:https://www.apachefriends.org/download.html
Xampp帮助文档:https://www.apachefriends.org/faq_linux.html
lepus官方安装手册
http://www.lepus.cc/manual/index