您好,登錄后才能下訂單哦!
Part1:寫在最前
Lepus安裝需要Lamp環(huán)境,Lamp環(huán)境的安裝個人認(rèn)為比較費勁,XAMPP的一鍵部署LAMP環(huán)境省心省力, lepus官網(wǎng)手冊也建議采用XAMPP的方式安裝,lepus也是在XAMPP上進(jìn)行研發(fā)的,看官網(wǎng)安裝手冊,看了半天也沒成功,經(jīng)過多日奮戰(zhàn),終于實現(xiàn)lepus的快速,輕量化部署,并能用ie瀏覽器監(jiān)控。
注意xampp會把apache,mysql,php都安裝,所以要在干凈的環(huán)境中進(jìn)行安裝,以免安裝兩個mysql,兩個mysql也是可以的,我這里是干凈的環(huán)境。
整體環(huán)境:
192.168.1.250 HE3 監(jiān)控機
192.168.1.248 HE1 主 被監(jiān)控機
192.168.1.249 HE2 從 被監(jiān)控機
Part2:LNMP環(huán)境構(gòu)建
安裝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 追加環(huán)境變量
export PATH=$PATH:/opt/lampp/bin/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/lampp/lib
[root@HE3home]#source /etc/profile
Part3:安裝Lepus
下載MySQLdb-python.zip是lepus安裝后監(jiān)控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安裝過程中如果報錯,根據(jù)報錯信息來操作比如
[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官網(wǎng)下載)
[root@HE3 home]#unzip lepus3.7.zip
Part4:數(shù)據(jù)庫配置
監(jiān)控庫
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);
被監(jiān)控庫HE1,HE2只需創(chuàng)建lepus_monitor賬號即可
mysql> grant select,super,process,reload,show databases,replication client on *.* to'lepus_monitor'@'%' identified by 'MANAGER';
mysql> flush privileges;
Part5: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
[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>
Part6:linux系統(tǒng)配置
[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打開監(jiān)控界面,即可登錄系統(tǒng)。默認(rèn)管理員賬號密碼admin/Lepusadmin登錄后請修改管理員密碼,增加普通賬號。
讓xampp開機自動啟動
sudo ln -s /opt/lampp/lampp /etc/init.d/lampp
sudo chkconfig --add lampp
Part7:windows系統(tǒng)配置
編輯windows中的hosts
C:\Windows\System32\drivers\etc
添加
192.168.1.250 mysqlmtop1.ikongjian.com
就可以在ie瀏覽器中進(jìn)行操作了
xampp的幫助文檔可以參考
https://www.apachefriends.org/faq_linux.html
lepus官方安裝手冊
http://www.lepus.cc/manual/index
---------------------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不能監(jiān)控slave的bug了
--redis頁面顯示權(quán)限拒絕
redis的php文件里的權(quán)限的行都注釋了,就顯示出來了
--------------------mysql--------------------
---MySQL復(fù)制監(jiān)控中無法看圖形
vi /opt/lampp/htdocs/application/controllers/lp_mysql.php
337行,去掉'mysql/replication',改為parent::check_privilege();
原來為parent::check_privilege('mysql/replication');
---修復(fù)mysql復(fù)制圖表時間偏移導(dǎo)致數(shù)據(jù)不準(zhǔn)確
影響:線型圖表時間偏移
修復(fù):修改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;
---修復(fù)mysql5.7復(fù)制監(jiān)控沒數(shù)據(jù)
mysql> set global show_compatibility_56=on;
--------------------監(jiān)控MongoDB報錯------------------
如果MongoDB沒有開啟認(rèn)證,監(jiān)控會報錯
2017-10-18 11:33:39 [WARNING] check mongodb xxxx:27017 : Authentication failed.
對于沒有開啟認(rèn)證的MongoDB解決方案:
將check_mongodb.py中的 db.authenticate(user,passwd)注釋掉即可登錄無需用戶名密碼的MongoDB
----------------------------nginx.conf-------------------------
默認(rèn)用nginx跑web管理臺會有問題,需要加個rewrite
location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; break; } }
加入后仍然報 File not found....錯誤,能不能把一個正常發(fā)布在nginx下的lepus,nginx.conf配置文件發(fā)出來,共享下
@:回復(fù)
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;
}
}
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。