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.

On-Demand and Scheduled Automations

Run methods for On-Demand 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 the Blink CLI.
  • Rest API: Invoking an HTTP request.
info

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 all the Run Method options 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 "Overview" button will appear.

  3. If required, you will be prompted to enter input parameters.

  4. Click the "Run" button.

RunRunPlaybook

URL

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

  1. Hover over the automation you want to run.

  2. A blue "Run" button and a grey "Overview" button will appear.

  3. Select the "Overview" button and navigate to the run methods section of the overview.

  4. Navigate to the URL tab.

  5. Copy and paste the URL into the browser address bar. A dialog box will open.

  6. Enter the Automation's input parameters.

  7. 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. Hover over the automation you want to run.

  2. A blue "Run" button and a grey "Overview" button will appear.

  3. Select the "Overview" button and navigate to the run methods section of the overview.

  4. Navigate to the REST API tab.

  5. Under the Add my personal API key section, choose a personal API Key from the dropdown menu. Your personal API key will automatically be added to the command.

  6. Copy the command and paste it into your CLI and your Automation will run.

RunRestAPI

REST API 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.

info

To use the Blink CLI as a run method, you need to have Docker installed on your computer.

  1. Hover over the automation you want to run.

  2. A blue "Run" button and a grey "Overview" button will appear.

  3. Select the "Overview" button and navigate to the run methods section of the overview.

  4. Navigate to the Blink CLI tab.

  5. Under the Add my personal API key section, choose a personal API Key from the dropdown menu. Your personal API key will automatically be added to the command.

  6. Copy the command and paste it into your CLI and your Automation will run.

RunCLI

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 Subflow Actions

Running 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

For more information on creating and using Custom Webhooks, visit the Custom Webhooks section of the Documents.

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.