基础设施优化服务 (watcher) 命令行客户端¶
watcher 客户端是基础设施优化服务 (watcher) API 及其扩展的命令行界面 (CLI)。
本章节记录 watcherclient 版本 4.9.0。
要获取特定 watcher 命令的帮助,请输入
$ watcher help COMMAND
watcher usage¶
usage: watcher [--version] [-v | -q] [--log-file LOG_FILE] [-h] [--debug]
[--no-auth] [--os-identity-api-version <identity-api-version>]
[--os-auth-url <auth-url>] [--os-region-name <region-name>]
[--os-username <auth-user-name>] [--os-user-id <auth-user-id>]
[--os-password <auth-password>]
[--os-user-domain-id <auth-user-domain-id>]
[--os-user-domain-name <auth-user-domain-name>]
[--os-tenant-name <auth-tenant-name>]
[--os-tenant-id <tenant-id>]
[--os-project-id <auth-project-id>]
[--os-project-name <auth-project-name>]
[--os-project-domain-id <auth-project-domain-id>]
[--os-project-domain-name <auth-project-domain-name>]
[--os-auth-token <auth-token>]
[--os-watcher-api-version <os-watcher-api-version>]
[--os-endpoint-type OS_ENDPOINT_TYPE]
[--os-endpoint-override <endpoint-override>] [--insecure]
[--os-cacert <ca-certificate>] [--os-cert <certificate>]
[--os-key <key>] [--timeout <seconds>]
watcher 可选参数¶
--version显示程序版本号并退出
-v, --verbose增加输出的详细程度。可以重复使用。
-q, --quiet抑制输出,只显示警告和错误。
--log-file LOG_FILE指定一个用于记录输出的文件。默认禁用。
-h, --help显示帮助信息并退出。
--debug在发生错误时显示回溯信息。
--no-auth, -N不使用身份验证。
--os-identity-api-version <identity-api-version>指定要使用的 Identity API 版本。默认为
env[OS_IDENTITY_API_VERSION]或 3。--os-auth-url <auth-url>, -A <auth-url>默认值为
env[OS_AUTH_URL]。--os-region-name <region-name>, -R <region-name>默认为
env[OS_REGION_NAME]。--os-username <auth-user-name>, -U <auth-user-name>默认值为
env[OS_USERNAME]。--os-user-id <auth-user-id>默认为
env[OS_USER_ID]。--os-password <auth-password>, -P <auth-password>默认值为
env[OS_PASSWORD]。--os-user-domain-id <auth-user-domain-id>默认为
env[OS_USER_DOMAIN_ID]。--os-user-domain-name <auth-user-domain-name>默认为
env[OS_USER_DOMAIN_NAME]。--os-tenant-name <auth-tenant-name>, -T <auth-tenant-name>默认值为
env[OS_TENANT_NAME]。--os-tenant-id <tenant-id>, -I <tenant-id>默认值为
env[OS_TENANT_ID]。--os-project-id <auth-project-id>另一种指定租户 ID 的方式。此选项与 –os-tenant-id 互斥。默认值为
env[OS_PROJECT_ID]。--os-project-name <auth-project-name>另一种指定租户名称的方式。此选项与 –os-tenant-name 互斥。默认值为
env[OS_PROJECT_NAME]。--os-project-domain-id <auth-project-domain-id>默认值为
env[OS_PROJECT_DOMAIN_ID]。--os-project-domain-name <auth-project-domain-name>默认值为
env[OS_PROJECT_DOMAIN_NAME]。--os-auth-token <auth-token>默认值为
env[OS_AUTH_TOKEN]。--os-watcher-api-version <os-watcher-api-version>默认为
env[OS_INFRA_OPTIM_API_VERSION]。--os-endpoint-type OS_ENDPOINT_TYPE默认为
env[OS_ENDPOINT_TYPE]或 “publicURL”。--os-endpoint-override <endpoint-override>使用此 API 端点,而不是服务目录。
watcher action list¶
usage: watcher action list [-h] [-f {csv,html,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--action-plan <action-plan>] [--audit <audit>]
[--detail] [--limit <limit>] [--sort-key <field>]
[--sort-dir <direction>] [--marker <marker>]
列出检索到的操作信息。
可选参数
-h, --help显示此帮助消息并退出
--action-plan <action-plan>用于筛选的行动计划的 UUID。
--audit <audit>用于过滤的审计的 UUID。
--detail显示操作的详细信息。
--limit <limit>每次请求返回的最大操作数,0 表示无限制。默认值是 Watcher API 服务使用的最大数量。
--sort-key <field>用于排序的操作字段。
--sort-dir <direction>排序方向:“asc”(默认)或“desc”。
--marker <marker>上一页的最后一个操作的 UUID;显示“marker”之后的动作列表。
watcher action show¶
usage: watcher action show [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent] [--prefix PREFIX]
<action>
显示给定操作的详细信息。
位置参数
<action>操作的 UUID
可选参数
-h, --help显示此帮助消息并退出
watcher action update¶
usage: watcher action update [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent] [--prefix PREFIX]
[--state <state>] [--reason <reason>] <action>
更新操作命令。
位置参数
<action>操作的 UUID
可选参数
-h, --help显示此帮助消息并退出
--state <state>操作的新状态(例如,SKIPPED)。
--reason <reason>操作状态更改的原因。
watcher actionplan cancel¶
usage: watcher actionplan cancel [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--prefix PREFIX]
<action-plan>
取消操作计划命令。
位置参数
<action-plan>action_plan 的 UUID。
可选参数
-h, --help显示此帮助消息并退出
watcher actionplan create¶
usage: watcher actionplan create [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--prefix PREFIX] -a <audit_template>
[-t <audit_type>]
创建新的审计。
可选参数
-h, --help显示此帮助消息并退出
-a <audit_template>, --audit-template <audit_template>用于此审计的审计模板(名称或 UUID)。
-t <audit_type>, --audit_type <audit_type>审计类型。必须是 ONESHOT 或 CONTINUOUS。默认值为 ONESHOT。
watcher actionplan delete¶
usage: watcher actionplan delete [-h] <action-plan> [<action-plan> ...]
删除操作计划命令。
位置参数
<action-plan>操作计划的 UUID
可选参数
-h, --help显示此帮助消息并退出
watcher actionplan list¶
usage: watcher actionplan list [-h] [-f {csv,html,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--audit <audit>] [--detail] [--limit <limit>]
[--marker <actionplan>] [--sort-key <field>]
[--sort-dir <direction>]
列出检索到的操作计划信息。
可选参数
-h, --help显示此帮助消息并退出
--audit <audit>用于过滤的审计的 UUID。
--detail显示操作计划的详细信息。
--limit <limit>每次请求返回的最大操作计划数,0 表示无限制。默认值是 Watcher API 服务使用的最大数量。
--marker <actionplan>上一页的最后一个 actionplan UUID;显示“marker”之后的 actionplan 列表。
--sort-key <field>用于排序的操作计划字段。
--sort-dir <direction>排序方向:“asc”(默认)或“desc”。
watcher actionplan show¶
usage: watcher actionplan show [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--prefix PREFIX]
<action-plan>
显示给定操作计划的详细信息。
位置参数
<action-plan>操作计划的 UUID
可选参数
-h, --help显示此帮助消息并退出
watcher actionplan start¶
usage: watcher actionplan start [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--prefix PREFIX]
<action-plan>
启动操作计划命令。
位置参数
<action-plan>action_plan 的 UUID。
可选参数
-h, --help显示此帮助消息并退出
watcher actionplan update¶
usage: watcher actionplan update [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--prefix PREFIX]
<action-plan> <op> <path=value>
[<path=value> ...]
更新操作计划命令。
位置参数
<action-plan>action_plan 的 UUID。
<op>操作:“add”、“replace”或“remove”。
<path=value>要添加、替换或删除的属性。可以多次指定。对于“remove”,只需要 <path> 即可。
可选参数
-h, --help显示此帮助消息并退出
watcher audit create¶
usage: watcher audit create [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent] [--prefix PREFIX]
[-t <audit_type>] [-p <name=value>]
[-i <interval>] [-g <goal>] [-s <strategy>]
[-a <audit_template>] [--auto-trigger]
创建新的审计。
可选参数
-h, --help显示此帮助消息并退出
-t <audit_type>, --audit_type <audit_type>审计类型。必须是 ONESHOT 或 CONTINUOUS。默认值为 ONESHOT。
-p <name=value>, --parameter <name=value>记录策略参数/值元数据。可以多次指定。
-i <interval>, --interval <interval>审计间隔(以秒或 cron 格式为单位)。Cron 间隔可以使用如下格式: “*/5 * * * *”。仅当审计为 CONTINUOUS 时才使用。
-g <goal>, --goal <goal>与此审计关联的目标 UUID 或名称。
-s <strategy>, --strategy <strategy>与此审计关联的策略 UUID 或名称。
-a <audit_template>, --audit-template <audit_template>用于此审计的审计模板(名称或 UUID)。
--auto-trigger审计成功后自动触发操作计划。
watcher audit delete¶
usage: watcher audit delete [-h] <audit> [<audit> ...]
删除审计命令。
位置参数
<audit>审计的 UUID 或名称
可选参数
-h, --help显示此帮助消息并退出
watcher audit list¶
usage: watcher audit list [-h] [-f {csv,html,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent]
[--quote {all,minimal,none,nonnumeric}] [--detail]
[--goal <goal>] [--strategy <strategy>]
[--limit <limit>] [--sort-key <field>]
[--sort-dir <direction>]
列出检索到的审计信息。
可选参数
-h, --help显示此帮助消息并退出
--detail显示审计的详细信息。
--goal <goal>用于过滤的目标的 UUID 或名称。
--strategy <strategy>用于过滤的策略的 UUID 或名称。
--limit <limit>每次请求返回的最大审计数,0 表示无限制。默认值是 Watcher API 服务使用的最大数量。
--sort-key <field>用于排序的审计字段。
--sort-dir <direction>排序方向:“asc”(默认)或“desc”。
watcher audit show¶
usage: watcher audit show [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent] [--prefix PREFIX]
<audit>
显示给定审计的详细信息。
位置参数
<audit>审计的 UUID 或名称
可选参数
-h, --help显示此帮助消息并退出
watcher audit update¶
usage: watcher audit update [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent] [--prefix PREFIX]
<audit> <op> <path=value> [<path=value> ...]
更新审计命令。
位置参数
<audit>审计的 UUID 或名称。
<op>操作:“add”、“replace”或“remove”。
<path=value>要添加、替换或删除的属性。可以多次指定。对于“remove”,只需要 <path> 即可。
可选参数
-h, --help显示此帮助消息并退出
watcher audittemplate create¶
usage: watcher audittemplate create [-h]
[-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--prefix PREFIX] [-s <strategy>]
[-d <description>] [--scope <path>]
<name> <goal>
创建新的审计模板。
位置参数
<name>此审计模板的名称。
<goal>与此审计模板关联的目标 UUID 或名称。
可选参数
-h, --help显示此帮助消息并退出
-s <strategy>, --strategy <strategy>与此审计模板关联的策略 UUID 或名称。
-d <description>, --description <description>审计模板的描述。
--scope <path>将执行审计的集群的一部分。可以提供 YAML 或 JSON 文件。
YAML 示例
---
- host_aggregates:
- id: 1
- id: 2
- id: 3
- availability_zones:
- name: AZ1
- name: AZ2
- exclude:
- instances:
- uuid: UUID1
- uuid: UUID2
- compute_nodes:
- name: compute1
JSON 示例
[
{'host_aggregates': [
{'id': 1},
{'id': 2},
{'id': 3}]},
{'availability_zones': [
{'name': 'AZ1'},
{'name': 'AZ2'}]},
{'exclude': [
{'instances': [
{'uuid': 'UUID1'},
{'uuid': 'UUID2'}]},
{'compute_nodes': [
{'name': 'compute1'}]}]}
]
watcher audittemplate delete¶
usage: watcher audittemplate delete [-h]
<audit-template> [<audit-template> ...]
删除审计模板命令。
位置参数
<audit-template>审计模板的 UUID 或名称
可选参数
-h, --help显示此帮助消息并退出
watcher audittemplate list¶
usage: watcher audittemplate list [-h] [-f {csv,html,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--detail] [--goal <goal>]
[--strategy <strategy>] [--limit <limit>]
[--sort-key <field>]
[--sort-dir <direction>][--marker <marker>]
列出检索到的审计模板信息。
可选参数
-h, --help显示此帮助消息并退出
--detail显示审计模板的详细信息。
--goal <goal>用于过滤的目标的 UUID 或名称。
--strategy <strategy>用于过滤的策略的 UUID 或名称。
--limit <limit>每次请求返回的最大审计模板数,0 表示无限制。默认值是 Watcher API 服务使用的最大数量。
--sort-key <field>用于排序的审计模板字段。
--sort-dir <direction>排序方向:“asc”(默认)或“desc”。
--marker <marker>上一页的最后一个 audittemplate 的 UUID;显示“marker”之后的 audittemplate 列表。
watcher audittemplate show¶
usage: watcher audittemplate show [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--prefix PREFIX]
<audit-template>
显示给定审计模板的详细信息。
位置参数
<audit-template>审计模板的 UUID 或名称
可选参数
-h, --help显示此帮助消息并退出
watcher audittemplate update¶
usage: watcher audittemplate update [-h]
[-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--prefix PREFIX]
<audit-template> <op> <path=value>
[<path=value> ...]
更新审计模板命令。
位置参数
<audit-template>审计模板的 UUID 或名称。
<op>操作:“add”、“replace”或“remove”。
<path=value>要添加、替换或删除的属性。可以多次指定。对于“remove”,只需要 <path> 即可。
可选参数
-h, --help显示此帮助消息并退出
watcher goal list¶
usage: watcher goal list [-h] [-f {csv,html,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent]
[--quote {all,minimal,none,nonnumeric}] [--detail]
[--limit <limit>] [--sort-key <field>]
[--sort-dir <direction>][--marker <marker>]
列出检索到的目标信息。
可选参数
-h, --help显示此帮助消息并退出
--detail显示每个目标的详细信息。
--limit <limit>每次请求返回的最大目标数,0 表示无限制。默认值是 Watcher API 服务使用的最大数量。
--sort-key <field>用于排序的目标字段。
--sort-dir <direction>排序方向:“asc”(默认)或“desc”。
--marker <marker>上一页的最后一个目标 UUID;显示“marker”之后的目标列表。
watcher goal show¶
usage: watcher goal show [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent] [--prefix PREFIX]
<goal>
显示给定目标的详细信息。
位置参数
<goal>目标的 UUID 或名称
可选参数
-h, --help显示此帮助消息并退出
watcher scoringengine list¶
usage: watcher scoringengine list [-h] [-f {csv,html,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--detail] [--limit <limit>]
[--sort-key <field>]
[--sort-dir <direction>][--marker <marker>]
列出检索到的评分引擎信息。
可选参数
-h, --help显示此帮助消息并退出
--detail显示评分引擎的详细信息。
--limit <limit>每次请求返回的最大操作数,0 表示无限制。默认值是 Watcher API 服务使用的最大数量。
--sort-key <field>用于排序的操作字段。
--sort-dir <direction>排序方向:“asc”(默认)或“desc”。
--marker <marker>上一页的最后一个 scoringengine 的 UUID;显示“marker”之后的 scoringengine 列表。
watcher scoringengine show¶
usage: watcher scoringengine show [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--prefix PREFIX]
<scoring_engine>
显示给定评分引擎的详细信息。
位置参数
<scoring_engine>评分引擎的名称
可选参数
-h, --help显示此帮助消息并退出
watcher service list¶
usage: watcher service list [-h] [-f {csv,html,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent]
[--quote {all,minimal,none,nonnumeric}] [--detail]
[--limit <limit>] [--sort-key <field>]
[--sort-dir <direction>]
列出检索到的服务信息。
可选参数
-h, --help显示此帮助消息并退出
--detail显示每个服务的详细信息。
--limit <limit>每次请求返回的最大服务数,0 表示无限制。默认值是 Watcher API 服务使用的最大数量。
--sort-key <field>用于排序的目标字段。
--sort-dir <direction>排序方向:“asc”(默认)或“desc”。
watcher service show¶
usage: watcher service show [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent] [--prefix PREFIX]
<service>
显示给定服务的详细信息。
位置参数
<service>服务的 ID 或名称
可选参数
-h, --help显示此帮助消息并退出
watcher datamodel list¶
usage: watcher datamodel list [-h] [-f {csv,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--sort-column SORT_COLUMN] [--type <type>]
[--audit <audit>] [--detail]
列出检索到的数据模型信息。
可选参数
-h, --help显示此帮助消息并退出
--type <type>要列出的数据模型的类型。支持的值:compute。未来支持的值:storage、baremetal。默认类型为 compute。
--audit <audit>审计的 UUID。用于根据审计中的范围过滤数据模型。
--detail显示数据模型的详细信息。
watcher strategy list¶
usage: watcher strategy list [-h] [-f {csv,html,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--goal <goal>] [--detail] [--limit <limit>]
[--sort-key <field>] [--sort-dir <direction>]
[--marker <marker>]
列出检索到的策略信息。
可选参数
-h, --help显示此帮助消息并退出
--goal <goal>目标的 UUID 或名称
--detail显示每个策略的详细信息。
--limit <limit>每次请求返回的最大策略数,0 表示无限制。默认值是 Watcher API 服务使用的最大数量。
--sort-key <field>用于排序的目标字段。
--sort-dir <direction>排序方向:“asc”(默认)或“desc”。
--marker <marker>上一页的最后一个策略 UUID;显示“marker”之后的策略列表。
watcher strategy show¶
usage: watcher strategy show [-h] [-f {html,json,shell,table,value,yaml}]
[-c COLUMN] [--max-width <integer>] [--fit-width]
[--print-empty] [--noindent] [--prefix PREFIX]
<strategy>
显示给定策略的详细信息。
位置参数
<strategy>策略的 UUID 或名称
可选参数
-h, --help显示此帮助消息并退出
watcher strategy state¶
usage: watcher strategy state [-h] [-f {csv,html,json,table,value,yaml}]
[-c COLUMN] [--max-width <integer>]
[--fit-width] [--print-empty] [--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--sort-column SORT_COLUMN]
<strategy>
检索策略需求信息。
位置参数
<strategy>策略的名称
可选参数
-h, --help显示此帮助消息并退出