Skip to main content

Running Automations

When creating an Automation, an Automation type must be selected (manual, event-based or scheduled). Depending on which Automation type is selected, the Automation has different run methods available. We provide these run methods to enable users to easily integrate with Blink from external systems.

Manual and scheduled Automations

Run methods for manual and scheduled Automations include:

  • Manual: Using the User Interface.
  • URL: The automation URL can be copied and used in Postman or another tool. For authentication one needs to add a header (BLINK-API-KEY).
  • CLI: Using Blink CLI.
  • Rest API: Invoking an HTTP request.

The default run method for a scheduled Automation is the frequency set when creating the Automation.

On the Automation screen, in the Overview section, you can see alternative Run methods displayed.

runmethods

Manually running an Automation

An Automation can be run from the Automations screen.

  1. Hover over the automation you want to run.
  2. A blue Run button and a grey Edit button will appear.
  3. If required, you will be prompted to enter input parameters.
  4. Click Run.

RunRunPlaybook

URL

This is the URL to can be used to run the Automation using your browser.

  1. Copy and paste the URL into the browser address bar. A dialog box will open.
  2. Enter the Automation's input parameters.
  3. Click Run Automation to start the automation execution.

RunURL

REST API

Running an Automation using a rest HTTP call. This methods can be used to run automations from other tools or from the command line using the cURL utility like in the following example. The example is using cURL, but any utility that can run an HTTP call can be used.

  1. Select Run methods.
  2. Select the check box Add my personal API key. Your personal API key is entered into the command.
  3. Copy the command and paste it into your CLI and your Automation will run.

RunRestAPI

Example

curl -XPOST -H 'BLINK-API-KEY: <api-key>' -H 'Content-Type: application/json'  https://app.blinkops.com/api/v1/workspace/aeb40442-ff12-4071-be15-b0709e59030e/playbooks/f6a68c7f-e585-4f8c-b8b2-f8a82192f4e/execute

To supply parameters called x and y to the automation execution add the following parameters:

-d '{"x":"y", "a":"b"}'

Synchronous REST API invocation

It is possible to execute the Automation synchronously, and to wait for it to finish by adding run_sync parameter and optionally timeout parameter. For example:

curl -XPOST -H 'BLINK-API-KEY: <api-key>' -H 'Content-Type: application/json'  https://app.blinkops.com/api/v1/workspace/aeb40442-ff12-4071-be15-b0709e59030e/playbooks/f6a68c7f-e585-4f8c-b8b2-f8a82192f4e/execute\?run_sync\=1\&timeout\=40

If the Automation succeeds, the response will be the output parameters' JSON. If not, it will result in an error.

Run Blinks CLI, assuming you have Docker installed on your system.

RunCLI

Example

docker run --rm -it blinkops/blink-cli playbooks execute --id f6a68c7f-e585-4f8c-b8b2-f8a8219c2f4e --workspace "Demo Workspace" --inputs {"name": "value"} --hostname "https://app.blinkops.com" --api-key <api-key>

This command will download a container with blink-cli and run the blink-cli inside docker. By modifying the --input parameters we can pass Automation input parameters.

Running Automation Steps asynchronously

When using an Automation as a subflow in another Automation, you can opt to run the Automations asynchronously. This enables the Automation to be executed faster as subflows are not dependent on the execution of other steps. For more details refer to Flow Control Actions.

Event-based Automations

Event-based Automations provide an easy way to execute a workflow when an event happens on an external system. To achieve this, the external system must perform an HTTP POST to the custom webhook's URL. Meanwhile,other event-based automations function by periodically polling the external system to check for new events.

Custom webhook

Custom webhooks offer real-time event triggering as the Blink system gets the event from the external service provider when it occurs.

  1. When creating a new Automation, select Event-based > Custom webhook.
    Under Run methods the following options are displayed:
    Webhook URL: A Webhook URL is displayed and you can use it to externally run the Automation. It does not require an API key, thus it is a more secure and preferred way to run an Automation.
    CURL: An example of a cURL command that sends an event using a POST request is displayed.

Custom Syslog

Custom Syslog offers real-time event triggering in the Blink system when a Syslog event occurs, by receiving events from an external Syslog client provider.

Custom Syslog is a service which converts Syslog messages into webhooks and activates the webhook with the content of the Syslog message as the payload.

Syslog Message Conversion

Custom Syslog performs the conversion of Syslog messages to webhooks in the following way:

  • Standard Syslog Message (before conversion):

    <30>Jul 20 10:00:00 app-server-01 kernel: Out of memory: Kill process 12345 (app) score 678 and restart
  • Converted Syslog Message (after being processed by the Custom Syslog service):

     {
    "timestamp": "Jul 20 10:00:00",
    "hostname": "app-server-01",
    "source": "kernel",
    "message": "Out of memory: Kill process 12345 (app) score 678 and restart"
    }

Deployment and Configuration

To enable real-time event triggering in the Blink system using Custom Syslog, follow these steps:

  1. When creating a new Automation, choose Event-based > Custom Webhook.

    • You will see the Webhook URL, which you'll use in the docker run command later on.
  2. Copy the Webhook URL from the event-based automation you created and paste it in the following docker run command:

     docker run -d --name blink-syslog -p 514:514/udp -p 514:514/tcp -e WEBHOOK_URL=<your_webhook_url> --restart unless-stopped blinkops/blink-syslog:1.0.224
  3. Deploy the Syslog Docker container on any infrastructure of your choice and run the docker command that's specified above. This could be on-premises hardware, cloud-based virtual machines, or even managed container services like Amazon ECS, Google Kubernetes Engine, etc.

  4. Ensure that the Syslog Docker container is exposed to the Syslog client. Make sure the necessary ports (UDP and TCP 514 by default for Syslog) are open to receive Syslog messages from the clients.

  5. Configure your Syslog client to send messages to the IP address of the machine where the Syslog Docker container is deployed.

Once the Docker container is running and the Syslog client is configured, the Docker container will start receiving Syslog events. Each received Syslog event will trigger the associated automation.

Event occurring on an external service provider

There are no run methods available from the Blink platform. Automations are triggered when the polling job finds new events on an external system.

  1. When creating a new Automation, select Event-based > Select an event.
    Run methods displays the event or time specified when setting up the trigger. For example; Automatically will search for new events every 5 minutes.