watcher
https://wiki.openstack.org/wiki/Watcher
Watcher为OS提供资源优化。主要是通过虚拟机迁移来提高整个数据中心的运营效率,降低TCO。
功能特点:
- 通过虚拟机迁移来提高整个数据中心的运营效率和各种优化
- advise mode (manual) or active mode (automatic),两种执行模式
- 通过plugin来扩展
架构图:
https://wiki.openstack.org/wiki/WatcherArchitecture
其中:
- Complex Event Processing (CEP) 对event分析和做出相应的反应,数据会写到Time Series database,
如果该event会影响到优化的结果,输入到Decision Engine。
- Time Series database存储数据中心/集群的各种state, metrics, events, ...,以便Decision Engine随时查询。
- Watcher Actions Applier执行CEP的action,需要与Watcher DB连接来获取ation的描述,并把action的状态写入DB
- REST API 提供Watcher中资源的操作,包括:Audit Templates Audits ActionPlans Actions,下面有说明例子。
- Watcher Database保存以上Watcher中资源。
- Watcher Decision Engine复杂根据优化目标来指定具体的优化措施。
影响最优操作的因素有:
- optimization goals
- deadline
- aggressiveness level
- Watcher Logger 把从Watcher Message/Notification Bus 来的event转送到CEP
如何使用
https://factory.b-com.com/www/watcher/doc/watcher/deploy/user-guide.html
1, 创建 audit template来定义优化目标
$ watcher audit-template-create my_first_audit SERVERS_CONSOLIDATION
2, 创建audit来请求优化
$ watcher audit-create -a <your_audit_template_uuid>
3 等待audit产生action计划,list action:
$ watcher action-plan-list --audit <the_audit_uuid>
4 每个action plan的具体action:
watcher action-list --action-plan <the_action_plan_uuid>
5, 执行action plan:
$ watcher action-plan-start <the_action_plan_uuid>
6, 查看action执行情况:
$ watcher action-list
RESTAPI资源
https://factory.b-com.com/www/watcher/doc/watcher/webapi/v1.html
Audit Templates
{ "created_at": "2015-11-04T10:06:04.328837", "deleted_at": null, "description": "Description of my audit template", "extra": { "automatic": true }, "goal": "SERVERS_CONSOLIDATION", "host_aggregate": 5, "links": ..."name": "My Audit Template", "updated_at": "2015-11-04T10:06:04.328840", "uuid": "27e3153e-d5bf-4b7e-b517-fb518e17f34c" }
Audits
{ "audit_template_name": null, "audit_template_uuid": "7ae81bb3-dec3-4289-8d6c-da80bd8001ae", "created_at": "2015-11-04T10:06:04.465252", "deadline": null, "deleted_at": null, "links": ..."state": "PENDING", "type": "ONESHOT", "updated_at": "2015-11-04T10:06:04.465255", "uuid": "27e3153e-d5bf-4b7e-b517-fb518e17f34c" }
ActionPlans
{ "audit_uuid": "abcee106-14d3-4515-b744-5a26885cf6f6", "created_at": "2015-11-04T10:06:04.599433", "deleted_at": null, "first_action_uuid": "57eaf9ab-5aaa-4f7e-bdf7-9a140ac7a720", "links": ..."state": "ONGOING", "updated_at": "2015-11-04T10:06:04.599439", "uuid": "9ef4d84c-41e8-4418-9220-ce55be0436af" }
Actions
{ "actions": [ { "action_plan_uuid": "7ae81bb3-dec3-4289-8d6c-da80bd8001ae", "links": ..."next_uuid": "7ae81bb3-dec3-4289-8d6c-da80bd8001ae", "state": "PENDING", "uuid": "27e3153e-d5bf-4b7e-b517-fb518e17f34c" } ] }