Lepus(天兔)数据库监控系统

更多介绍参考官网:http://www.lepus.cc/

参考官方文档,以 Xampp 集成安装相关软件。

Xampp下载地址:https://www.apachefriends.org/download.html

 

下载安装 Xampp  (Apache 2.4.33, MariaDB 10.1.32, PHP 5.6.36 , Perl v5.16.3)

# cd /opt/
# wget https://www.apachefriends.org/xampp-files/5.6.36/xampp-linux-x64-5.6.36-0-installer.run
# chmod +x xampp-linux-x64-1.8.2-5-installer.run
# ./xampp-linux-x64-1.8.2-5-installer.run 

相关服务启动命令参考:

./xampp --help

 

MariaDB 配置:

 

# 如:启用 MySQL,以空密码登录
# cd /opt/lampp/
# vim etc/my.cnf   #更改端口,server_id
# ./xampp startmysql
# mysql -P3366 -uroot --socket=/opt/lampp/var/mysql/mysql.sock

mysql>
select user,host from mysql.user;
drop user ''@'localhost';
drop user 'root'@'::1';
drop user 'root'@'127.0.0.1';
update mysql.user set password = password('mysql') where user = 'root';
create user 'root'@'%' identified by 'mysql';
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;

Apache & PHP 配置:

# 更改 http 端口(# vim /opt/lampp/etc/httpd.conf)
Listen 8000


#改为服务器IP
ServerName 10.10.10.8



    AllowOverride none
    Require all granted		#denied修改为granted


Include etc/extra/httpd-vhosts.conf  #去掉注释



# 注释掉下面一行(# vim /opt/lampp/etc/extra/httpd-xampp.conf )
#	Require local



# 说明:默认WEB代码上传目录:/opt/lampp/htdocs/
# 配置虚拟目录 (vim /opt/lampp/etc/extra/httpd-vhosts.conf )

    ServerAdmin lepus.kk.com
    DocumentRoot "/opt/lampp/htdocs"
    ServerName lepus.kk.com
    ServerAlias lepus.kk.com
    AddDefaultCharset UTF-8
    ErrorLog "logs/demo.lepus.cc-error_log"
    CustomLog "logs/demo.lepus.cc-access_log" common




#如:添加文件info.php  
# vim /opt/lampp/htdocs/info.php  

 
#浏览器输入网址,此时可打开《PHP Version 5.6.36》    
http://10.10.10.8:8000/info.php

安装相关 python 包 (略):

 

MySQLdb, pymssql,cx_oracle ,Pymongo ,redis-py 常用的python数据库驱动

 

配置 snmp:

# yum -y install net-snmp*

# vim /etc/snmp/snmpd.conf

#41行 default 改为监控服务器IP
com2sec notConfigUser  10.10.10.8       public

#62行 systemview 改为 all,所有snmp访问权限
access  notConfigGroup ""      any       noauth    exact  all none none

#85行注释去掉
view all    included  .1                               80



# 更改日志级别
# vim /etc/init.d/snmpd

#OPTIONS="-LS0-6d -Lf /dev/null -p /var/run/snmpd.pid"
OPTIONS="-LS 4 d -p /var/run/snmpd.pid -a"


# 启动 snmpd 服务
/etc/init.d/snmpd start

 

安装配置 lepus :

# 下载 Lepus 解压更名为 lepus, 路径如下:
# cd /opt/lepus


# mysql 中创建数据库及用户
create database lepus default character set utf8;
grant select,insert,update,delete,create on lepus.* to 'lepus_user'@'127.0.0.1' identified by 'lepus_pwd';
flush privileges;


# 导入表结构和数据
# mysql -P3366 -uroot -p --socket=/opt/lampp/var/mysql/mysql.sock lepus < /opt/lepus/sql/lepus_table.sql
# mysql -P3366 -uroot -p --socket=/opt/lampp/var/mysql/mysql.sock lepus < /opt/lepus/sql/lepus_data.sql


# 安装Lpeus程序
# cd /opt/lepus/python
# chmod +x install.sh
# ./install.sh

[note] lepus will be install on basedir: /usr/local/lepus
[note] /usr/local/lepus directory does not exist,will be created.
[note] /usr/local/lepus directory created success.
[note] wait copy files.......
[note] change script permission.
[note] create links.
[note] install complete.


# 修改配置文件
# vim /usr/local/lepus/etc/config.ini

[monitor_server]
host="127.0.0.1"
port=3366
user="lepus_user"
passwd="lepus_pwd"
dbname="lepus"


# 编辑 check_os.sh 添加
# vim /usr/local/lepus/check_os.sh
if [ -z $mem_shared ]; then
    mem_shared=0
fi


# 启动lepus采集进程
# /usr/local/lepus/lepus start


# 因为没有添加主机,所以查看日志会看到如下提示,属于正常提示。可以在部署完Lepus WEB控制台后再进行启动
# tail -f logs/lepus.log 

2018-06-14 21:32:23 [INFO] check mysql controller finished.
2018-06-14 21:32:41 [INFO] alarm controller started.
2018-06-14 21:32:42 [INFO] alarm controller finished.
mysql execute: not all arguments converted during string formatting
mysql execute: not all arguments converted during string formatting
2018-06-14 21:33:24 [INFO] check mysql controller started.
2018-06-14 21:33:24 [WARNING] check mysql: not found any servers
2018-06-14 21:33:24 [INFO] check mysql controller finished.
vers
2018-06-14 21:33:24 [INFO] check mysql controller finished.
2018-06-14 21:33:52 [INFO] alarm controller started.
te: not all arguments converted during string formatting


####################################################

# 默认的站点目录:/opt/lampp/htdocs/
# 复制PHP文件夹里的文件到Apache对应的网站虚拟目录
# cp -rf /opt/lepus/php/* /opt/lampp/htdocs/


# 打开 database.php文件,修改PHP连接监控服务器的数据库信息
# vim /opt/lampp/htdocs/application/config/database.php

$db['default']['hostname'] = '127.0.0.1';
$db['default']['port']     = '3366';
$db['default']['username'] = 'lepus_user';
$db['default']['password'] = 'lepus_pwd';
$db['default']['database'] = 'lepus';
$db['default']['dbdriver'] = 'mysql';




#浏览器访问,默认管理员账号密码:admin/Lepusadmin
http://10.10.10.8:8000

Lepus(天兔)数据库监控系统_第1张图片

# 最后记得启动lepus采集进程
/usr/local/lepus/lepus start

Lepus(天兔)数据库监控系统_第2张图片

 

你可能感兴趣的:(Monitor-Others)