Command Line Client (CLI)
The Outlyer CLI enables users to import and export their entire account configuration as a local folder structure and YAML files. This enables users to support several use cases easily:
- The ability to update and edit their account configuration via code and push updates when performing releases
- The ability to version control all their account configuration via Git
- The ability to export all their check/plugin configuration to deploy to the agent via Configuration Management
Installing on macOS
If you are on macOS and using Homebrew package manager, you can install it with:
$ brew tap outlyerapp/outlyer-cli https://github.com/outlyerapp/outlyer-cli
$ brew install outlyer-cli
Installing on Linux
- Download and extract the latest release with the command:
$ curl -L https://github.com/outlyerapp/outlyer-cli/releases/download/1.0.4/outlyer-cli_1.0.4_Linux_x86_64.tar.gz | tar xvz
- Make the
outlyer
binary executable:$ chmod +x ./outlyer
- Move the binary in to your PATH:
$ sudo mv ./outlyer /usr/local/bin/outlyer
Installing on Windows
- Download the latest release (1.0.4) from this link.
- Add the binary in to your PATH.
Usage
The Outlyer CLI needs a valid API token in order to communicate with the Outlyer public REST API. To create a new token, please follow these instructions.
Along the Outlyer CLI documentation, the term resource
is used to refer to either alerts
, checks
, dashboards
or plugins
.
Set up your API Token
In possession of your token, execute the outlyer configure
command and provide it to the CLI:
$ outlyer configure
Please enter your API token: <paste_your_token_here>
On success, you should see the following message:
Success! Outlyer CLI is configured and ready to use
List your Accounts
In order to perform operations like exporting resources via CLI, you must specify the account to use. To list the accounts you belong to, use the outlyer get accounts
command:
$ outlyer get accounts
Export Resources from a Account
The export command allows to export resources from an account to a specific folder. If the folder
flag is not provided, the resources will be exported to the current directory. The syntax is as follows:
$ export .|[resource]|[resource/name] --account=<your_account> --folder=<optional_folder_path>
See the examples below to know how to export your entire account or specific resources.
Exporting all account’s resources to the current folder:
$ outlyer export . --account=<your_account>
You should end up with your current folder looking like this:
.
├── alerts
│ └── ...
├── checks
│ └── ...
├── dashboards
│ └── ...
└── plugins
└── ...
Exporting all account’s resources to a specific folder:
$ outlyer export . --account=<your_account> --folder=<your_folder_path>
Exporting the account’s alerts and dashboards to the current folder:
$ outlyer export alerts dashboards --account=<your_account>
Exporting the account’s alerts and two single dashboards to a specific folder:
$ outlyer export alerts dashboards/docker dashboards/elasticsearch --account=<your_account> --folder=<your_folder_path>
Import Resources to a Account
The apply command updates a resource (or a set of resources) from the given account if it already exists or creates it otherwise. The syntax is as follows:
$ outlyer apply .|[folder]|[file] --account=<your_account>
For the examples below, suppose you have the following directory structure:
demo
├── alerts
│ ├── elasticsearch.yaml
│ └── ...
├── checks
│ ├── elasticsearch.yaml
│ └── ...
├── dashboard
│ ├── elasticsearch.yaml
│ └── ...
└── plugins
├── elasticsearch.yaml
└── ...
Applying all resources to the given account by executing the command from inside the ‘demo’ directory:
$ outlyer apply . --account=<your_account>
Applying all resources to the given account by executing the command from outside the ‘demo’ directory:
$ outlyer apply path_to/demo --account=<your_account>
Applying only alerts and dashboards to the given account by executing the command from inside the ‘demo’ directory:
$ outlyer alerts dashboards --account=<your_account>
Applying only alerts and dashboards to the given account by executing the command from outside the ‘demo’ directory:
$ outlyer path_to/demo/alerts path_to/demo/dashboards --account=<your_account>
Applying all dashboards and the Elasticsearch plugin to the given account by executing the command from inside the ‘demo’ directory:
$ outlyer apply dashboards plugins/elasticsearch.py --account=<your_account>
Applying all dashboards and the Elasticsearch plugin to the given account by executing the command from outside the ‘demo’ directory:
$ outlyer apply path_to/demo/dashboards path_to/demo/plugins/elasticsearch.yaml --account=<your_account>