Skip to content

Shell

The shell health check allows you to run a command and validate the response code is expected. This check method can be used to run your own custom scripted health checks easily.

Configuration Keys

The following configuration options apply to the file health check method:

Key Type Default
command String undef
environment Optional Dict undef

Command

The command needs to be set to the command that should be executed.

Environment

The environment parameter can be used to set custom environment variables used by the script/command that needs to be executed. The variables should be specified as key/values.

Examples

Some examples of shell health checks:

A basic configuration:

---

# The list of health checks
checks:

  - name: Example Basic Shell Check
    description: Run the command "true" (will always return exit code 0)
    args:
      method: shell
      command: true
    prefixes:
      - 192.0.2.255
    nexthop: self

An example of running a script with environment variables:

---

# The list of health checks
checks:

  - name: Example Script With Environment Variables
    description: Run a script with environment variables
    args:
      method: shell
      command: /path/to/script.py
      environment:
        EXAMPLE: example environment variable 1
    prefixes:
      - 192.0.2.230
    nexthop: 192.0.2.1