StackStorm / st2

StackStorm (aka "IFTTT for Ops") is event-driven automation for auto-remediation, incident responses, troubleshooting, deployments, and more for DevOps and SREs. Includes rules engine, workflow, 160 integration packs with 6000+ actions (see https://exchange.stackstorm.org) and ChatOps. Installer at https://docs.stackstorm.com/install/index.html
https://stackstorm.com/
Apache License 2.0
6.1k stars 746 forks source link

Rules are failing to get registered #2888

Closed samuelpraveen closed 8 years ago

samuelpraveen commented 8 years ago

root@ubuntu:/opt/stackstorm/packs# st2ctl reload --register-rules Registering content...[flags = --register-rules] 2016-09-07 09:57:17,650 INFO [-] Connecting to database "st2" @ "0.0.0.0:27017" as user "None". 2016-09-07 09:57:17,750 INFO [-] ========================================================= 2016-09-07 09:57:17,750 INFO [-] ############## Registering rules ######################## 2016-09-07 09:57:17,750 INFO [-] ========================================================= 2016-09-07 09:57:18,065 WARNING [-] Failed to register rules: A simple trigger should have been created when registering triggertype. Cannot create trigger: {'type': 'slack.message', 'parameters': {}, 'pack': 'slack'}. Traceback (most recent call last): File "/usr/bin/st2-register-content", line 22, in sys.exit(content_loader.main(sys.argv[1:])) File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/content/bootstrap.py", line 354, in main register_content() File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/content/bootstrap.py", line 329, in register_content register_rules() File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/content/bootstrap.py", line 224, in register_rules raise e st2common.exceptions.triggers.TriggerDoesNotExistException: A simple trigger should have been created when registering triggertype. Cannot create trigger: {'type': 'slack.message', 'parameters': {}, 'pack': 'slack'}.

st2 components status

st2actionrunner PID: 10730 st2actionrunner PID: 10733 st2actionrunner PID: 10736 st2actionrunner PID: 10739 st2api PID: 10747 st2api PID: 10981 st2stream PID: 10754 st2stream PID: 10991 st2auth PID: 10761 st2auth PID: 10995 st2garbagecollector PID: 10768 st2notifier PID: 10775 st2resultstracker PID: 10782 st2rulesengine PID: 10789 st2sensorcontainer PID: 10800 st2chatops PID: 10813 mistral-server PID: 10847 mistral-api PID: 10835 mistral-api PID: 10931

mistral-api PID: 10932

root@ubuntu:/opt/stackstorm/packs# mongo MongoDB shell version: 3.2.9 connecting to: test Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see http://docs.mongodb.org/ Questions? Try the support group http://groups.google.com/group/mongodb-user Server has startup warnings: 2016-09-02T21:10:44.288+0530 I CONTROL [initandlisten] 2016-09-02T21:10:44.288+0530 I CONTROL [initandlisten] * WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. 2016-09-02T21:10:44.288+0530 I CONTROL [initandlisten] * We suggest setting it to 'never' 2016-09-02T21:10:44.288+0530 I CONTROL [initandlisten] 2016-09-02T21:10:44.288+0530 I CONTROL [initandlisten] * WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. 2016-09-02T21:10:44.288+0530 I CONTROL [initandlisten] * We suggest setting it to 'never' 2016-09-02T21:10:44.288+0530 I CONTROL [initandlisten]

use st2 switched to db st2

db.trigger_d_b.find() { "_id" : ObjectId("57c99e3b1d41c81c152f418f"), "uid" : "trigger:core:st2.generic.actiontrigger:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "st2.generic.actiontrigger", "pack" : "core", "type" : "core.st2.generic.actiontrigger", "ref_count" : 0 } { "_id" : ObjectId("57c99e3c1d41c81c152f4191"), "uid" : "trigger:core:st2.generic.notifytrigger:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "st2.generic.notifytrigger", "pack" : "core", "type" : "core.st2.generic.notifytrigger", "ref_count" : 0 } { "_id" : ObjectId("57c99e3c1d41c81c152f4193"), "uid" : "trigger:core:st2.action.file_writen:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "st2.action.file_writen", "pack" : "core", "type" : "core.st2.action.file_writen", "ref_count" : 0 } { "_id" : ObjectId("57c99e3c1d41c81c152f4195"), "uid" : "trigger:core:st2.key_value_pair.create:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "st2.key_value_pair.create", "pack" : "core", "type" : "core.st2.key_value_pair.create", "ref_count" : 0 } { "_id" : ObjectId("57c99e3c1d41c81c152f4197"), "uid" : "trigger:core:st2.key_value_pair.update:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "st2.key_value_pair.update", "pack" : "core", "type" : "core.st2.key_value_pair.update", "ref_count" : 0 } { "_id" : ObjectId("57c99e3c1d41c81c152f4199"), "uid" : "trigger:core:st2.key_value_pair.value_change:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "st2.key_value_pair.value_change", "pack" : "core", "type" : "core.st2.key_value_pair.value_change", "ref_count" : 0 } { "_id" : ObjectId("57c99e3c1d41c81c152f419b"), "uid" : "trigger:core:st2.key_value_pair.delete:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "st2.key_value_pair.delete", "pack" : "core", "type" : "core.st2.key_value_pair.delete", "ref_count" : 0 } { "_id" : ObjectId("57c99e3c1d41c81c152f419d"), "uid" : "trigger:core:st2.sensor.process_spawn:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "st2.sensor.process_spawn", "pack" : "core", "type" : "core.st2.sensor.process_spawn", "ref_count" : 0 } { "_id" : ObjectId("57c99e3c1d41c81c152f419f"), "uid" : "trigger:core:st2.sensor.process_exit:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "st2.sensor.process_exit", "pack" : "core", "type" : "core.st2.sensor.process_exit", "ref_count" : 0 } { "_id" : ObjectId("57c99e3c1d41c81c5e7d0c3a"), "uid" : "trigger:linux:file_watch.line:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "file_watch.line", "pack" : "linux", "type" : "linux.file_watch.line", "ref_count" : 0 } { "_id" : ObjectId("57ce6bb21d41c825b7b3f671"), "uid" : "trigger:sensu:event_handler:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "event_handler", "pack" : "sensu", "type" : "sensu.event_handler", "ref_count" : 0 } { "_id" : ObjectId("57ce6bb21d41c825b7b3f673"), "uid" : "trigger:docker:container_tracker.started:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "container_tracker.started", "pack" : "docker", "type" : "docker.container_tracker.started", "ref_count" : 0 } { "_id" : ObjectId("57ce6bb21d41c825b7b3f675"), "uid" : "trigger:docker:container_tracker.stopped:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "container_tracker.stopped", "pack" : "docker", "type" : "docker.container_tracker.stopped", "ref_count" : 0 } { "_id" : ObjectId("57cea8a11d41c850e2b5c81b"), "uid" : "trigger:autoscale:ScaleDownPulse:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "ScaleDownPulse", "pack" : "autoscale", "type" : "autoscale.ScaleDownPulse", "ref_count" : 0 } { "_id" : ObjectId("57cea8a11d41c850e2b5c81d"), "uid" : "trigger:autoscale:ScaleUpPulse:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "ScaleUpPulse", "pack" : "autoscale", "type" : "autoscale.ScaleUpPulse", "ref_count" : 0 } { "_id" : ObjectId("57cea8a11d41c850e2b5c820"), "uid" : "trigger:typeform:registration:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "registration", "pack" : "typeform", "type" : "typeform.registration", "ref_count" : 0 } { "_id" : ObjectId("57cea8a21d41c850e2b5c823"), "uid" : "trigger:hello-st2:event1:5f02f0889301fd7be1ac972c11bf3e7d", "name" : "event1", "pack" : "hello-st2", "type" : "hello-st2.event1", "ref_count" : 0 }

db.trigger_type_d_b.find() { "_id" : ObjectId("57c99e3b1d41c81c152f418e"), "description" : "Trigger encapsulating the completion of an action execution.", "tags" : [ ], "uid" : "trigger_type:core:st2.generic.actiontrigger", "name" : "st2.generic.actiontrigger", "pack" : "core", "payload_schema" : { "type" : "object", "properties" : { "status" : { }, "start_timestamp" : { }, "parameters" : { }, "action_name" : { }, "result" : { }, "execution_id" : { } } }, "parameters_schema" : { } } { "_id" : ObjectId("57c99e3c1d41c81b9c06d990"), "description" : "Triggers on specified intervals. e.g. every 30s, 1week etc.", "uid" : "trigger_type:core:st2.IntervalTimer", "name" : "st2.IntervalTimer", "pack" : "core", "payload_schema" : { "type" : "object", "properties" : { "executed_at" : { "default" : "2014-07-30 05:04:24.578325", "type" : "string", "format" : "date-time" }, "schedule" : { "default" : { "units" : "seconds", "delta" : 30 }, "type" : "object" } } }, "parameters_schema" : { "additionalProperties" : false, "type" : "object", "properties" : { "timezone" : { "type" : "string" }, "unit" : { "enum" : [ "weeks", "days", "hours", "minutes", "seconds" ], "required" : true }, "delta" : { "required" : true, "type" : "integer" } } } } { "_id" : ObjectId("57c99e3c1d41c81b9c06d991"), "description" : "Triggers exactly once when the current time matches the specified time. e.g. timezone:UTC date:2014-12-31 23:59:59.", "uid" : "trigger_type:core:st2.DateTimer", "name" : "st2.DateTimer", "pack" : "core", "payload_schema" : { "type" : "object", "properties" : { "executed_at" : { "default" : "2014-07-30 05:04:24.578325", "type" : "string", "format" : "date-time" }, "schedule" : { "default" : { "units" : "seconds", "delta" : 30 }, "type" : "object" } } }, "parameters_schema" : { "additionalProperties" : false, "type" : "object", "properties" : { "date" : { "required" : true, "type" : "string", "format" : "date-time" }, "timezone" : { "type" : "string" } } } } { "_id" : ObjectId("57c99e3c1d41c81b9c06d992"), "description" : "Triggers whenever current time matches the specified time constaints like a UNIX cron scheduler.", "uid" : "trigger_type:core:st2.CronTimer", "name" : "st2.CronTimer", "pack" : "core", "payload_schema" : { "type" : "object", "properties" : { "executed_at" : { "default" : "2014-07-30 05:04:24.578325", "type" : "string", "format" : "date-time" }, "schedule" : { "default" : { "units" : "seconds", "delta" : 30 }, "type" : "object" } } }, "parameters_schema" : { "additionalProperties" : false, "type" : "object", "properties" : { "week" : { "minimum" : 1, "anyOf" : [ { "type" : "string" }, { "type" : "integer" } ], "maximum" : 53 }, "hour" : { "minimum" : 0, "anyOf" : [ { "type" : "string" }, { "type" : "integer" } ], "maximum" : 23 }, "day_of_week" : { "minimum" : 0, "anyOf" : [ { "type" : "string" }, { "type" : "integer" } ], "maximum" : 6 }, "month" : { "minimum" : 1, "anyOf" : [ { "type" : "string" }, { "type" : "integer" } ], "maximum" : 12 }, "second" : { "minimum" : 0, "anyOf" : [ { "type" : "string" }, { "type" : "integer" } ], "maximum" : 59 }, "year" : { "anyOf" : [ { "type" : "string" }, { "type" : "integer" } ] }, "timezone" : { "type" : "string" }, "day" : { "minimum" : 1, "anyOf" : [ { "type" : "string" }, { "type" : "integer" } ], "maximum" : 31 }, "minute" : { "minimum" : 0, "anyOf" : [ { "type" : "string" }, { "type" : "integer" } ], "maximum" : 59 } } } } { "_id" : ObjectId("57c99e3c1d41c81c152f4190"), "description" : "Notification trigger.", "tags" : [ ], "uid" : "trigger_type:core:st2.generic.notifytrigger", "name" : "st2.generic.notifytrigger", "pack" : "core", "payload_schema" : { "type" : "object", "properties" : { "status" : { }, "start_timestamp" : { }, "channel" : { }, "action_ref" : { }, "data" : { }, "message" : { }, "execution_id" : { }, "end_timestamp" : { } } }, "parameters_schema" : { } } { "_id" : ObjectId("57c99e3c1d41c81c152f4192"), "description" : "Trigger encapsulating action file being written on disk.", "tags" : [ ], "uid" : "trigger_type:core:st2.action.file_writen", "name" : "st2.action.file_writen", "pack" : "core", "payload_schema" : { "type" : "object", "properties" : { "content" : { }, "host_info" : { }, "ref" : { }, "file_path" : { } } }, "parameters_schema" : { } } { "_id" : ObjectId("57c99e3c1d41c81c152f4194"), "description" : "Trigger encapsulating datastore item creation.", "tags" : [ ], "uid" : "trigger_type:core:st2.key_value_pair.create", "name" : "st2.key_value_pair.create", "pack" : "core", "payload_schema" : { "type" : "object", "properties" : { "object" : { } } }, "parameters_schema" : { } } { "_id" : ObjectId("57c99e3c1d41c81c152f4196"), "description" : "Trigger encapsulating datastore set action.", "tags" : [ ], "uid" : "trigger_type:core:st2.key_value_pair.update", "name" : "st2.key_value_pair.update", "pack" : "core", "payload_schema" : { "type" : "object", "properties" : { "object" : { } } }, "parameters_schema" : { } } { "_id" : ObjectId("57c99e3c1d41c81c152f4198"), "description" : "Trigger encapsulating a change of datastore item value.", "tags" : [ ], "uid" : "trigger_type:core:st2.key_value_pair.value_change", "name" : "st2.key_value_pair.value_change", "pack" : "core", "payload_schema" : { "type" : "object", "properties" : { "new_object" : { }, "old_object" : { } } }, "parameters_schema" : { } } { "_id" : ObjectId("57c99e3c1d41c81c152f419a"), "description" : "Trigger encapsulating datastore item deletion.", "tags" : [ ], "uid" : "trigger_type:core:st2.key_value_pair.delete", "name" : "st2.key_value_pair.delete", "pack" : "core", "payload_schema" : { "type" : "object", "properties" : { "object" : { } } }, "parameters_schema" : { } } { "_id" : ObjectId("57c99e3c1d41c81c152f419c"), "description" : "Trigger indicating sensor process is started up.", "tags" : [ ], "uid" : "trigger_type:core:st2.sensor.process_spawn", "name" : "st2.sensor.process_spawn", "pack" : "core", "payload_schema" : { "type" : "object", "properties" : { "object" : { } } }, "parameters_schema" : { } } { "_id" : ObjectId("57c99e3c1d41c81c152f419e"), "description" : "Trigger indicating sensor process is stopped.", "tags" : [ ], "uid" : "trigger_type:core:st2.sensor.process_exit", "name" : "st2.sensor.process_exit", "pack" : "core", "payload_schema" : { "type" : "object", "properties" : { "object" : { } } }, "parameters_schema" : { } } { "_id" : ObjectId("57c99e3c1d41c81c5e7d0c39"), "description" : "Trigger which indicates a new line has been detected", "uid" : "trigger_type:linux:file_watch.line", "name" : "file_watch.line", "pack" : "linux", "payload_schema" : { "type" : "object", "properties" : { "file_name" : { "type" : "string" }, "line" : { "type" : "string" }, "file_path" : { "type" : "string" } } } } { "_id" : ObjectId("57c99e3c1d41c81c152f41a3"), "description" : "Trigger type for registering webhooks that can consume arbitrary payload.", "tags" : [ ], "uid" : "trigger_type:core:st2.webhook", "name" : "st2.webhook", "pack" : "core", "payload_schema" : { "type" : "object" }, "parameters_schema" : { "additionalProperties" : false, "type" : "object", "properties" : { "url" : { "required" : true, "type" : "string" } } } } { "_id" : ObjectId("57ce6bb21d41c825b7b3f670"), "description" : "Trigger type for sensu event handler.", "uid" : "trigger_type:sensu:event_handler", "name" : "event_handler", "pack" : "sensu" } { "_id" : ObjectId("57ce6bb21d41c825b7b3f672"), "description" : "Trigger which indicates that a container has been started", "uid" : "trigger_type:docker:container_tracker.started", "name" : "container_tracker.started", "pack" : "docker", "payload_schema" : { "type" : "object", "properties" : { "container_info" : { "type" : "object" } } } } { "_id" : ObjectId("57ce6bb21d41c825b7b3f674"), "description" : "Trigger which indicates that a container has been stopped", "uid" : "trigger_type:docker:container_tracker.stopped", "name" : "container_tracker.stopped", "pack" : "docker", "payload_schema" : { "type" : "object", "properties" : { "container_info" : { "type" : "object" } } } } { "_id" : ObjectId("57cea8a11d41c850e2b5c81a"), "description" : "Pulse trigger emitted when an ASG is eligible for deflation", "uid" : "trigger_type:autoscale:ScaleDownPulse", "name" : "ScaleDownPulse", "pack" : "autoscale" } { "_id" : ObjectId("57cea8a11d41c850e2b5c81c"), "description" : "Pulse trigger emitted when an ASG is eligible for expansion", "uid" : "trigger_type:autoscale:ScaleUpPulse", "name" : "ScaleUpPulse", "pack" : "autoscale" } { "_id" : ObjectId("57cea8a11d41c850e2b5c81f"), "description" : "Trigger which indicates a new registration", "uid" : "trigger_type:typeform:registration", "name" : "registration", "pack" : "typeform", "payload_schema" : { "type" : "object", "properties" : { "first_name" : { "type" : "string" }, "last_name" : { "type" : "string" }, "source" : { "type" : "string" }, "referer" : { "type" : "string" }, "date_submit" : { "type" : "string" }, "date_land" : { "type" : "string" }, "newsletter" : { "type" : "string" }, "email" : { "required" : true, "type" : "string" } } } } Type "it" for more

Kami commented 8 years ago

@samuelpraveen Some rules depends on triggers which are registered via sensors or triggers (in Slack case, trigger is registered via sensor).

Please run register content flag with --register-sensors --register-triggers flag. This way all the necessary triggers which are used by rules will be registered as well.

Kami commented 8 years ago

Note to myself / us : We should consider catching TriggerDoesNotExistException exception in scenario like this and throw a more user-friendly exception (something along the lines I have written above).

lakshmi-kannan commented 8 years ago

@Kami: @samuelpraveen did run it with --register-triggers flag indeed. See https://stackstorm-community.slack.com/files/samuelp/F28SP5ZU3/-.txt. I think there is a legit bug somewhere.

samuelpraveen commented 8 years ago

@Kami: @lakshmi-kannan: running with --register-sensors and --register-triggers flag was fine. snippet is below

root@ubuntu:/opt/stackstorm/virtualenvs# st2ctl reload --register-triggers Registering content...[flags = --register-triggers] 2016-09-08 10:26:05,814 INFO [-] Connecting to database "st2" @ "0.0.0.0:27017" as user "None". 2016-09-08 10:26:05,906 INFO [-] ========================================================= 2016-09-08 10:26:05,906 INFO [-] ############## Registering triggers ##################### 2016-09-08 10:26:05,906 INFO [-] ========================================================= 2016-09-08 10:26:06,110 INFO [-] Registered 1 triggers.

st2 components status

st2actionrunner PID: 10730 st2actionrunner PID: 10733 st2actionrunner PID: 10736 st2actionrunner PID: 10739 st2api PID: 7242 st2api PID: 7248 st2stream PID: 10754 st2stream PID: 10991 st2auth PID: 10761 st2auth PID: 10995 st2garbagecollector PID: 10768 st2notifier PID: 10775 st2resultstracker PID: 10782 st2rulesengine PID: 10789 st2sensorcontainer PID: 10800 st2chatops PID: 10813 mistral-server PID: 10847 mistral-api PID: 10835 mistral-api PID: 10931 mistral-api PID: 10932 root@ubuntu:/opt/stackstorm/virtualenvs# root@ubuntu:/opt/stackstorm/virtualenvs# root@ubuntu:/opt/stackstorm/virtualenvs# st2ctl reload --register-sensors Registering content...[flags = --register-sensors] 2016-09-08 10:26:35,411 INFO [-] Connecting to database "st2" @ "0.0.0.0:27017" as user "None". 2016-09-08 10:26:35,507 INFO [-] ========================================================= 2016-09-08 10:26:35,507 INFO [-] ############## Registering sensors ###################### 2016-09-08 10:26:35,507 INFO [-] ========================================================= 2016-09-08 10:26:35,993 INFO [-] Registered 5 sensors.

st2 components status

st2actionrunner PID: 10730 st2actionrunner PID: 10733 st2actionrunner PID: 10736 st2actionrunner PID: 10739 st2api PID: 7242 st2api PID: 7248 st2stream PID: 10754 st2stream PID: 10991 st2auth PID: 10761 st2auth PID: 10995 st2garbagecollector PID: 10768 st2notifier PID: 10775 st2resultstracker PID: 10782 st2rulesengine PID: 10789 st2sensorcontainer PID: 10800 st2chatops PID: 10813 mistral-server PID: 10847 mistral-api PID: 10835 mistral-api PID: 10931 mistral-api PID: 10932

estee-tew commented 7 years ago

https://stackstorm.slack.com/archives/community/p1492452560239740

estee-tew commented 7 years ago

https://stackstorm.slack.com/archives/community/p1493069677024278