lepus 安装
平台:centOS6.9
[root@MySQL lepus]# ./xampp-linux-x64-1.8.2-5-installer.run
----------------------------------------------------------------------------
Welcome to the XAMPP Setup Wizard.
----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.
XAMPP Core Files : Y (Cannot be edited)
XAMPP Developer Files [Y/n] :y
Is the selection above correct? [Y/n]: y
----------------------------------------------------------------------------
Installation Directory
XAMPP will be installed to /opt/lampp
Press [Enter] to continue :
----------------------------------------------------------------------------
Setup is now ready to begin installing XAMPP on your computer.
Do you want to continue? [Y/n]: y
----------------------------------------------------------------------------
Please wait while Setup installs XAMPP on your computer.
Installing
0% ______________ 50% ______________ 100%
#########################################
----------------------------------------------------------------------------
Setup has finished installing XAMPP on your computer.
+++++++++++++++++++++++++++++================================
[root@MySQL ~]# /opt/lampp/lampp start
egrep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
egrep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/bin/bash: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
egrep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
id: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/opt/lampp/share/xampp/xampplib: line 11: test: -ne: unary operator expected
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
XAMPP: netstat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
egrep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
netstat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
egrep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/opt/lampp/bin/httpd: error while loading shared libraries: librt.so.1: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
XAMPP: hostname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
netstat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
egrep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/bin/sh: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
XAMPP: netstat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
egrep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/opt/lampp/bin/gettext: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
cat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
修改:vi /opt/lampp/lampp
[root@MySQL lampp]# vi lampp
#!/bin/bash
#
# For RedHat (thanks to Sudhaker Raj):
# chkconfig: 345 95 05
# description: Starts and stops the XAMPP \
# used to control Apache, MySQL, ProFTPD.
# For SuSE:
### BEGIN INIT INFO
# Provides: apache2 httpd2 xampp
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: XAMPP
# Description: Starts and stops XAMPP
### END INIT INFO
###############################################################################
# Copyright 2002-2009 by Apache Friends, GPL-licensed
# Authors:
# - Kai 'Oswald' Seidler, [email protected]
# - Kristian W. Marcroft, [email protected]
# - Christian Speich, [email protected]
osguess() {
if test -f /etc/redhat-release
then
if egrep "Red " /etc/redhat-release > /dev/null ----->RED
then
echo "rh9"
return 0
else
vi /opt/lampp/etc/extra/httpd-xampp.conf
#
# New XAMPP security concept
#
#Require local -------->注解掉
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
========================
[root@lepus data]# /opt/lampp/lampp restart
Restarting XAMPP for Linux 1.8.2-5...
XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...ok.
XAMPP: Stopping ProFTPD...ok.
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
[root@lepus data]# ll
total 126604
-rw-r--r-- 1 root root 6805861 Sep 20 16:43 lepus-master.zip
-rw-r--r-- 1 root root 6801780 Sep 20 16:43 Lepus.zip
-rw-r--r-- 1 root root 99967 Sep 20 16:43 MySQLdb-python.zip
-rwxr-xr-x 1 root root 115925624 Sep 20 16:42 xampp-linux-x64-1.8.2-5-installer.run
[root@lepus data]# unzip MySQLdb-python.zip
Archive: MySQLdb-python.zip
c8b2744ea2b1e4419b7e3d93928e92c95f366815
creating: MySQLdb1-master/
inflating: MySQLdb1-master/.gitignore
inflating: MySQLdb1-master/.travis.yml
inflating: MySQLdb1-master/GPL-2.0
inflating: MySQLdb1-master/HISTORY
inflating: MySQLdb1-master/INSTALL
inflating: MySQLdb1-master/MANIFEST.in
creating: MySQLdb1-master/MySQLdb/
inflating: MySQLdb1-master/MySQLdb/__init__.py
inflating: MySQLdb1-master/MySQLdb/connections.py
creating: MySQLdb1-master/MySQLdb/constants/
inflating: MySQLdb1-master/MySQLdb/constants/CLIENT.py
inflating: MySQLdb1-master/MySQLdb/constants/CR.py
inflating: MySQLdb1-master/MySQLdb/constants/ER.py
inflating: MySQLdb1-master/MySQLdb/constants/FIELD_TYPE.py
inflating: MySQLdb1-master/MySQLdb/constants/FLAG.py
inflating: MySQLdb1-master/MySQLdb/constants/REFRESH.py
inflating: MySQLdb1-master/MySQLdb/constants/__init__.py
inflating: MySQLdb1-master/MySQLdb/converters.py
inflating: MySQLdb1-master/MySQLdb/cursors.py
inflating: MySQLdb1-master/MySQLdb/release.py
inflating: MySQLdb1-master/MySQLdb/times.py
inflating: MySQLdb1-master/README.md
inflating: MySQLdb1-master/_mysql.c
inflating: MySQLdb1-master/_mysql_exceptions.py
inflating: MySQLdb1-master/distribute_setup.py
creating: MySQLdb1-master/doc/
inflating: MySQLdb1-master/doc/FAQ.rst
inflating: MySQLdb1-master/doc/Makefile
inflating: MySQLdb1-master/doc/MySQLdb.constants.rst
inflating: MySQLdb1-master/doc/MySQLdb.rst
inflating: MySQLdb1-master/doc/_mysql.rst
inflating: MySQLdb1-master/doc/_mysql_exceptions.rst
inflating: MySQLdb1-master/doc/conf.py
inflating: MySQLdb1-master/doc/index.rst
inflating: MySQLdb1-master/doc/make.bat
inflating: MySQLdb1-master/doc/modules.rst
inflating: MySQLdb1-master/doc/user_guide.rst
inflating: MySQLdb1-master/metadata.cfg
inflating: MySQLdb1-master/pymemcompat.h
inflating: MySQLdb1-master/setup.cfg
inflating: MySQLdb1-master/setup.py
inflating: MySQLdb1-master/setup_common.py
inflating: MySQLdb1-master/setup_posix.py
inflating: MySQLdb1-master/setup_windows.py
inflating: MySQLdb1-master/site.cfg
creating: MySQLdb1-master/tests/
inflating: MySQLdb1-master/tests/capabilities.py
inflating: MySQLdb1-master/tests/configdb.py
inflating: MySQLdb1-master/tests/dbapi20.py
inflating: MySQLdb1-master/tests/default.cnf
inflating: MySQLdb1-master/tests/test_MySQLdb_capabilities.py
inflating: MySQLdb1-master/tests/test_MySQLdb_dbapi20.py
inflating: MySQLdb1-master/tests/test_MySQLdb_nonstandard.py
inflating: MySQLdb1-master/tests/travis.cnf
[root@lepus data]# cd MySQLdb
-bash: cd: MySQLdb: No such file or directory
[root@lepus data]# cd MySQLdb1-master/
[root@lepus MySQLdb1-master]# ll
total 188
-rw-r--r-- 1 root root 16295 Aug 19 2013 distribute_setup.py
drwxr-xr-x 2 root root 4096 Aug 19 2013 doc
-rw-r--r-- 1 root root 18092 Aug 19 2013 GPL-2.0
-rw-r--r-- 1 root root 5687 Aug 19 2013 HISTORY
-rw-r--r-- 1 root root 6636 Aug 19 2013 INSTALL
-rw-r--r-- 1 root root 338 Aug 19 2013 MANIFEST.in
-rw-r--r-- 1 root root 1981 Aug 19 2013 metadata.cfg
-rw-r--r-- 1 root root 80803 Aug 19 2013 _mysql.c
drwxr-xr-x 3 root root 4096 Aug 19 2013 MySQLdb
-rw-r--r-- 1 root root 2352 Aug 19 2013 _mysql_exceptions.py
-rw-r--r-- 1 root root 3203 Aug 19 2013 pymemcompat.h
-rw-r--r-- 1 root root 1266 Aug 19 2013 README.md
-rw-r--r-- 1 root root 563 Aug 19 2013 setup.cfg
-rw-r--r-- 1 root root 1088 Aug 19 2013 setup_common.py
-rw-r--r-- 1 root root 3233 Aug 19 2013 setup_posix.py
-rw-r--r-- 1 root root 648 Aug 19 2013 setup.py
-rw-r--r-- 1 root root 1334 Aug 19 2013 setup_windows.py
-rw-r--r-- 1 root root 665 Aug 19 2013 site.cfg
drwxr-xr-x 2 root root 4096 Aug 19 2013 tests
[root@lepus MySQLdb1-master]# which mysql_config
/usr/bin/mysql_config
[root@lepus MySQLdb1-master]# vi site.cfg
[options]
# embedded: link against the embedded server library
# threadsafe: use the threadsafe client
# static: link against a static library (probably required for embedded)
embedded = False
threadsafe = True
static = False
# The path to mysql_config.
# Only use this if mysql_config is not on your PATH, or you have some weird
# setup that requires it.
#mysql_config = /usr/local/bin/mysql_config
mysql_config = /usr/bin/mysql_config
# http://stackoverflow.com/questions/1972259/mysql-python-install-problem-using-virtualenv-windows-pip
# Windows connector libs for MySQL. You need a 32-bit connector for your 32-bit Python build.
connector = C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2
~
~
~
~
~
~
"site.cfg" 17L, 701C written
[root@lepus MySQLdb1-master]# python setup.py build
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Traceback (most recent call last):
File "setup.py", line 10, in
use_setuptools()
File "/data/MySQLdb1-master/distribute_setup.py", line 145, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "/data/MySQLdb1-master/distribute_setup.py", line 124, in _do_download
to_dir, download_delay)
File "/data/MySQLdb1-master/distribute_setup.py", line 194, in download_setuptools
src = urlopen(url)
File "/usr/lib64/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib64/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
raise URLError(err)
urllib2.URLError:
[root@lepus MySQLdb1-master]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.221.245 lepus.test.com lepus
[root@lepus MySQLdb1-master]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=lepus.test.com
[root@lepus MySQLdb1-master]# python --verson
Unknown option: --
Unknown option: -e
Unknown option: -r
Unknown option: -o
Unknown option: -n
Unknown option: --
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
[root@lepus MySQLdb1-master]# python --version
Python 2.6.6
[root@lepus MySQLdb1-master]# python setup.py build
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz -------->注意看提示,手动将此包安装,然后再次编译。
Traceback (most recent call last):
File "setup.py", line 10, in
use_setuptools()
File "/data/MySQLdb1-master/distribute_setup.py", line 145, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "/data/MySQLdb1-master/distribute_setup.py", line 124, in _do_download
to_dir, download_delay)
File "/data/MySQLdb1-master/distribute_setup.py", line 194, in download_setuptools
src = urlopen(url)
File "/usr/lib64/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib64/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
raise URLError(err)
urllib2.URLError:
[root@lepus MySQLdb1-master]# python setup.py install
1)下载软件安装包
# cd /usr/local
# git clone https://github.com/ruzuojun/lepus.git
2)对可执行文件授权,并创建软连接
# cd lepus
# chmod +x lepus*
# ln -s /usr/local/lepus/lepus /usr/local/sbin/lepus
# ln -s /usr/local/lepus/lepus_monitor /usr/local/sbin/lepus_mointor
3).在监控机创建监控数据库,并授权。
mysql> create database lepus default character set utf8;
mysql> grant select,insert,update,delete,create on lepus.* to 'lepus_user'@'localhost' identified by '123456';
mysql> flush privileges;
4)导入SQL文件夹里的初始化SQL文件(表结构和数据文件)
# mysql -uroot –p lepus < sql/lepus_table.sql
# mysql -uroot –p lepus < sql/lepus_data.sql
5) 修改配置文件
进入到安装目录/usr/local/lepus
# cd /usr/local/lepus/
# vim etc/config.ini
监控机MySQL数据库连接地址
[monitor_server]
host="127.0.0.1"
port=3306
user=" lepus_user "
passwd="123456"
dbname="lepus"
6) 启动Lepus (可选)
此时,你可以执行启动命令启动lepus采集进程
[root@ebs-cloud lepus]# lepus start
lepus server start success!
[root@ebs-cloud lepus]# ps -ef|grep lepus
root 11553 1 0 14:40 pts/0 00:00:00 /bin/bash /usr/local/sbin/lepus start
root 11555 11553 0 14:40 pts/0 00:00:00 python lepus.py
root 11571 11555 0 14:40 pts/0 00:00:00 python lepus.py
root 11590 1851 0 14:40 pts/0 00:00:00 grep lepus
但是因为没有添加主机,所以查看日志会看到如下提示,属于正常提示。您也可以在部署完Lepus WEB控制台后再进行启动。
[root@ebs-cloud lepus]# tail -f logs/lepus.log
2015-08-03 13:09:09 [WARNING] check mongodb: not found any servers
2015-08-03 13:09:09 [INFO] check mongodb controller finished.
2015-08-03 13:09:12 [INFO] check redis controller started.
2015-08-03 13:09:12 [WARNING] check redis: not found any servers
2015-08-03 13:09:12 [INFO] check redis controller finished.
2015-08-03 13:09:15 [INFO] check os controller started.
2015-08-03 13:09:15 [WARNING] check os: not found any servers
2015-08-03 13:09:15 [INFO] check os controller finished.
2015-08-03 13:09:38 [INFO] alarm controller started.
2015-08-03 13:09:38 [INFO] alarm controller finished.
如果启动失败,可以通过记录的日志信息查看错误,通过log信息我们可以定位启动失败的问题:
# tail -f logs/lepus.log
import functions as func
File "./include/functions.py", line 285, in
mail_host = get_option('smtp_host')
File "./include/functions.py", line 242, in get_option
conn=MySQLdb.connect(host=host,user=user,passwd=passwd,port=int(port),connect_timeout=5,charset='utf8')
File "/usr/lib64/python2.6/site-packages/MySQL_python-1.2.4-py2.6-linux-x86_64.egg/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib64/python2.6/site-packages/MySQL_python-1.2.4-py2.6-linux-x86_64.egg/MySQLdb/connections.py", line 193, in __init__
super(Connection, self).__init__(*args, **kwargs2)
`_mysql_exceptions.OperationalError: (1045, "Access denied for user 'lepus'@'localhost' (using password: YES)")`
到这里,Lepus采集程序安装完毕!
复制lepus/web文件夹里的文件到Apache对应的网站虚拟目录(备注:根据不同的安装方式,这个目录是不一样的,如果采用xampp安装的Apache环境,则默认程序目录为/opt/lampp/htdocs/), 当然,为了更好的维护项目,通常我们会为每个项目配置一个独立的虚拟主机目录。具体步骤如下:
修改/opt/lampp/etc/httpd.conf文件,将下面的denied修改为granted
AllowOverride none
Require all granted
取消这一行的注释
Include etc/extra/httpd-vhosts.conf
修改/opt/lampp/etc/extra/httpd-vhosts.conf 文件,配置虚拟目录,示例如下:
ServerAdmin demo.lepus.cc
DocumentRoot "/usr/local/lepus/web"
ServerName demo.lepus.cc
ServerAlias demo.lepus.cc
ErrorLog "logs/demo.lepus.cc-error_log"
CustomLog "logs/demo.lepus.cc-access_log" common
修改完成后重启apache服务
打开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';
登录进行添加主机和监控
通过浏览器输入IP地址或域名打开监控界面,即可登录系统。.默认管理员账号密码admin/Lepusadmin登录后请修改管理员密码,增加普通账号。
启动和关闭监控系统
执行以下命令启动系统采集进程
# lepus start
执行以下命令关闭系统采集进程
# lepus stop
执行以下命令监控系统是否正常运行
# lepus status
lepus server is running…
查看启动关闭帮助命令
# lepus –help
lepus help:
support-site: www.lepus.cc
====================================================================
start Start lepus monitor server; Command: #lepus start
stop Stop lepus monitor server; Command: #lepus stop
status Check lepus monitor run status; Command: #lepus status