salt.engines.script module

Send events based on a script's stdout

Example Config

engines:
  - script:
      cmd: /some/script.py -a 1 -b 2
      output: json
      interval: 5

Script engine configs:

cmd: Script or command to execute output: Any available saltstack deserializer interval: How often in seconds to execute the command

salt.engines.script.start(cmd, output='json', interval=1)

Parse stdout of a command and generate an event

The script engine will scrap stdout of the given script and generate an event based on the presence of the 'tag' key and its value.

If there is a data obj available, that will also be fired along with the tag.

Example

Given the following json output from a script:

{ "tag" : "lots/of/tacos",
"data" : { "toppings" : "cilantro" }
}

This will fire the event 'lots/of/tacos' on the event bus with the data obj as is.

Parameters
  • cmd -- The command to execute

  • output -- How to deserialize stdout of the script

  • interval -- How often to execute the script