Triggers
Triggers
Manual triggers
Manual triggers are used to create a shortcut for a set of steps that are done often. Instead of performing a number of individual tasks, in sequence, again and again, the user simple initiates a workflow each time. Consider this example:
Before:
user steps:
remote log into system
Username: user
Password: password
scp /etc/log/file1.log cloud:/device[123]/files
scp /etc/log/file2.log cloud:/device[123]/files
scp /etc/log/file3.log cloud:/device[123]/files
scp /etc/log/file4.log cloud:/device[123]/files
scp /etc/log/file5.log cloud:/device[123]/files
Log out
After:
workflow definition:
trigger: manual
name: pull-files
model: zafaroni 2500
steps:
Run Command [zip /tmp/logfiles.zip /etc/log/file*.log]
Run Command [curl -X POST -X POST "http://localhost:5465/mailink/v1/telemetry"
-H "accept: */*" -H "Content-Type: application/json"
-d '{"path":"/tmp/logfiles.zip","destinationPath":"logfiles.zip"}']
user steps:
initiate pull-files
Manual initiation of a workflow is done through the maiLink portal with no typing. This is obviously more efficient, but also means fewer errors are made.
Automated triggers
Automated triggers occur when the maiLink cloud detects that certain conditions have been met. Currently, automated triggers are all based on telemetry. We expect that to change in the coming months.
Telemetry triggers
Each time a telemetry message is received in the cloud, it is evaluated against all the workflows that are defined for that model (the model of the device that sent the telemtry message) with the same type as the message. As an example, if there are four workflows of type Event defined for model “Sanguis 2500”, and an Event telemetry message is received by the cloud froma Sanguis 2500 system, then the conditions in those four workflows will each be evaluated. It is possible that four workflows will be triggered.
Suppose that four workflows are defined as shown below. If a telemetry metric message is received from a Baristamatic 2500 system with “motor_rpm” value of 55, then you can see that three workflows are triggered (Workflow 4 has the right model, but does not meet the condition; Workflow 5 has the wrong model, so the condition is ignored).
Workflow | Model | Condition | Triggered? |
---|---|---|---|
1 | Baristamatic 2500 | metric.name == “motor_rpm” and metric.value < 100 | Yes |
2 | Baristamatic 2500 | metric.name == “motor_rpm” and metric.value < 80 | Yes |
3 | Baristamatic 2500 | metric.name == “motor_rpm” and metric.value < 60 | Yes |
4 | Baristamatic 2500 | metric.name == “motor_rpm” and metric.value < 40 | No |
5 | Baristamatic E130 | metric.name == “motor_rpm” and metric.value < 60 | No |
For details on the syntax for conditions, please see Condition Syntax.