1. Home
  2. Lepus监控系统官方文档(V3版本)
  3. 安装部署
  4. 安装Lepus采集器

安装Lepus采集器


注:在安装Lepus系统之前,请先根据前面内容安装LAMP和Python运行基础环境。

 

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 'xxxxxx';
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="xxxxxx"
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 <module>
    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采集程序安装完毕!

这篇文档是否帮助到了您? 2

2条评论

  • 启动失败,日志如下Traceback (most recent call last):
    File “lepus.py”, line 15, in
    import functions as func
    File “./include/functions.py”, line 285, in
    mail_host = get_option(‘smtp_host’)
    File “./include/functions.py”, line 251, in get_option
    return result[0]
    TypeError: ‘int’ object has no attribute ‘__getitem__’

发表评论