Lepus安装需要Lamp环境,Lamp环境的安装个人认为比较费劲,XAMPP的一键部署LAMP环境省心省力, lepus官网也建议采用XAMPP的方式安装,lepus也是在XAMPP上进行研发的,看官网安装手册,看了半天也没成功,经过多日奋战,终于实现lepus的快速,轻量化部署,并能用ie浏览器监控。
注意xampp会把apache,mysql,php都安装,所以要在干净的环境中进行安装,以免安装两个mysql,两个mysql也是可以的,我这里是干净的环境。
整体环境:
192.168.1.250监控机
192.168.1.248 主 被监控机
192.168.1.249 从 被监控机
安装XAMPP
Xampp下载地址:https://www.apachefriends.org/download.html
[[email protected]]# chmod +x xampp-linux-x64-1.8.2-5-installer.run
[[email protected]]# ./xampp-linux-x64-1.8.2-5-installer.run
[[email protected]]# /opt/lampp/lampp start
[[email protected] home]#vi /etc/profile 追加环境变量
exportPATH=/opt/lampp/bin/
exportLD_LIBRARY_PATH=/opt/lampp/lib
[[email protected]]#source /etc/profile
下载MySQLdb-python.zip
[[email protected] home]#wget http://cdn.lepus.cc/cdncache/software/MySQLdb-python.zip
[[email protected] home]#unzip MySQLdb-python.zip
[[email protected] home]# cdMySQLdb1-master/
[[email protected]]# which mysql_config
/opt/lampp/bin/mysql_config
[[email protected]]# vi site.cfg
mysql_config= /opt/lampp/bin/mysql_config
[[email protected]~]#yum install gcc libffi-devel python-devel openssl-devel
[[email protected]~]# yum install urpmi xterm
[[email protected]]# python setup.py build
[[email protected]]# python setup.py install
安装Lepus采集器
[[email protected] 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;
[[email protected]_v3.7]# mysql -uroot -p lepus < sql/lepus_table.sql
[[email protected]_v3.7]# mysql -uroot -p lepus < sql/lepus_data.sql
mysql>use lepus
mysql>alter tablemysql_status modify column max_connect_errors bigint(18);
mysql>alter tablemysql_status_history modify column max_connect_errors bigint(18);
被监控库
mysql> grant select,super,process,reload,show databases,replication client on *.* to‘lepus_monitor‘@‘%‘ identified by ‘MANAGER‘;
mysql> flush privileges;
[[email protected]_v3.7]# cd python/
[[email protected] python]#chmod +x install.sh
[[email protected] python]#./install.sh
[[email protected] python]#vi /usr/local/lepus/etc/config.ini
[monitor_server] host="192.168.1.250" port=3306 user="lepus_user" passwd="MANAGER" dbname="lepus"
[[email protected]_v3.7]# cp -r php/* /opt/lampp/htdocs/
[[email protected]_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‘;
[[email protected]_v3.7]# cd /usr/local/lepus/
[[email protected] lepus]#lepus start
nohup: appendingoutput to `nohup.out‘
lepus server startsuccess!
有问题看日志
[[email protected] ~]# tail -f /usr/local/lepus/nohup.out
[[email protected] ~]# tail -f /usr/local/lepus/logs/lepus.log
[[email protected]~]# 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>
[[email protected]~]# 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