stacktach和ceilometer

 

 

 

架构图

Winchester 来蒸馏notification,变成event,再利用Streams 转换成新的event或者notification。

类似于Ceilometer event处理,由event handler把notification转换成Ceilometer event并存储起来。

最后Notabene 可以把Winchester出来的notification重新发布到message bus上做进一步的处理,这个过程可以反复。

这个对应到Ceilometer上就是把event transformer出来的event转换成notification在重新发布到message bus上,可以进一步,比如把它处理成meter,

Ceilometer正在实现这个功能,BP在这儿:event to sample publisher https://review.openstack.org/#/c/223926/

 

Yagi配置:

[global]
verbose = False
debug = True
update_timer = 10

[event_worker]
event_driver = yagi.broker.rabbit.Broker

[rabbit_broker]
host = localhost
user = guest
password = guest
port = 5672
vhost = /
poll_delay = 0.5

[consumers]
queues = monitor.info

[consumer:monitor.info]
apps = winchester.yagi_handler.WinchesterHandler, yagi.handler.shoebox_handler.ShoeboxHandler
exchange = monitor
exchange_type = topic
routing_key = monitor.info
durable = True
max_messages = 100

Notifications 到 Events的提取,由winchester.yagi_handler:WinchesterHandler来做这部分工作。

把Notifications中有用的field提取为event的 Traits。在配置文件中定义。

例子:

- event_type: compute.instance.*
  traits: 
    tenant_id:
      fields:
        - payload.tenant_id
        - _context_project_id
    user_id:
      fields: payload.user_id
    request_id:
        fields: _context_request_id
    instance_id:
      fields:
        - payload.instance_uuid
        - payload.instance_id
        - exception.kwargs.uuid
        - instance.uuid

 

这点和ceilometer很类似,ceilometer的配置文件event_definitions中定义了每个event需要提前哪些traits。

接下来就是在streams中处理event,streams就是事件分发到的bucket(Streams are buckets that collect events)。

采用类似于ceilometer中的event pipeline机制。把event分发到pipeline,pipeline中最后部分是handler,

Winchester 配置文件:

---
database:
    url: mysql://winchester:testpasswd@localhost/winchester

distiller_config: event_definitions.yaml
trigger_definitions: triggers.yaml
pipeline_config: pipelines.yaml

pipeline_handlers:
    logger: winchester.pipeline_handler:LoggingHandler
    usage: winchester.pipeline_handler:UsageHandler
    notabene: winchester.pipeline_handler:NotabeneHandler

 

其中:

trigger_definitions: triggers.yaml 中决定

  • into which streams to place incoming events
  • which events to accept into a stream
  • when a stream is ready for processing
  • when a stream expires
  • how to process ready streams
  • how to process expired streams
- name: my_trigger
  distinguished_by:
  - request_id
  expiration: "$last + 1h"
  fire_pipeline: "my_fire_pipeline"
  expire_pipeline: "my_expire_pipeline"
  match_criteria:
  - event_type:
    - compute.instance.*
  fire_criteria:
  - event_type: compute.instance.*.end

上面 distinguished_by:request_id,也就是不同的request发到不同的stream bucket中。

match_criteria定义这个pipelinez需要处理的事件,类似ceilometer event_pipeline,yaml中的source - events配置。

fire_criteria: 定义了何时触发stream bucket中的event的处理。比如最后一次收到事件之后的2小时,或者基于特定事件如收到compute.instance.*.end。

最后如何处理stream bucket中的event定义在fire_pipeline: "my_fire_pipeline"中。可以有多个pipeline handlers, 类似于ceilometer event_pipeline,yaml中

的sinks中的publisher。

fire_pipeline的配置:

---
my_fire_pipeline:
    - logger
    - usage
    - name: notabene
      params: 
        host: localhost
        user: guest
        password: guest
        exchange_type: topic
        queue_name: monitor.info
        env_keys:
            - usage_notifications

my_expire_pipeline:
    - logger
    - usage

再来看看pipeline中的handler:

UsageHandler is a pipeline handler for determining the daily usage of every instance with an OpenStack Nova deployment

NotabeneHandler will take any new notifications (not events)publish them to the RabbitMQ exchange specified.

 

总结与Ceilometer的区别:

stacktach只用来处理notification

ceilometer可以处理notification和meter还有alarm

都可以把notification转换成event来保存和处理,stacktach的处理更丰富和到位

ceilometer主要还是生成数据和meter

stacktach中的pipeline不能单个或者2个event做transformer。

stacktach有处理触发机制,一次对bucket event处理,效率更高。

 

https://github.com/openstack/stacktach

http://stacktach.readthedocs.org/

http://stacktach.com/about.html

https://www.openstack.org/summit/openstack-summit-hong-kong-2013/session-videos/presentation/stacktach-ceilometer-integration

 

posted on 2015-11-19 14:28  allcloud  阅读(576)  评论(0编辑  收藏  举报

导航