Get the App
SLTechnology News&Howtos  ›  Servers  › 

Automation ST2

Shulou Source: shulou.com Published: 2022-06-03 08:04:32 10月04日 Update

Sensors & Trigger

Inductor & trigger

Sensor: a Python plug-in for inbound or outbound integration that accepts or monitors events, respectively. When an external system generates an event and is processed by a sensor, the system generates a trigger action. The sensor can not only passively accept the event trigger inbound, but also take the initiative to poll the event regularly and trigger the corresponding action. Trigger: the event built by ST2 to identify the incoming st2 is a tuple of type (string) and optional parameters (object). Rules works with triggers. In general, sensors register a trigger, but this is not necessary, such as webhook triggers.

How to write Sensor:

The inductor is written in Python and must follow the interface requirements defined by ST2.

Action

action

When trigger triggers and matches the canonical crieria, the action is executed. It can perform operations directly from the client through cli/API/UI, and multiple operations can be integrated into workflows to complete complex operations, which can be done in any programming language. Common actions: restart the service / create a new CVM / accept an alarm / send a notification via SMS or email

/ send notification to IRC channel/ that a message occurs to slack/ to enable a container / take a VM snapshot / run Nagios check

Action Runners

Action operator

The environment in which the user implements the action, ST2 provides some basic action runner so that the user can focus on the implementation of the action itself, rather than setting up the environment

Custom action

Use metadata described by yaml to describe actions and inputs

A script that implements the logic of action

Specification:

The script must exit successful execution with a state of 0, and all log information of non-0 exit errors must be printed out as standard error.

To be continued. )

Tags: Actions sensors events triggers environments users systems scripts services complexity initiative success this is not information parameters foundations multiple characters strings customers Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information vpn Xiaomi Shulou Tech Info Redmi