安装说明
PHP和Python都是跨平台的语言,所以理论上系统应该可以支持在不同的平台上运行。但是由于时间和精力以及资源有限,目前天兔系统只测试完善了Centos/RedHat系统的支持。我们目前提供的技术支持也是只针对于Centos/RedHat系统,其他系统暂不支持技术服务。
以下软件包只需要部署在监控机即可。被监控机无需部署。
- 1.MySQL5.1及以上(必须,用来存储监控系统采集的数据)
- 2.Apache 2.2及以上 (必须,WEB服务器运行服务器)
- 3.PHP 5.3以上 (必须,提供WEB界面支持,不支持PHP7)
- 4.Python2 (必须,推荐2.6及以上版本,执行数据采集和报警任务,不支持Python3)
- 5.Python连接和监控数据库的相关驱动模块包:
MySQLdb for python (Python连接MySQl的接口,用于监控MySQL,此模块必须安装)
cx_oracle for python (Python连接Oracle的接口,非必须,如果需要监控oracle此模块必须安装)
Pymongo for python (Python连接MongoDB的接口,非必须,如果需要监控MongoDB此模块必须安装)
redis-py for python (Python连接Redis的接口,非必须,如果需要监控Redis此模块必须安装)
需要用到的包链接:https://pan.baidu.com/s/11WcHgkLLoaizNvSP5ZLL2Q
提取码:xnix
下载lepus
lepus3.7版本下载http://www.lepus.cc/soft/17
官方说明文档
部署lamp环境
yum install httpd php php-mysql mariadb-server -y
启动数据库
shell >systemctl start mariadb
创建数据库
MariaDB [(none)]> create database lepus;
MariaDB [(none)]> grant all on lepus.* to lepused by '123456';
启动apachee
shell>systemctl start httpd
安装web管理台
- 上传lepus代码
shell > cd /var/www/html
[root@web02 /var/www/html]# ls
Lepus数据库企业监控系统3.7版本官方下载_(1).zip
[root@web02 /var/www/html]# unzip Lepus数据库企业监控系统3.7版本官方下载_\(1\).zip
[root@web02 /var/www/html]# cd lepus_v3.7/
[root@web02 /var/www/html/lepus_v3.7]# mv php/* /var/www/html/
- 导入数据库
cd lepus_v3.7/
cd sql
mysql lepus <lepus_table.sql
mysql lepus <lepus_data.sql
- 打开application\config\database.php文件,修改PHP连接监控服务器的数据库信息
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'lepus_user';
$db['default']['password'] = 'xxxxxx';
$db['default']['database'] = lepus;
$db['default']['dbdriver'] = 'mysql';
- 修改所有者
chown -R apache. /var/www/html
通过浏览器输入IP地址或域名打开监控界面,即可登录系统。.默认管理员账号密码admin/Lepusadmin登录后请修改管理员密码,增加普通账号。
登录界面如下所示:
安装后端采集器
给文件lepus_v3.7/python/install.sh 添加执行权限,然后执行脚本
[root@web02 /var/www/html/lepus_v3.7/python]# 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.
修改后的数据库连接文件
[root@web02 /var/www/html/lepus_v3.7/python]# cd /usr/local/lepus
[root@web02 /usr/local/lepus]# vim etc/config.ini
###监控机MySQL数据库连接地址###
[monitor_server]
host="127.0.0.1"
port=3306
user="lepus"
passwd="123456"
dbname="lepus"
启动lepus
[root@web02 /usr/local/lepus]# lepus start
nohup: appending output to ‘nohup.out’
lepus server start fail!
[root@web02 /usr/local/lepus]# vim nohup.out
Traceback (most recent call last):
File "lepus.py", line 8, in <module>
import MySQLdb
ImportError: No module named MySQLdb
提示需要导入一个MySQLdb 模块
上传MySQLdb模块
cd /opt
[root@web02 /opt]# ls
MySQLdb-python_(1).zip
[root@web02 /opt]# unzip MySQLdb-python_\(1\).zip
安装mariadb-devel
yum install -y mariadb-devel
[root@web02 /opt/MySQLdb1-master]# which mysql_config
/usr/bin/mysql_config
复制 which出来的路径
编辑 site.cfg 文件
添加 这一行mysql_config = /usr/bin/mysql_config
路径就是which出来的路径
执行 python setup.py build
他是去国外的网站上下载distribute-0.6.28.tar.gz 包,下载不到引发的错误。这个包不好找,已经打包在文章开头了
手动上传distribute-0.6.28.tar.gz后在执行
发现还是缺少一个命令,这个命令是python-devel
提供的,所以需要下载
yum install -y python-devel
下载完成后再执行
[root@web02 /opt/MySQLdb1-master]# python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64/mysql -L/usr/lib64 -lmysqlclient -lpthread -lz -lm -ldl -lssl -lcrypto -lpython2.7 -o build/lib.linux-x86_64-2.7/_mysql.so
再执行
python setup.py install
最后再启动
[root@web02 /opt/MySQLdb1-master]# lepus start
nohup: appending output to ‘nohup.out’
lepus server start success!
到这里就安装结束了,去登陆web页面
浏览器直接输入ip 如 10.0.0.10
初始账号 admin 密码Lepusadmin