Slack notification for failed automation. #6343
Unanswered
mayank-shruti
asked this question in
UI
Replies: 2 comments
-
There are a few ways to do this, I usually use the notify on-failure option https://docs.stackstorm.com/chatops/notifications.html?highlight=notify This will send a notification if the workflow/task ends in a failure. action.meta.yaml file
rule definition
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Otherwise if I'm doing it in an action workflow, I'll use something like this
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have created rule file and playbook to send failed automation information in slack channel. But not getting any value for failed automation in slack channel. It is not working, can any one please help me to make it running successfully. Below is rule file and playbook.
rule file:--
name: notify_slack_on_failure
pack: test_pack
description: Notify Slack on any StackStorm failure
trigger:
type: core.st2.generic.actiontrigger
criteria:
trigger.payload.status:
pattern: "failed"
type: "equals"
action:
ref: ansible.playbook
parameters:
connection: local
cwd: /opt/stackstorm/packs/test_pack/actions/playbooks/
env: {}
extra_vars:
- "execution_id={{trigger.payload.execution_id}}"
- "action_name={{trigger.payload.action_name}}"
- "failed_time={{trigger.payload.start_timestamp}}"
- "task_set={{trigger.payload.parameters | to_json}}"
- "error_msg={{trigger.payload.result.stderr | default(trigger.payload.result.stdout) | default('No error details available')}}"
inventory_file: 'localhost,'
list_hosts: false
playbook: /opt/stackstorm/packs/test_pack/actions/playbooks/slack_failure_notification.yaml
timeout: 15000
enabled: true
playbook:--
tasks:
- name: Debug received variables
debug:
msg:
- "Execution ID: {{ execution_id }}"
- "Action Name: {{ action_name }}"
- "Failed Time: {{ failed_time }}"
- "Task Set: {{ task_set }}"
- "Error Message: {{ error_msg }}"
Beta Was this translation helpful? Give feedback.
All reactions