1. 程式人生 > >CentOS搭建lepus3.8監控MySQL

CentOS搭建lepus3.8監控MySQL

centos搭建lepus3.8監控mysql

CentOS搭建lepus3.8監控MySQL


yum -y install gcc libffi-devel python-devel openssl-devel mysql-devel zlib-devel


監控端安裝數據庫連接Python的驅動包

1).安裝 MySQLdb for python (如果需要監控MySQL則必須安裝)

MySQLdb為Python連接和操作MySQL的類庫,如果準備使用lepus系統監控MySQL數據庫,那麽該模塊必須安裝。

[[email protected] ~]# wget http://cdn.lepus.cc/cdncache/software/MySQLdb-python.zip

[[email protected] ~]# unzip MySQLdb-python.zip

[[email protected] ~]# cd MySQLdb1-master/

[[email protected] ~]# which mysql_config

/usr/local/mysql/bin/mysql_config

[[email protected] ~]# vim site.cfg 修改如下:

mysql_config = /usr/local/mysql/bin/mysql_config

[[email protected]

/* */ ~]# python setup.py build

[[email protected] ~]# python setup.py install



下載lepus3.8 官方地址

http://www.lepus.cc/soft/18


[[email protected] ~]# unzip lepus3.8.zip

[[email protected] ~]# cd Lepus_v3.8_beta


在監控機創建監控數據庫,並授權。

監控庫

[[email protected] ~]# mysql -uroot -p"[email protected]

/* */"

mysql> create database lepus default character set utf8;

mysql> grant select,insert,update,delete,create on lepus.* to [email protected]%‘ identified by‘MANAGER‘;

mysql> flush privileges;

[[email protected]_v3.8_beta]# mysql -uroot -p lepus < sql/lepus_table.sql

[[email protected]_v3.8_beta]# mysql -uroot -p lepus < sql/lepus_data.sql

##### set names utf8; ######

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

被監控庫

mysql> grant select,super,process,reload,show databases,replication client on *.* [email protected] identified by ‘MANAGER‘;

mysql> flush privileges;

安裝Lpeus程序

進入到Lepus軟件包的python文件夾

# cd python/

授予install.sh可執行權限

# chmod +x install.sh

執行安裝

# ./install.sh

修改配置文件

進入到安裝目錄,默認為/usr/local/lepus

[[email protected]~]# vi /usr/local/lepus/etc/config.ini

###監控機MySQL數據庫連接地址###

[monitor_server]

host="192.168.1.250"

port=4008

user="lepus_user"

passwd="MANAGER"

dbname="lepus"

重啟lepus進程

ln -s /usr/local/lepus/lepus /etc/init.d/


service lepus stop

service lepus start

[[email protected]]# tail -f logs/lepus.log


安裝WEB管理臺

進入到你的lepus軟件目錄

[[email protected] ~]# cd Lepus_v3.8_beta/

[[email protected]_v3.8_beta]# cp -r php /home/www

[[email protected] ~]# vim /home/www/php/application/config/database.php

$db[‘default‘][‘hostname‘] = ‘192.168.1.250‘;

$db[‘default‘][‘port‘] = ‘4008‘;

$db[‘default‘][‘username‘] = ‘lepus_user‘;

$db[‘default‘][‘password‘] = ‘MANAGER‘;

$db[‘default‘][‘database‘] = ‘lepus‘;

$db[‘default‘][‘dbdriver‘] = ‘mysql‘;

登錄進行添加主機和監控

通過瀏覽器打開監控界面,即可登錄系統。.默認管理員賬號密碼admin/Lepusadmin登錄後請修改管理員密碼,增加普通賬號。



-----

2017/04/24 16:50:32 [error] 17648#0: *100 open()

"/var/www/html/index.php/login" failed (20: Not a directory),

client: 124.207.48.234, server: 221.195.1.233, request: "GET

/index.php/login?return_url=http://221.195.1.233:8080/index.php

HTTP/1.1", host: "221.195.1.233:8080"

-----報錯信息



修改lepus登錄用戶名和密碼

mysql> use lepus


mysql> update admin_user set password=md5("[email protected]") where user_id=1;


mysql> update admin_user set username=‘zykj_admin‘ where user_id=1;



這個是登陸mysql修改lepus的登陸賬戶和密碼


zykj_admin [email protected]


CentOS搭建lepus3.8監控MySQL