1. 为StackTach创建database,默认使用MySql,也可以 在settings.py 文件中配置其他的.

    create stack db
    mysql -u root -p
    mysql> create database stacktach;
    mysql> grant all privileges on stacktach.* to 'root'@'localhost' indentified by '';
    exit
  2. 安装django和 ./etc/pip-requires.txt
    由于pip-requires.txt中要求django >=1.5.1 < 1.6.0 ,否则在版本1.8.1出错:
    nuc:/opt/stack/stacktach$ python worker/start_workers.py
    Traceback (most recent call last):
    File "worker/start_workers.py", line , in <module>
    from django.db import close_connection
    ImportError: cannot import name close_connection

    所以在virtualenv中安装:

    stacktach$ virtualenv env1
    stacktach$ cd env1/
    stacktach$ source bin/activate
    $ pip install -r etc/pip-requires.txt
  3. Clone this repo
    git clone git://github/openstack/stacktach
  4. Copy and configure the config files in ./etc (see below for details)
    mv etc/sample_stacktach_config.sh etc/stacktach_config.json 
    mv etc/sample_stacktach_worker_config.json etc/stacktach_worker_config.json

    stack_config.json:

    export STACKTACH_DB_NAME="stacktach"
    export STACKTACH_DB_HOST="127.0.0.1"
    export STACKTACH_DB_USERNAME="root"
    export STACKTACH_DB_PASSWORD=""
    export STACKTACH_DB_PORT=""
    export STACKTACH_INSTALL_DIR="./"
    export STACKTACH_DEPLOYMENTS_FILE="etc/stacktach_worker_config.json"
    export STACKTACH_VERIFIER_CONFIG="etc/stacktach_verifier_config.json" export DJANGO_SETTINGS_MODULE="settings"

    如果你的local OpenStack环境为:

  5. [[local|localrc]]
    
    SERVICE_HOST=localhost
    DATABASE_PASSWORD=
    ADMIN_PASSWORD=
    MYSQL_PASSWORD=
    DATABASE_TYPE=mysql
    RABBIT_PASSWORD=guest
    SERVICE_PASSWORD=
    SERVICE_TOKEN=ADMIN

    stacktach_worker_config.json可以配置为:

    {"deployments": [
    {
    "name": "east_coast.prod.global",
    "durable_queue": false,
    "rabbit_host": "127.0.0.1",
    "rabbit_port": ,
    "rabbit_userid": "guest",
    "rabbit_password": "guest",
    "rabbit_virtual_host": "/",
    "exit_on_exception": true,
    "queue_name": "stacktach",
    "topics": {
    "nova": [
    {
    "queue": "notifications.info",
    "routing_key": "notifications.info"
    },
    {
    "queue": "notifications.error",
    "routing_key": "notifications.error"
    }
    ],
    "glance": [
    {
    "queue": "notifications.info",
    "routing_key": "notifications.info"
    },
    {
    "queue": "notifications.error",
    "routing_key": "notifications.error"
    }
    ]
    }
    }
    ]
    }
  6. 创建db tables 
    python manage.py syncdb
    You have installed Django's auth system, and don't have any superusers defined.
    Would you like to create one now? (yes/no): yes
    Username (leave blank to use 'yuntong'):
    Email address: ***@gmail.com
    Password:
    Password (again):
    Superuser created successfully.
  7. Configure OpenStack to publish Notifications back into RabbitMQ (see below)
  8. Restart the OpenStack services.
  9. Run the Worker to start consuming messages. (see below)
    先fix一个bug:
    diff --git a/settings.py b/settings.py
    index b6d27e5..dba5f2d
    --- a/settings.py
    +++ b/settings.py
    @@ -, +, @@ TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    - install_dir + "templates"
    + install_dir + "templates",

    运行start_workers:

  10. source etc/stacktach_config.sh
    $ python worker/start_workers.py
    Starting worker for 'east_coast.prod.global glance'
    Starting worker for 'east_coast.prod.global nova'

    打开rabbitmq的管理界面localhost:15672

  11. Run the web server (python manage.py runserver --insecure)
    python manage.py runserver --insecure
  12. Point your browser to http://127.0.0.1:8000 (the default server location)
    StackTach v2
    
    Fork me on GitHub
    Choose the Deployment to monitor All
    east_coast.prod.global
    或者访问API:
    
    curl -H "Content-Type: application/json" http://localhost:8000/stacky/deployments/ #The list of all available deployments
    [["#", "Name"], [1, "east_coast.prod.global"]]
    curl -H "Content-Type: application/json" http://localhost:8000/stacky/events/ #The distinct list of all event names
    [["Event Name"],
    ["compute.instance.create.end"], ["compute.instance.create.start"], ["compute.instance.exists"], ["compute.instance.update"],
    ["port.create.end"], ["port.create.start"], ["port.update.end"], ["port.update.start"], ["scheduler.select_destinations.end"], ["scheduler.select_destinations.start"],
    ["image.update"], ["scheduler.select_destinations.start"]]
    $ curl -H "Content-Type: application/json" http://localhost:8000/stacky/5b329e1f-c7d1-4fbe-bf15-80fcfbb22024/ #Retrieve all notifications for instances with a given UUID.
  13. Click on stuff, see what happens. You can’t hurt anything, it’s all read-only.

参考:

http://stacktach.com/api.html

http://stacktach.com/install.html

http://stacktach.readthedocs.io/en/latest/setup.html

Installing StackTach的更多相关文章

  1. installing mysql,this may take a few minutes,hold on plz wdcp卡住解决办法

    centos6安装wdcp时make in progress卡住的解决办法 今天在一台centos6的vps上安装wdcp出现的这个问题,到安装程序滚动至下面这里时出现"卡死". ...

  2. MSI Error 1603 installing AppFabric 1.1 / Win7 x64

    MSI Error 1603 installing AppFabric 1.1 / Win7 x64  Archived Forums A-B > AppFabric Caching   先说解 ...

  3. [转]Installing python 2.7 on centos 6.3. Follow this sequence exactly for centos machine only

    Okay for centos 6.4 also On apu.0xdata.loc, after this install was done $ which python /usr/local/bi ...

  4. [转]Installing SharePoint 2013 on Windows Server 2012 R2

    转自:http://www.avivroth.com/2013/07/09/installing-sharepoint-2013-on-windows-server-2012-r2-preview/ ...

  5. 安装mysql odbc遇到error 1918.errror installing ODBC driver mysql ODBC 5.3 ANSI Drive

    环境:Windows server2008r2 安装mysql-connector-odbc-5.3.6-win32 报错 相信错误信息:Error 1918.errror installing OD ...

  6. Using Confluent’s JDBC Connector without installing the entire platform

    转自:https://prefrontaldump.wordpress.com/2016/05/02/using-confluents-jdbc-connector-without-installin ...

  7. Cocoapods的安装报错 - Error installing pods:activesupport requires Ruby version >=2.2.2

    1.打开终端 2 移除现有 Ruby 默认源 输入以下指令 $gem sources --remove https://rubygems.org/ 3.使用新的源 输入以下指令 $gem source ...

  8. Installing Hadoop on Mac OSX Yosemite Tutorial Part 1.

    Installing Hadoop on Mac OSX Yosemite Tutorial Part 1. September 23, 2014 Marek 68 Comments Install ...

  9. pod install出现[!] /bin/bash -c错误,Installing Realm报错

    pod install出现错误,具体错误信息如下: Installing Realm () [!] /bin/bash -c set -e sh build.sh cocoapods-setup co ...

随机推荐

  1. [python数据结构] hashable, list, tuple, set, frozenset

    学习 cs212 unit4 时遇到了 tuple, list, set 同时使用的问题,并且进行了拼接.合并操作.于是我就被弄混了.所以在这里进行一下总结. hashable and unhasha ...

  2. 在腾讯云服务器上实现java web项目部署

    ----------------------------博主讲废话 几天前搞了一台体验七天的腾讯云服务器.之前已实现在新浪云下java web项目的部署,不需要自己搭建环境,比较简单,而且自 己也偷懒 ...

  3. 任务06——封装与单元测试(Markdown版)

    模块代码地址 Core 模块代码地址 单元测试代码地址 两个地址是一样的,为了方便,所以把测试的代码很模块代码放在一起git了. 封装阶段 public class Core { public sta ...

  4. python基础里的那些为什么?

    一.执行python脚本的两种方式? 直接在解释器里编写并在解释器里执行 文件编写,并在终端通过 python 路径  这种方式执行 好,我们就以输出hello world这个例子来比较两种方式的不同 ...

  5. QChart 如何放大缩小?

    #if 0 //QChart 放大缩小 double z = 1.0; QPoint numDegrees = e->angleDelta()/8; double zi = qAbs(0.1*n ...

  6. Unity使用native读取streamingasset里文件

    需求是,使用native方式,读取apk包里的lua代码,读进c#,做解密 一准备unity工程 public class GameMain : MonoBehaviour { public cons ...

  7. 设置请求timeout超时

    import requests r = requests.get("http://www.cnblogs.com/yoyoketang/", timeout=1) # 设置超时 p ...

  8. 【AWS】AWS云计算赋能数字化转型专题研讨会

    点我查看详情 欢迎莅临

  9. mysq数据库的安装和基本操作

    一.数据库的简介 1.什么是数据库? 数据库(database,DB)是指长期存储在计算机内的,有组织,可共享的数据的集合.数据库中的数据按一定的数学模型组织.描述和存储,具有较小的冗余,较高的数据独 ...

  10. 函数编程——匿名函数与lambda(一)

    python允许用lambda关键字创造匿名函数. 匿名函数是因为不需要以标准的方式来声明,比如说,使用def语句. 但是,作为函数,它们也能有参数. 一个完整的lambda“语句”代表了一个表达式, ...