Skip to content

Instantly share code, notes, and snippets.

Troubleshoot a Rule

Scenario.

I set up a sensor to watch for a trigger (trigger represents an external event; sensor will fire a trigger-instance of the trigger type when the event is detected). I created a rule: if the trigger happens, and matches the criteria, it should fire an action. I see that event had happened. I expected the actions to fire. But it didn't happen. Where does it break?

This is a long read, and may look complicated. But really, it's just three debugging steps. And it's long because I refuse to write briefly, drop bunch of hints on the way and get you distracted. But as they say in math, the thicker the math book the faster it reads. Embrace yourself.

In the example below, I'll be using a case of tweeter to slack relay that we debugged last night exactly by this "runbook". The "runbook" is generic and applies to other rule debugging just fine.

@dzimine
dzimine / st2-self-check
Created February 28, 2016 07:11
st2-self-check modification for new StackStorm package installations
#!/bin/bash
function usage() {
echo ""
echo "Usage: $0"
echo ""
echo "Options:"
echo " -w Run Windows tests"
echo ""
>&2
@dzimine
dzimine / var_lib_docker_repositories-aufs
Last active December 31, 2015 18:03
Learning docker
{
"architecture": "amd64",
"author": "NGINX Docker Maintainers \"docker-maint@nginx.com\"",
"config": {
"Hostname": "609b1a101af3",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
@dzimine
dzimine / Vagrantfile
Created December 22, 2015 06:23
st2_test_ground DZ edition (see https://github.com/manasdk/st2-test-ground)
# -*- mode: ruby -*-
# vi: set ft=ruby :
hostname = ENV['HOSTNAME'] ? ENV['HOSTNAME'] : 'st2test'
ip_start=40
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
@dzimine
dzimine / uchiwa.json
Created August 24, 2015 06:22
sensu uchiwa simple example - /etc/sensu/uchiwa.json
{
"sensu": [
{
"name": "Sensu",
"host": "localhost",
"ssl": false,
"port": 4567,
"path": "",
"timeout": 5000
}
@dzimine
dzimine / MyApp.java
Last active August 29, 2015 14:27
Java action in StackStorm. Used https://code.google.com/p/json-simple/ DO NOT DELETE - used in blog.stackstorm.com
//opt/stackstorm/packs/default/actions/MyApp.java
// Used https://code.google.com/p/json-simple/, download and save as lib/json-simple-1.1.1.jar
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
class MyApp
{
public static void main(String[] args)
{
JSONObject obj = new JSONObject();
@dzimine
dzimine / RigthAnswer.py
Last active August 29, 2015 14:16
SQL Alchemy: cut parameter on Update
class WorkflowExecution(mb.MistralSecureModelBase):
"""Contains workflow execution information."""
__tablename__ = 'executions_v2'
id = mb.id_column()
wf_name = sa.Column(sa.String(80))
wf_spec = sa.Column(st.JsonDictType())
start_params = sa.Column(st.JsonDictType())
state = sa.Column(sa.String(20))
@dzimine
dzimine / cmd.coffee
Last active March 4, 2024 21:31
A script to make Hubot run a command. Done both in JS and coffee script. Never put it in production :)
# Description:
# Runs a command on hubot
# TOTAL VIOLATION of any and all security!
#
# Commands:
# hubot cmd <command> - runs a command on hubot host
module.exports = (robot) ->
robot.respond /CMD (.*)$/i, (msg) ->
# console.log(msg)
@dzimine
dzimine / nova-node-maintenance
Created March 6, 2014 02:15
Mistral workflow (with variations) implements the compute node maintanance procedure, as described here: http://docs.openstack.org/trunk/openstack-ops/content/maintenance.html#planned_maintenance_compute_node. It raises some assumptions and questiosn for good discussion.
Workflow:
name: Compute node planned maintainance
input: [ host, migrage_target_host]
output: ''
on-task-failure: std.continue #catch-all, just like exception handling...
tasks:
list-vms:
action: ListVMs
parameters: