StackStorm - /etc/st2/st2.conf
database.username - MongoDB database username.
database.password - MongoDB database password.
messaging.url - RabbitMQ transport url (amqp://
Mistral - /etc/mistral/mistral.conf
database.connection - PostgreSQL database connection string (postgresql+psycopg2://
transport_url - RabbitMQ transport url (rabbit://
参考: https://docs.stackstorm.com/install/rhel7.html#install-webui-and-setup-ssl-termination
use st2
db.auth("stackstorm","OLQaFY714tcl9WRoBn4OHJjK")
结果如下:
1
终于可以了
查看st2的表:
> show collections;
action_alias_d_b
action_d_b
action_execution_d_b
action_execution_output_d_b
action_execution_scheduling_queue_item_d_b
action_execution_state_d_b
api_key_d_b
config_d_b
config_schema_d_b
group_to_role_mapping_d_b
key_value_pair_d_b
live_action_d_b
pack_d_b
permission_grant_d_b
policy_d_b
policy_type_d_b
role_d_b
rule_d_b
rule_enforcement_d_b
rule_type_d_b
runner_type_d_b
sensor_type_d_b
task_execution_d_b
token_d_b
trace_d_b
trigger_d_b
trigger_instance_d_b
trigger_type_d_b
user_d_b
user_role_assignment_d_b
workflow_execution_d_b
首先相关的表有:
action_alias_d_b
action_d_b
action_execution_d_b
action_execution_output_d_b
action_execution_scheduling_queue_item_d_b
action_execution_state_d_b
接下来一个一个表分析。
db.action_d_b.findOne()
输出结果样例如下:
> db.action_d_b.findOne()
{
"_id" : ObjectId("5c3823a59dc6d67dc88dbda1"),
"uid" : "action:core:announcement",
"metadata_file" : "actions/announcement.yaml",
"name" : "announcement",
"ref" : "core.announcement",
"description" : "Action that broadcasts the announcement to all stream consumers.",
"enabled" : true,
"entry_point" : "",
"pack" : "core",
"runner_type" : {
"name" : "announcement"
},
"parameters" : {
"message" : {
"type" : "object",
"description" : "Message to broadcast."
},
"experimental" : {
"default" : true,
"immutable" : true
}
},
"output_schema" : {
},
"notify" : {
}
}
分析:
这里介绍了core.announcement这个action的具体信息。
查看:
db.action_d_b.findOne({'ref': 'default.counter'})
输出样例结果如下:
> db.action_d_b.findOne({'ref': 'default.counter'})
{
"_id" : ObjectId("5c6f61f59dc6d64891ab5330"),
"uid" : "action:default:counter",
"metadata_file" : "actions/counterActionMeta.yaml",
"name" : "counter",
"ref" : "default.counter",
"description" : "counter action description",
"enabled" : true,
"entry_point" : "counterAction.py",
"pack" : "default",
"runner_type" : {
"name" : "python-script"
},
"parameters" : {
"count" : {
"position" : 1,
"required" : true,
"type" : "integer",
"description" : "the count parameter"
},
"age" : {
"position" : 2,
"required" : true,
"type" : "integer",
"description" : "the age parameter"
},
"cmd" : {
"position" : 0,
"required" : true,
"type" : "string",
"description" : "the cmd parameter"
},
"params" : {
"position" : 3,
"required" : true,
"type" : "string",
"description" : "the params parameter"
}
},
"output_schema" : {
},
"notify" : {
}
}
分析:
uid: 作用尚不清楚 , 样例: "action:default:counter"
name: action的名称, 样例: counter
ref : 可以被其他actionchain或者mistral或者rule引用的动作名称, 样例: "default.counter"
metadata_file: action的元数据文件 , 样例: "actions/counterActionMeta.yaml"
entry_point: action的脚本文件, 样例: "counterAction.py"
pack: action所在的包名称
runner_type: 运行该action的运行器的类型, 是一个字典,样例: {"name" : "python-script"},
parameters: 该action脚本文件需要的参数,是字典,字典中每个元素(也就是该action脚本的一个参数信息)是一个字典,样例如下:
{
"count" : {
"position" : 1,
"required" : true,
"type" : "integer",
"description" : "the count parameter"
},
"age" : {
"position" : 2,
"required" : true,
"type" : "integer",
"description" : "the age parameter"
},
"cmd" : {
"position" : 0,
"required" : true,
"type" : "string",
"description" : "the cmd parameter"
},
"params" : {
"position" : 3,
"required" : true,
"type" : "string",
"description" : "the params parameter"
}
}
而counterActionMeta.yaml
内容如下:
name: "counter"
description: "counter action description"
runner_type: "python-script"
enabled: true
entry_point: "counterAction.py"
parameters:
cmd:
type: "string"
description: "the cmd parameter"
required: true
position: 0
count:
type: "integer"
description: "the count parameter"
required: true
position: 1
age:
type: "integer"
description: "the age parameter"
required: true
position: 2
params:
type: "string"
description: "the params parameter"
required: true
position: 3
比较action的元数据文件和mongodb中action_d_b这个表中定义的动作
两者很很相似。
可以推断: action的元数据文件用于action_d_b这个表中定义对应的动作
查看:
db.action_d_b.findOne({'ref': 'default.multiTask'})
输出结果样例如下:
> db.action_d_b.findOne({'ref': 'default.multiTask'})
{
"_id" : ObjectId("5c8f2acd9dc6d64fd709a7ae"),
"uid" : "action:default:multiTask",
"metadata_file" : "actions/multiTaskMistralMeta.yaml",
"name" : "multiTask",
"ref" : "default.multiTask",
"description" : "multi task mistral description",
"enabled" : true,
"entry_point" : "workflows/multiTaskMistral.yaml",
"pack" : "default",
"runner_type" : {
"name" : "mistral-v2"
},
"parameters" : {
"count" : {
"required" : true,
"type" : "integer"
},
"age" : {
"default" : 20,
"type" : "integer"
},
"cmd" : {
"required" : true,
"type" : "string"
},
"params" : {
"type" : "string"
},
"timeout" : {
"default" : 60,
"type" : "integer"
}
},
"output_schema" : {
},
"notify" : {
}
}
分析: 同上
总结:
action_d_b实际就是st2的动作表,里面包含了每个动作的详细信息,例如:
动作名称,元数据文件,脚本文件,参数,是否开启,锁在的pakc等。
db.action_alias_d_b.findOne()
1) 查询任意一条数据
> db.action_alias_d_b.findOne()
{
"_id" : ObjectId("5c3823aa9dc6d67dc88dbddb"),
"uid" : "action_alias:packs:pack_get",
"metadata_file" : "aliases/pack_get.yaml",
"name" : "pack_get",
"ref" : "packs.pack_get",
"description" : "Get information about installed StackStorm pack.",
"pack" : "packs",
"enabled" : true,
"action_ref" : "packs.get",
"formats" : [
{
"representation" : [
"pack get {{ pack }}"
],
"display" : "pack get
}
],
"ack" : {
"enabled" : false
},
"result" : {
"format" : "{% if execution.status == \"succeeded\" %}\n{% if execution.result.result.pack %}\nGetting back to you about the installed `{{ execution.parameters.pack }}` pack:{~}\nHere's the full entry: ```{{ execution.result.result.pack|to_yaml_string }}```\n{% if execution.result.result.git_status %}\nGit status: ```{{ execution.result.result.git_status }}```\n{% endif %}\n{% else %}\nThe requested pack is not present in your StackStorm installation.\nTo install the pack: `pack install {{ execution.parameters.pack }}`\n{% endif %}\n{% else %}\nCouldn't locate *{{execution.parameters.pack}}*. :({~}\n{% if execution.result.stderr %}*Stderr:* ```{{ execution.result.stderr }}```{% endif %}\n{% endif %}\n"
}
}
2) 查看所有数据
结果如下:
> db.action_alias_d_b.find()
{ "_id" : ObjectId("5c3823aa9dc6d67dc88dbddb"), "uid" : "action_alias:packs:pack_get", "metadata_file" : "aliases/pack_get.yaml", "name" : "pack_get", "ref" : "packs.pack_get", "description" : "Get information about installed StackStorm pack.", "pack" : "packs", "enabled" : true, "action_ref" : "packs.get", "formats" : [ { "representation" : [ "pack get {{ pack }}" ], "display" : "pack get
{ "_id" : ObjectId("5c3823aa9dc6d67dc88dbddc"), "uid" : "action_alias:packs:pack_install", "metadata_file" : "aliases/pack_install.yaml", "name" : "pack_install", "ref" : "packs.pack_install", "description" : "Install/upgrade StackStorm packs.", "pack" : "packs", "enabled" : true, "action_ref" : "packs.install", "formats" : [ { "representation" : [ "pack install {{ packs }}" ], "display" : "pack install
{ "_id" : ObjectId("5c3823aa9dc6d67dc88dbddd"), "uid" : "action_alias:packs:pack_search", "metadata_file" : "aliases/pack_search.yaml", "name" : "pack_search", "ref" : "packs.pack_search", "description" : "Search for packs in StackStorm Exchange and other directories.", "pack" : "packs", "enabled" : true, "action_ref" : "packs.search", "formats" : [ { "representation" : [ "pack search {{ query }}" ], "display" : "pack search
{ "_id" : ObjectId("5c3823aa9dc6d67dc88dbdde"), "uid" : "action_alias:packs:pack_show", "metadata_file" : "aliases/pack_show.yaml", "name" : "pack_show", "ref" : "packs.pack_show", "description" : "Show information about the pack from StackStorm Exchange.", "pack" : "packs", "enabled" : true, "action_ref" : "packs.show", "formats" : [ { "representation" : [ "pack show {{ pack }}" ], "display" : "pack show
{ "_id" : ObjectId("5c3823f39dc6d602090eb7ad"), "uid" : "action_alias:st2:st2_actions_list", "metadata_file" : "aliases/actions_list.yaml", "name" : "st2_actions_list", "ref" : "st2.st2_actions_list", "description" : "List available StackStorm actions.", "pack" : "st2", "enabled" : true, "action_ref" : "st2.actions.list", "formats" : [ "st2 list {{ limit=10 }} actions", "st2 list {{ limit=10 }} actions from {{ pack }}" ], "ack" : { "format" : "Give me just a moment to find the actions for you..." }, "result" : { "format" : "Found {{ execution.result.result | length }} actions:{~}\n{% for action in execution.result.result -%}\n • {{ action.ref }}{{ action.description and ' - ' + action.description }}\n{%+ endfor %}\n" } }
{ "_id" : ObjectId("5c3823f39dc6d602090eb7ae"), "uid" : "action_alias:st2:st2_executions_get", "metadata_file" : "aliases/executions_get.yaml", "name" : "st2_executions_get", "ref" : "st2.st2_executions_get", "description" : "Retrieve details for a single execution.", "pack" : "st2", "enabled" : true, "action_ref" : "st2.executions.get", "formats" : [ "st2 get execution {{ id }}", "st2 show execution {{ id }}", "st2 executions get {{ id }}", "st2 executions show {{ id }}" ] }
{ "_id" : ObjectId("5c3823f39dc6d602090eb7af"), "uid" : "action_alias:st2:st2_executions_list", "metadata_file" : "aliases/executions_list.yaml", "name" : "st2_executions_list", "ref" : "st2.st2_executions_list", "description" : "List available StackStorm executions.", "pack" : "st2", "enabled" : true, "action_ref" : "st2.executions.list", "formats" : [ "st2 list {{ limit=10 }} executions", "st2 list {{ limit=10 }} executions with status {{ status }}", "st2 list {{ limit=10 }} executions for action {{ action }}" ], "ack" : { "format" : "Give me just a moment to find the executions for you..." }, "result" : { "format" : "Found {{ execution.result.result | length }} executions:{~}\n{% for exe in execution.result.result -%}\n • `{{ exe.id }}` for `{{ exe.action.ref }}`: {{ exe.status }}, started at {{ exe.start_timestamp[:19]|replace(\"T\", \" \") }}{% if 'end_timestamp' in exe %}, finished at {{ exe.end_timestamp[:19]|replace(\"T\", \" \") }}{% endif %}.\n{%+ endfor %}\n" } }
{ "_id" : ObjectId("5c3823f39dc6d602090eb7b0"), "uid" : "action_alias:st2:st2_executions_re_run", "metadata_file" : "aliases/executions_re_run.yaml", "name" : "st2_executions_re_run", "ref" : "st2.st2_executions_re_run", "description" : "Re-run an action execution.", "pack" : "st2", "enabled" : true, "action_ref" : "st2.executions.re_run", "formats" : [ "st2 re-run execution {{ id }}", "st2 executions re-run {{ id }}" ] }
{ "_id" : ObjectId("5c3823f39dc6d602090eb7b1"), "uid" : "action_alias:st2:st2_inquiry_respond", "metadata_file" : "aliases/inquiry_respond.yaml", "name" : "st2_inquiry_respond", "ref" : "st2.st2_inquiry_respond", "description" : "Respond to an Inquiry", "pack" : "st2", "enabled" : true, "action_ref" : "st2.inquiry.respond", "formats" : [ "st2 respond to inquiry {{ id }} with {{ response }}" ], "ack" : { "append_url" : false, "format" : "Roger that - let me just make sure this response fits the Inquiry schema.\n" }, "result" : { "format" : "{% if execution.status == \"succeeded\" -%}\n Your response to inquiry {{ execution.parameters.id }} was accepted!\n{%+ else %}\n Your response to inquiry {{ execution.parameters.id }} did not fit the response schema.\n{%+ endif %}" } }
{ "_id" : ObjectId("5c3823f39dc6d602090eb7b2"), "uid" : "action_alias:st2:st2_rules_list", "metadata_file" : "aliases/rules_list.yaml", "name" : "st2_rules_list", "ref" : "st2.st2_rules_list", "description" : "List available StackStorm rules.", "pack" : "st2", "enabled" : true, "action_ref" : "st2.rules.list", "formats" : [ "st2 list {{ limit=10 }} rules", "st2 list {{ limit=10 }} rules from {{ pack }}" ], "ack" : { "format" : "Give me just a moment to find the rules for you..." }, "result" : { "format" : "Found {{ execution.result.result | length }} rules:{~}\n{% for rule in execution.result.result -%}\n • {{ rule.ref }} ({{ rule.trigger.ref }} -> {{ rule.action.ref }}){{ rule.description and ' - ' + rule.description }}\n{%+ endfor %}\n" } }
{ "_id" : ObjectId("5c3823f39dc6d602090eb7b3"), "uid" : "action_alias:st2:st2_sensors_list", "metadata_file" : "aliases/sensors_list.yaml", "name" : "st2_sensors_list", "ref" : "st2.st2_sensors_list", "description" : "List available StackStorm sensors.", "pack" : "st2", "enabled" : true, "action_ref" : "st2.sensors.list", "formats" : [ "st2 list {{ limit=10 }} sensors", "st2 list {{ limit=10 }} sensors from {{ pack }}" ], "ack" : { "format" : "Give me just a moment to find the sensors for you..." }, "result" : { "format" : "Found {{ execution.result.result | length }} sensors:{~}\n{% for sensor in execution.result.result -%}\n - {{ sensor.ref }} ({{ sensor.trigger_types | join(', ') }}) {{ sensor.description and ' - ' + sensor.description }}\n{%+ endfor %}\n" } }
分析:
目前发现action_alias_d_b这个表中的记录的ref大多是:
packs.pack_get
packs.pack_install
st2_actions_list
st2_executions_list
st2.st2_rules_list
st2_sensors_list
这些实际就是st2中自带的一些动作,推断 action_alias_d_b 中的动作都是st2自带的动作,
但不确定。
总结:
action_alias_d_b尚不清楚,推断是st2_actions_list
st2_executions_list
st2.st2_rules_list
等st2内置的动作表。
db.action_execution_d_b.findOne()
样例结果如下:
{
"_id" : ObjectId("5c3823d49dc6d602090eb793"),
"action" : {
"notify" : {
},
"description" : "Action that executes an arbitrary Linux command on the localhost.",
"runner_type" : "local-shell-cmd",
"tags" : [ ],
"enabled" : true,
"name" : "local",
"entry_point" : "",
"metadata_file" : "actions/local.yaml",
"output_schema" : {
},
"uid" : "action:core:local",
"parameters" : {
"cmd" : {
"required" : true,
"type" : "string",
"description" : "Arbitrary Linux command to be executed on the local host."
},
"sudo" : {
"immutable" : true
}
},
"ref" : "core.local",
"id" : "5c3823a69dc6d67dc88dbda6",
"pack" : "core"
},
"runner" : {
"runner_module" : "local_shell_command_runner",
"uid" : "runner_type:local-shell-cmd",
"runner_package" : "local_runner",
"enabled" : true,
"name" : "local-shell-cmd",
"output_schema" : {
},
"runner_parameters" : {
"sudo" : {
"default" : false,
"type" : "boolean",
"description" : "The command will be executed with sudo."
},
"sudo_password" : {
"default" : null,
"secret" : true,
"required" : false,
"type" : "string",
"description" : "Sudo password. To be used when paswordless sudo is not allowed."
},
"env" : {
"type" : "object",
"description" : "Environment variables which will be available to the command(e.g. key1=val1,key2=val2)"
},
"cmd" : {
"type" : "string",
"description" : "Arbitrary Linux command to be executed on the host."
},
"kwarg_op" : {
"default" : "--",
"type" : "string",
"description" : "Operator to use in front of keyword args i.e. \"--\" or \"-\"."
},
"timeout" : {
"default" : 60,
"type" : "integer",
"description" : "Action timeout in seconds. Action will get killed if it doesn't finish in timeout seconds."
},
"cwd" : {
"type" : "string",
"description" : "Working directory where the command will be executed in"
}
},
"id" : "5c38239f9dc6d67c5359bd62",
"description" : "A runner to execute local actions as a fixed user."
},
"liveaction" : {
"runner_info" : {
"hostname" : "localhost.localdomain",
"pid" : 708
},
"parameters" : {
"cmd" : "date -R"
},
"action_is_workflow" : false,
"callback" : {
},
"action" : "core.local",
"id" : "5c3823d49dc6d602090eb792"
},
"status" : "succeeded",
"start_timestamp" : NumberLong("1547183060633727"),
"parameters" : {
"cmd" : "date -R"
},
"context" : {
"user" : "st2admin",
"pack" : "core"
},
"log" : [
{
"status" : "requested",
"timestamp" : ISODate("2019-01-11T05:04:20.647Z")
},
{
"status" : "scheduled",
"timestamp" : ISODate("2019-01-11T05:04:20.770Z")
},
{
"status" : "running",
"timestamp" : ISODate("2019-01-11T05:04:20.927Z")
},
{
"status" : "succeeded",
"timestamp" : ISODate("2019-01-11T05:04:21.100Z")
}
],
"web_url" : "https://localhost.localdomain/#/history/5c3823d49dc6d602090eb793/general",
"result" : {
"failed" : false,
"stderr" : "",
"return_code" : 0,
"succeeded" : true,
"stdout" : "Fri, 11 Jan 2019 13:04:21 +0800"
},
"end_timestamp" : NumberLong("1547183061077667")
}
分析:
1) action_execution_d_b表的作用应该是记录一个动作具体的一次执行情况。
2) action_execution_d_b表的一条记录大致可以分为4块内容:
第一部分是action, 第二部分是runner, 第三部分是liveaction,第四部分是result
action部分:
是介绍此次action执行的action的具体信息,主要包括:
action的元数据文件,脚本文件,运行器类型,参数等。
样例如下:
"action" : {
"notify" : {
},
"description" : "Action that executes an arbitrary Linux command on the localhost.",
"runner_type" : "local-shell-cmd",
"tags" : [ ],
"enabled" : true,
"name" : "local",
"entry_point" : "",
"metadata_file" : "actions/local.yaml",
"output_schema" : {
},
"uid" : "action:core:local",
"parameters" : {
"cmd" : {
"required" : true,
"type" : "string",
"description" : "Arbitrary Linux command to be executed on the local host."
},
"sudo" : {
"immutable" : true
}
},
"ref" : "core.local",
"id" : "5c3823a69dc6d67dc88dbda6",
"pack" : "core"
}
runner部分:
介绍此次action执行action所用的运行器,包含运行器的参数,运行器的模块,所在包等信息。
样例如下:
"runner" : {
"runner_module" : "local_shell_command_runner",
"uid" : "runner_type:local-shell-cmd",
"runner_package" : "local_runner",
"enabled" : true,
"name" : "local-shell-cmd",
"output_schema" : {
},
"runner_parameters" : {
"sudo" : {
"default" : false,
"type" : "boolean",
"description" : "The command will be executed with sudo."
},
"sudo_password" : {
"default" : null,
"secret" : true,
"required" : false,
"type" : "string",
"description" : "Sudo password. To be used when paswordless sudo is not allowed."
},
"env" : {
"type" : "object",
"description" : "Environment variables which will be available to the command(e.g. key1=val1,key2=val2)"
},
"cmd" : {
"type" : "string",
"description" : "Arbitrary Linux command to be executed on the host."
},
"kwarg_op" : {
"default" : "--",
"type" : "string",
"description" : "Operator to use in front of keyword args i.e. \"--\" or \"-\"."
},
"timeout" : {
"default" : 60,
"type" : "integer",
"description" : "Action timeout in seconds. Action will get killed if it doesn't finish in timeout seconds."
},
"cwd" : {
"type" : "string",
"description" : "Working directory where the command will be executed in"
}
},
"id" : "5c38239f9dc6d67c5359bd62",
"description" : "A runner to execute local actions as a fixed user."
},
liveaction部分:
主要介绍执行的action名称,参数等, 运行情况(含进程id)。样例如下:
"liveaction" : {
"runner_info" : {
"hostname" : "localhost.localdomain",
"pid" : 708
},
"parameters" : {
"cmd" : "date -R"
},
"action_is_workflow" : false,
"callback" : {
},
"action" : "core.local",
"id" : "5c3823d49dc6d602090eb792"
},
result部分:
主要介绍此次动作执行的最终结果。主要包含:
是否失败,失败信息,返回码,是否成功,命令执行后的结果输出等。
样例如下:
"result" : {
"failed" : false,
"stderr" : "",
"return_code" : 0,
"succeeded" : true,
"stdout" : "Fri, 11 Jan 2019 13:04:21 +0800"
},
总结:
action_execution_d_b表主要是记录一个动作具体的一次执行情况。
一次动作的执行情况大致可以分为4块内容:
第一部分是action(介绍待执行的action参数,元数据文件,脚本文件等),
第二部分是runner(介绍执行该action的运行器,模块,所在包等),
第三部分是liveaction(介绍action名称,传入的action执行的参数,运行情况等),
第四部分是result(介绍是否成功/失败,输出结果等)
db.action_execution_output_d_b.findOne()
样例输出结果如下:
{
"_id" : ObjectId("5c8b05ab9dc6d605bb842e93"),
"execution_id" : "5c8b05aa9dc6d60af023c7f1",
"action_ref" : "core.local",
"runner_ref" : "local-shell-cmd",
"timestamp" : NumberLong("1552614827038670"),
"output_type" : "stdout",
"data" : "2019年 03月 15日 星期五 09:53:47 CST\n"
}
db.action_execution_output_d_b.find().count()
输出结果:
22507
> db.action_execution_output_d_b.findOne({'action_ref': "default.counter"})
{
"_id" : ObjectId("5c8b05ac9dc6d605dad990a8"),
"execution_id" : "5c8b05ab9dc6d60af023c7f3",
"action_ref" : "default.counter",
"runner_ref" : "python-script",
"timestamp" : NumberLong("1552614828795921"),
"output_type" : "stdout",
"data" : "count: 1, cmd: date, time: 2019-03-15 09:53:48.791081\n"
}
> db.action_execution_output_d_b.find({'action_ref': "default.counter"}).count()
3285
> db.action_execution_output_d_b.find({'action_ref': "default.counter"}).sort({"timestamp": -1})
{ "_id" : ObjectId("5c909b619dc6d605eb66b967"), "execution_id" : "5c909b609dc6d67bcf6dc45a", "action_ref" : "default.counter", "runner_ref" : "python-script", "timestamp" : NumberLong("1552980833536362"), "output_type" : "stdout", "data" : "params: ceilometer-api, age: 29, count: 1439, cmd: date, time: 2019-03-19 15:33:53.535568\n" }
{ "_id" : ObjectId("5c909b619dc6d605cea69250"), "execution_id" : "5c909b609dc6d67bcf6dc458", "action_ref" : "default.counter", "runner_ref" : "python-script", "timestamp" : NumberLong("1552980833259844"), "output_type" : "stdout", "data" : "params: ceilometer-api, age: 26, count: 1439, cmd: date, time: 2019-03-19 15:33:53.258964\n" }
db.action_execution_output_d_b.findOne({"execution_id": "5c3823d49dc6d602090eb792"})
参考:
db.XXX.find({"members":{"$elemMatch":{"name":"BuleRiver1", "age":27}}});
db.action_execution_d_b.findOne({'liveaction.id': '5c8b05aa9dc6d60af023c7f1'})
分析:
这个查询不到结果
db.action_execution_d_b.findOne({'liveaction.id': '5c8b05ab9dc6d605bb842e93'})
db.action_execution_d_b.findOne({'liveaction.id': '5c3823d49dc6d602090eb792'})
分析:
这个是可以查询到结果的
db.action_execution_d_b.findOne({'liveaction.id': '5c909b609dc6d67bcf6dc45a'})
总结:
暂时没有信息
db.live_action_d_b.findOne()
样例结果如下:
{
"_id" : ObjectId("5c3823d49dc6d602090eb792"),
"status" : "succeeded",
"start_timestamp" : NumberLong("1547183060633727"),
"action" : "core.local",
"action_is_workflow" : false,
"parameters" : {
"cmd" : "date -R"
},
"result" : {
"failed" : false,
"stderr" : "",
"return_code" : 0,
"succeeded" : true,
"stdout" : "Fri, 11 Jan 2019 13:04:21 +0800"
},
"context" : {
"user" : "st2admin",
"pack" : "core"
},
"callback" : {
},
"runner_info" : {
"hostname" : "localhost.localdomain",
"pid" : 708
},
"end_timestamp" : NumberLong("1547183061077667")
}
5.3
db.live_action_d_b.findOne({"action": "default.counter"})
样例结果如下:
{
"_id" : ObjectId("5c6f5cb69dc6d64891ab5327"),
"status" : "scheduled",
"start_timestamp" : NumberLong("1550802102984961"),
"action" : "default.counter",
"action_is_workflow" : false,
"parameters" : {
"content" : "hello",
"count" : 1
},
"result" : {
},
"context" : {
"user" : "st2admin",
"pack" : "default"
},
"callback" : {
},
"runner_info" : {
}
}
分析:
没有看出来live_action_d_b表的作用以及和其他表之间的关系
db.action_execution_state_d_b.findOne()
结果如下:
null
分析:
无法分析出action_execution_state_d_b的表结构
db.action_execution_scheduling_queue_item_d_b.findOne()
结果如下:
null
分析:
无法分析出action_execution_scheduling_queue_item_d_b的表结构
db.runner_type_d_b.findOne({"name": "python-script"})
输出结果如下:
{
"_id" : ObjectId("5c38239e9dc6d67c5c23d92e"),
"name" : "python-script",
"description" : "A runner for launching python actions.",
"uid" : "runner_type:python-script",
"enabled" : true,
"runner_package" : "python_runner",
"runner_module" : "python_runner",
"runner_parameters" : {
"debug" : {
"default" : false,
"required" : false,
"type" : "boolean",
"description" : "Enable runner debug mode."
},
"content_version" : {
"required" : false,
"type" : "string",
"description" : "Git revision of the pack content to use for this action execution (git commit sha / tag / branch). Only applies to packs which are git repositories."
},
"log_level" : {
"default" : "DEBUG",
"enum" : [
"AUDIT",
"CRITICAL",
"ERROR",
"WARNING",
"INFO",
"DEBUG"
],
"type" : "string",
"description" : "Default log level for Python runner actions."
},
"env" : {
"type" : "object",
"description" : "Environment variables which will be available to the script."
},
"timeout" : {
"default" : 600,
"type" : "integer",
"description" : "Action timeout in seconds. Action will get killed if it doesn't finish in timeout seconds."
}
},
"output_key" : "result",
"output_schema" : {
"stdout" : {
"required" : true,
"type" : "string"
},
"result" : {
"anyOf" : [
{
"type" : "object"
},
{
"type" : "string"
},
{
"type" : "integer"
},
{
"type" : "number"
},
{
"type" : "boolean"
},
{
"type" : "array"
},
{
"type" : "null"
}
]
},
"stderr" : {
"required" : true,
"type" : "string"
},
"exit_code" : {
"required" : true,
"type" : "integer"
}
}
}
分析:
1) 表作用分析
runner_type_d_b定义了不同的运行器类型,例如python-script,
local-shell-script等
2) 字段分析
name : 运行器名称 , 样例: "python-script",
runner_package : 运行器的包名 ,样例: "python_runner",
runner_module : 运行器的模块, 样例: "python_runner",
runner_parameters : 运行器参数,是一个字典,字典中每个元素是一个参数,样例: {
"debug" : {
"default" : false,
"required" : false,
"type" : "boolean",
"description" : "Enable runner debug mode."
},
...
}
"output_schema" : 输出格式样是,是一个字典,字典中每个元素是一个字典 , 样例: {
"stdout" : {
"required" : true,
"type" : "string"
},
...
}
总结:
runner_type_d_b表主要就是定义了不同的运行器,包含每个运行器的名称,模块,参数,输出样式等
db.rule_d_b.findOne()
输出结果如下:
{
"_id" : ObjectId("5c3823aa9dc6d67dc88dbdda"),
"uid" : "rule:chatops:notify",
"metadata_file" : "rules/notify_hubot.yaml",
"name" : "notify",
"ref" : "chatops.notify",
"description" : "Notification rule to send results of action executions to stream for chatops",
"pack" : "chatops",
"type" : {
"ref" : "standard",
"parameters" : {
}
},
"trigger" : "core.st2.generic.notifytrigger",
"criteria" : {
"trigger.route" : {
"pattern" : "hubot",
"type" : "equals"
}
},
"action" : {
"ref" : "chatops.post_result",
"parameters" : {
"user" : "{{trigger.data.user}}",
"execution_id" : "{{trigger.execution_id}}",
"channel" : "{{trigger.data.source_channel}}"
}
},
"enabled" : true
}
db.rule_d_b.findOne({'ref': 'default.counter'})
输出结果如下:
{
"_id" : ObjectId("5c8f4a6c9dc6d67bcf6d5f3f"),
"tags" : [ ],
"uid" : "rule:default:counter",
"metadata_file" : "",
"name" : "counter",
"ref" : "default.counter",
"description" : "counter sensor rule description",
"pack" : "default",
"type" : {
"ref" : "standard",
"parameters" : {
}
},
"trigger" : "default.counter",
"criteria" : {
"trigger.name" : {
"pattern" : "chao",
"type" : "equals"
}
},
"action" : {
"ref" : "default.multiTask",
"parameters" : {
"count" : "{{ trigger.count }}",
"age" : "{{ trigger.age }}",
"cmd" : "{{ trigger.cmd }}",
"params" : "{{ trigger.params['pod_name'] }}"
}
},
"context" : {
"user" : "st2admin"
},
"enabled" : true
}
分析:
1) 表作用
rule_d_b主要就是定义各个规则。
2) 字段分析
name : 规则名称, 样例: "counter"
ref: 引用的规则名称, 样例: "default.counter"
pack: 规则所在的包名称, 样例: "default"
trigger: 规则的trigger名称, 样例: "default.counter"
criteria: 规则的校验准则,是字典, 样例:
"criteria" : {
"trigger.name" : {
"pattern" : "chao",
"type" : "equals"
}
},
action: 规则校验生效后,执行的动作,是字典,样例:
"action" : {
"ref" : "default.multiTask",
"parameters" : {
"count" : "{{ trigger.count }}",
"age" : "{{ trigger.age }}",
"cmd" : "{{ trigger.cmd }}",
"params" : "{{ trigger.params['pod_name'] }}"
}
},
enabled: 规则是否开启,样例: true
总结:
rule_d_b主要就是定义各个规则,每个规则包含名称,引用名称,
trigger, criteria, action等信息。
db.rule_type_d_b.findOne()
输出结果如下:
{
"_id" : ObjectId("5c3823aa9dc6d67dc88dbdd8"),
"name" : "standard",
"description" : "standard rule that is always applicable.",
"enabled" : true
}
db.rule_type_d_b.find().count()
输出结果如下:
2
> db.rule_type_d_b.find()
{ "_id" : ObjectId("5c3823aa9dc6d67dc88dbdd8"), "name" : "standard", "description" : "standard rule that is always applicable.", "enabled" : true }
{ "_id" : ObjectId("5c3823aa9dc6d67dc88dbdd9"), "name" : "backstop", "description" : "Rule that applies when no other rule has matched for a specific Trigger.", "enabled" : true }
总结:
没有看出来 rule_type_d_b的作用。
db.rule_enforcement_d_b.findOne()
输出结果如下:
{
"_id" : ObjectId("5c3841ca9dc6d67c76ad626a"),
"tags" : [ ],
"trigger_instance_id" : "5c3841ca9dc6d67c76ad6266",
"execution_id" : "5c3841ca9dc6d67c76ad6269",
"rule" : {
"ref" : "examples.sample_rule_with_webhook",
"id" : "5c383feb9dc6d602090eb7e0",
"uid" : "rule:examples:sample_rule_with_webhook"
},
"enforced_at" : NumberLong("1547190730781774"),
"status" : "succeeded"
}
db.rule_enforcement_d_b.find().count()
输出结果如下:
40857
db.rule_enforcement_d_b.findOne({"rule.ref": "default.counter"})
输出结果如下:
{
"_id" : ObjectId("5c6f6b9a9dc6d604e40809f3"),
"tags" : [ ],
"trigger_instance_id" : "5c6f6b9a9dc6d604e40809ef",
"execution_id" : "5c6f6b9a9dc6d604e40809f2",
"rule" : {
"ref" : "default.counter",
"id" : "5c6f68c59dc6d64891ab533e",
"uid" : "rule:default:counter"
},
"enforced_at" : NumberLong("1550805914633998"),
"status" : "succeeded"
}
总结:
不清楚rule_enforcement_d_b的作用,看上去应该是校验某个规则是否可以执行
db.sensor_type_d_b.findOne()
输出结果如下:
{
"_id" : ObjectId("5c38239b9dc6d67dc88dbda0"),
"description" : "Sensor which monitors files for new lines",
"uid" : "sensor_type:linux:FileWatchSensor",
"metadata_file" : "sensors/file_watch_sensor.yaml",
"name" : "FileWatchSensor",
"ref" : "linux.FileWatchSensor",
"pack" : "linux",
"artifact_uri" : "file:///opt/stackstorm/packs/linux/sensors/file_watch_sensor.py",
"entry_point" : "sensors.file_watch_sensor.FileWatchSensor",
"trigger_types" : [
"linux.file_watch.line"
],
"enabled" : true
}
db.sensor_type_d_b.findOne({"ref": "default.CounterSensor"})
输出结果如下:
{
"_id" : ObjectId("5c6f670b9dc6d6118eb95464"),
"description" : "Simple polling sensor that emits count number.",
"uid" : "sensor_type:default:CounterSensor",
"metadata_file" : "sensors/counterSensor.yaml",
"name" : "CounterSensor",
"ref" : "default.CounterSensor",
"pack" : "default",
"artifact_uri" : "file:///opt/stackstorm/packs/default/sensors/counterSensor.py",
"entry_point" : "sensors.counterSensor.CounterSensor",
"trigger_types" : [
"default.counter"
],
"poll_interval" : 60,
"enabled" : true
}
分析:
1) 表作用分析
sensor_type_d_b表主要就是定义不同的传感器类型。
2) 字段分析
name: 传感器名称,样例: "CounterSensor"
ref: 传感器引用的名称, 样例: "default.CounterSensor"
pack: 传感器所在的包,样例: "default"
entry_point: 传感器执行的python文件的类名, 样例: "sensors.counterSensor.CounterSensor"
trigger_types: 传感器的触发器类型,是一个数组,样例:
"trigger_types" : [
"default.counter"
],
poll_interval: 轮询传感器的轮询时间间隔
metadata_file: 传感器的元数据文件,样例: "sensors/counterSensor.yaml"
总结:
sensor_type_d_b表主要就是定义不同的传感器类型,每个传感器包括:
传感器执行的python文件的类名,触发器类型,元数据文件等。
db.pack_d_b.findOne()
输出结果如下:
{
"_id" : ObjectId("5c38239a9dc6d67dc88dbd99"),
"uid" : "pack:default",
"ref" : "default",
"name" : "default",
"description" : "Default pack where all resources created using the API with no pack specified get saved.",
"version" : "1.0.0",
"author" : "StackStorm, Inc.",
"email" : "[email protected]",
"files" : [
"icon.png",
"pack.yaml",
"actions/README.md",
"actions/my_mistral_meta.yaml",
"actions/count_sensor_action_meta.yaml",
"actions/count_sensor_action.py",
"actions/count_sensor_action.sh",
"actions/multi_task_mistral_meta.yaml",
"actions/counterActionMeta.yaml",
"actions/counterAction.py",
"actions/multiTaskMistralMeta.yaml",
"actions/workflows/README.md",
"actions/workflows/my_mistral.yaml",
"actions/workflows/multi_task_mistral.yaml",
"actions/workflows/multiTaskMistral.yaml",
"actions/chains/echochain.yaml",
"rules/README.md",
"rules/count_sensor_rule.yaml",
"rules/counterRule.yaml",
"sensors/README.md",
"sensors/mySensor.py",
"sensors/mySensor_meta.yaml",
"sensors/myPollingSensor.py",
"sensors/myPollingSensor_meta.yaml",
"sensors/count_sensor.py",
"sensors/count_sensor.yaml",
"sensors/countSensor.yaml",
"sensors/counterSensor.yaml",
"sensors/counterSensor.py",
"sensors/alertsaver/__init__.py",
"sensors/alertsaver/mymain.py",
"sensors/alertsaver/etc/alertsaver_action.yaml"
],
"path" : "/opt/stackstorm/packs/default"
}
> db.pack_d_b.find().count()
7
分析:
1) 表作用分析
pack_d_b表就是定义了每个pack的信息。
2) 字段分析
name : 包名,样例: "default"
ref: 包的引用名称,样例: "ref"
files: 包的所有文件,是一个数组,样例:
"files" : [
"icon.png",
"pack.yaml",
"actions/README.md",
"actions/my_mistral_meta.yaml",
"actions/count_sensor_action_meta.yaml",
"actions/count_sensor_action.py",
"actions/count_sensor_action.sh",
"actions/multi_task_mistral_meta.yaml",
"actions/counterActionMeta.yaml",
"actions/counterAction.py",
"actions/multiTaskMistralMeta.yaml",
"actions/workflows/README.md",
"actions/workflows/my_mistral.yaml",
"actions/workflows/multi_task_mistral.yaml",
"actions/workflows/multiTaskMistral.yaml",
"actions/chains/echochain.yaml",
"rules/README.md",
"rules/count_sensor_rule.yaml",
"rules/counterRule.yaml",
"sensors/README.md",
"sensors/mySensor.py",
"sensors/mySensor_meta.yaml",
"sensors/myPollingSensor.py",
"sensors/myPollingSensor_meta.yaml",
"sensors/count_sensor.py",
"sensors/count_sensor.yaml",
"sensors/countSensor.yaml",
"sensors/counterSensor.yaml",
"sensors/counterSensor.py",
"sensors/alertsaver/__init__.py",
"sensors/alertsaver/mymain.py",
"sensors/alertsaver/etc/alertsaver_action.yaml"
],
path: 包所在的路径,样例: "/opt/stackstorm/packs/default"\
总结:
pack_d_b表就是定义了每个pack的信息,每个pack包含名称,引用名称,
文件列表,包路径等信息。
db.trace_d_b.findOne()
输出结果如下:
{
"_id" : ObjectId("5c38239b9dc6d67c76ad624a"),
"uid" : "trace:afb230194a3701d79c81d86159cf8475",
"trace_tag" : "trigger_instance-5c38239b9dc6d67c76ad6249",
"trigger_instances" : [
{
"object_id" : "5c38239b9dc6d67c76ad6249",
"ref" : "core.st2.sensor.process_spawn",
"updated_at" : NumberLong("1547183003367175"),
"caused_by" : {
}
}
],
"rules" : [ ],
"action_executions" : [ ],
"start_timestamp" : NumberLong("1547183003366749")
}
db.trace_d_b.findOne({"trigger_instances.ref": "default.counter"})
输出结果如下:
{
"_id" : ObjectId("5c6f6b9a9dc6d604e40809f0"),
"uid" : "trace:1fabcf94242c7442e4da9731c68e4ee7",
"trace_tag" : "trigger_instance-5c6f6b9a9dc6d604e40809ef",
"trigger_instances" : [
{
"object_id" : "5c6f6b9a9dc6d604e40809ef",
"ref" : "default.counter",
"updated_at" : NumberLong("1550805914582650"),
"caused_by" : {
}
},
{
"object_id" : "5c6f6b9c9dc6d604e40809f8",
"ref" : "core.st2.generic.actiontrigger",
"updated_at" : NumberLong("1550805916939137"),
"caused_by" : {
"type" : "action_execution",
"id" : "5c6f6b9c9dc6d64891ab5340"
}
},
{
"object_id" : "5c6f6b9e9dc6d604e40809fd",
"ref" : "core.st2.generic.actiontrigger",
"updated_at" : NumberLong("1550805918032421"),
"caused_by" : {
"type" : "action_execution",
"id" : "5c6f6b9d9dc6d64891ab5342"
}
},
{
"object_id" : "5c6f6b9e9dc6d604e40809fe",
"ref" : "core.st2.generic.actiontrigger",
"updated_at" : NumberLong("1550805918790246"),
"caused_by" : {
"type" : "action_execution",
"id" : "5c6f6b9e9dc6d64891ab5344"
}
},
{
"object_id" : "5c6f6b9f9dc6d604e40809ff",
"ref" : "core.st2.generic.actiontrigger",
"updated_at" : NumberLong("1550805919954259"),
"caused_by" : {
"type" : "action_execution",
"id" : "5c6f6b9a9dc6d604e40809f2"
}
}
],
"rules" : [
{
"object_id" : "5c6f68c59dc6d64891ab533e",
"ref" : "default.counter",
"updated_at" : NumberLong("1550805914649637"),
"caused_by" : {
"type" : "trigger_instance",
"id" : "5c6f6b9a9dc6d604e40809ef"
}
}
],
"action_executions" : [
{
"object_id" : "5c6f6b9a9dc6d604e40809f2",
"ref" : "default.multiTask",
"updated_at" : NumberLong("1550805914761012"),
"caused_by" : {
"type" : "rule",
"id" : "5c6f68c59dc6d64891ab533e:5c6f6b9a9dc6d604e40809ef"
}
},
{
"object_id" : "5c6f6b9c9dc6d64891ab5340",
"ref" : "core.local",
"updated_at" : NumberLong("1550805916172376"),
"caused_by" : {
"type" : "action_execution",
"id" : "5c6f6b9a9dc6d604e40809f2"
}
},
{
"object_id" : "5c6f6b9d9dc6d64891ab5342",
"ref" : "default.counter",
"updated_at" : NumberLong("1550805917328380"),
"caused_by" : {
"type" : "action_execution",
"id" : "5c6f6b9a9dc6d604e40809f2"
}
},
{
"object_id" : "5c6f6b9e9dc6d64891ab5344",
"ref" : "core.local",
"updated_at" : NumberLong("1550805918315585"),
"caused_by" : {
"type" : "action_execution",
"id" : "5c6f6b9a9dc6d604e40809f2"
}
}
],
"start_timestamp" : NumberLong("1550805914582255")
}
分析:
不清楚 trace_d_b 表的作用
db.trigger_type_d_b.findOne()
输出结果如下:
{
"_id" : ObjectId("5c3823979dc6d67dad9c7cd1"),
"description" : "Trigger encapsulating the completion of an action execution.",
"tags" : [ ],
"uid" : "trigger_type:core:st2.generic.actiontrigger",
"ref" : "core.st2.generic.actiontrigger",
"name" : "st2.generic.actiontrigger",
"pack" : "core",
"payload_schema" : {
"type" : "object",
"properties" : {
"status" : {
},
"start_timestamp" : {
},
"parameters" : {
},
"runner_ref" : {
},
"action_name" : {
},
"result" : {
},
"action_ref" : {
},
"execution_id" : {
}
}
},
"parameters_schema" : {
}
}
db.trigger_type_d_b.find({"ref": "default.counter"})
输出结果如下:
{
"_id": ObjectId("5c6f670b9dc6d6118eb95462"),
"description": "A counter trigger.",
"uid": "trigger_type:default:counter",
"metadata_file": "sensors/counterSensor.yaml",
"ref": "default.counter",
"name": "counter",
"pack": "default",
"payload_schema": {
"type": "object",
"properties": {
"count": {
"type": "number"
},
"name": {
"type": "string"
},
"pythonpath": {
"type": "string"
},
"age": {
"type": "number"
},
"cmd": {
"type": "string"
},
"params": {
"type": "object"
}
}
}
}
分析:
1) 表作用分析
trigger_type_d_b表示的是触发器类型,触发器中定义了
传给规则的数据信息。
2) 字段分析
ref: 触发器引用名称, 样例: "default.counter"
name: 触发器名称, 样例: "counter"
pack: 触发器所在的包名,样例: "default"
metadata_file: 触发器的元数据文件,样例: "sensors/counterSensor.yaml"
payload_schema: 触发器的数据信息,是一个字典,样例:
"payload_schema": {
"type": "object",
"properties": {
"count": {
"type": "number"
},
"name": {
"type": "string"
},
"pythonpath": {
"type": "string"
},
"age": {
"type": "number"
},
"cmd": {
"type": "string"
},
"params": {
"type": "object"
}
}
}
总结:
trigger_type_d_b表定义了各个触发器,每个触发器包含元数据文件,
发送给规则的数据的字段信息等。
db.trigger_d_b.findOne()
输出结果如下:
{
"_id" : ObjectId("5c3823989dc6d67dad9c7cd2"),
"uid" : "trigger:core:st2.generic.actiontrigger:99914b932bd37a50b983c5e7c90ae93b",
"ref" : "core.st2.generic.actiontrigger",
"name" : "st2.generic.actiontrigger",
"pack" : "core",
"type" : "core.st2.generic.actiontrigger",
"ref_count" : 0
}
db.trigger_d_b.find().count()
输出结果:
16
db.trigger_d_b.find({"ref": "default.counter"})
{
"_id": ObjectId("5c6f670b9dc6d6118eb95463"),
"uid": "trigger:default:counter:99914b932bd37a50b983c5e7c90ae93b",
"ref": "default.counter",
"name": "counter",
"pack": "default",
"type": "default.counter",
"ref_count": 0
}
总结:
trigger_d_b表看上去也是罗列来了每个触发器,不清楚这个的作用是什么
db.trigger_instance_d_b.findOne()
输出结果如下:
{
"_id" : ObjectId("5c38239b9dc6d67c76ad6249"),
"trigger" : "core.st2.sensor.process_spawn",
"payload" : {
"timestamp" : 1547183003,
"cmd" : "/opt/stackstorm/st2/bin/python /opt/stackstorm/st2/lib/python2.7/site-packages/st2reactor/container/sensor_wrapper.py --pack=linux --file-path=/opt/stackstorm/packs/linux/sensors/file_watch_sensor.py --class-name=FileWatchSensor --trigger-type-refs=linux.file_watch.line --parent-args=[\"--config-file\", \"/etc/st2/st2.conf\"]",
"pid" : 32347,
"id" : "FileWatchSensor"
},
"occurrence_time" : ISODate("2019-01-11T05:03:23.354Z"),
"status" : "processed"
}
> db.trigger_instance_d_b.find().count()
505165
db.trigger_instance_d_b.find({"trigger": "default.counter"}).sort({"occurrence_time": -1})
输出结果如下:
{
"_id": ObjectId("5c90ca049dc6d66cbbdb55fd"),
"trigger": "default.counter",
"payload": {
"count": 1638,
"name": "chao",
"pythonpath": ":/opt/stackstorm/st2/lib/python2.7/site-packages",
"age": 29,
"cmd": "date",
"params": {
"pod_name": "ceilometer-api",
"node_name": "node-1"
}
},
"occurrence_time": ISODate("2019-03-19T10:52:52.131Z"),
"status": "processed"
},
{
"_id": ObjectId("5c90ca049dc6d66cbbdb55fc"),
"trigger": "default.counter",
"payload": {
"count": 1638,
"name": "chao",
"pythonpath": ":/opt/stackstorm/st2/lib/python2.7/site-packages",
"age": 26,
"cmd": "date",
"params": {
"pod_name": "ceilometer-api",
"node_name": "node-1"
}
},
"occurrence_time": ISODate("2019-03-19T10:52:52.120Z"),
"status": "processed"
}
分析:
1) 表作用分析
trigger_instance_d_b表看上去应该是记录每个触发器每次触发的实例,里面包含了本次触发传递给rule中的payload数据。
2) 字段分析
trigger: 触发器名称,样例: "default.counter"
payload: 当前触发器触发后得到的数据,是一个字典,样例:
"payload": {
"count": 1638,
"name": "chao",
"pythonpath": ":/opt/stackstorm/st2/lib/python2.7/site-packages",
"age": 29,
"cmd": "date",
"params": {
"pod_name": "ceilometer-api",
"node_name": "node-1"
}
},
occurrence_time: 触发器触发的时间,样例: ISODate("2019-03-19T10:52:52.131Z")
status: 触发器的状态,样例: "processed"
总结:
trigger_instance_d_b应该是记录每个触发器每次触发的实例,
每个触发器触发实例中包含了本次触发传递给rule中的payload数据。
db.task_execution_d_b.findOne()
输出结果:
null
总结: 没有数据,无法分析
db.workflow_execution_d_b.findOne()
输出结果:
null
总结: 没有数据,无法分析
综上总结:
动作相关的表如下:
action_d_b: 实际就是st2的动作表,里面包含了每个动作的详细信息,例如: 动作名称,元数据文件,脚本文件,参数,是否开启,所在的pakc等。
action_alias_d_b: 尚不清楚,推断是st2_actions_list,st2_executions_list,st2.st2_rules_list等st2内置的动作表。
action_execution_d_b: 主要是记录一个动作具体的一次执行情况。一次动作的执行情况大致可以分为4块内容:
第一部分是action(介绍待执行的action参数,元数据文件,脚本文件等),
第二部分是runner(介绍执行该action的运行器,模块,所在包等),
第三部分是liveaction(介绍action名称,传入的action执行的参数,运行情况等),
第四部分是result(介绍是否成功/失败,输出结果等)
action_execution_output_d_b:不清楚
live_action_d_b :不清楚(这个表应该挺重要)
action_execution_state_d_b :数据为空,无法分析,不清楚
action_execution_scheduling_queue_item_d_b: 数据为空,无法分析,不清楚
runner_type_d_b: 定义了不同的运行器类型,例如python-script,local-shell-script等,包含每个运行器的名称,模块,参数,输出样式等
规则相关的表如下:
rule_d_b: 主要就是定义各个规则,每个规则包含名称,引用名称,trigger, criteria, action等信息。
rule_type_d_b: 没有看出来 rule_type_d_b的作用
rule_enforcement_d_b: 不清楚,看上去应该是校验某个规则是否可以执行
pack相关的表如下:
pack_d_b: 就是定义了每个pack的信息,每个pack包含名称,引用名称,文件列表,包路径等信息。
传感器和触发器相关的表如下:
sensor_type_d_b: 主要就是定义不同的传感器类型,每个传感器包括: 传感器执行的python文件的类名,触发器类型,元数据文件等。
trigger_type_d_b: 定义了各个触发器,每个触发器包含元数据文件,发送给规则的数据的字段信息等。
trigger_d_b: 表看上去也是罗列来了每个触发器,不清楚这个表的作用是什么
trigger_instance_d_b: 应该是记录每个触发器每次触发的实例,每个触发器触发实例中包含了本次触发传递给rule中的payload数据。
执行相关的表如下:
trace_d_b: 不清楚,这张表应该挺重要
task_execution_d_b: 数据为空,无法分析,不清楚
workflow_execution_d_b: 数据为空,无法分析,不清楚
参考:
[1] https://github.com/StackStorm/st2/tree/v2.6.0
[2] https://docs.stackstorm.com/install/rhel7.html#install-webui-and-setup-ssl-termination