SUSE Observability CLI
SUSE Observability
Overview
The SUSE Observability sts
CLI provides easy access to the functionality provided by the SUSE Observability APIs. It can be used for automation using SUSE Observability data, to configure SUSE Observability and to develop StackPacks.
Install the sts
CLI
sts
CLIWindows
Follow the steps below to install the SUSE Observability sts
CLI on Windows.
Open a Powershell terminal (version 5.1 or later), change the <URL>
and <API-TOKEN>
and run the command below. After installation, the sts
command will be available for the current user on both the Powershell terminal and the command prompt (cmd.exe).
Alternatively, go to the CLI page in the SUSE Observability UI and copy the Quick installation command for Windows - this is pre-filled with the correct <URL>
and <API-TOKEN>
for your SUSE Observability instance.
macOS
Follow the steps below to install the SUSE Observability sts
CLI on macOS.
Open a terminal, change the <URL>
and <API-TOKEN>
and run the command below.
The default install location is
/usr/local/bin
, which might require sudo permissions depending on the version of your machine.You can specify an install location by adding
STS_CLI_LOCATION
to the command, as shown below. Note that the path provided must be available in your OS Path or the script might fail to complete.
After installation, the sts
command will be available for the current user.
Alternatively, go to the CLI page in the SUSE Observability UI and copy the Quick installation command for MacOS - this is pre-filled with the correct <URL>
and <API-TOKEN>
for your SUSE Observability instance and will install the CLI at the default location.
Linux
Follow the steps below to install the SUSE Observability sts
CLI on Linux.
Open a terminal, change the <URL>
and <API-TOKEN>
and run the command below. After installation, the sts
command will be available for the current user.
Alternatively, go to the CLI page in the SUSE Observability UI and copy the Quick installation command for Linux - this is pre-filled with the correct <URL>
and <API-TOKEN>
for your SUSE Observability instance.
Docker
To run the latest version of the CLI using Docker execute:
Alternatively, go to the CLI page in the SUSE Observability UI and copy the Quick installation command for Docker - this is pre-filled with the correct <URL>
and <API-TOKEN>
required to configure the CLI for your SUSE Observability instance.
You can now run CLI commands by adding appending them to the end of the docker run
command (for example, docker run stackstate/stackstate-cli2 version
).
Configure the sts
CLI
sts
CLIQuick start
The most secure way to use your API token is through an environment variable. You can store the API token with a secrets manager and inject it as an environment variable into your shell.
Linux, macOS and Windows
In the SUSE Observability UI, go to Main menu > CLI and copy your API token.
Run the command below, where
<URL>
is the URL to your SUSE Observability instance and<API-TOKEN>
is the API token you copied from the CLI page in the SUSE Observability UI:The connection to your SUSE Observability instance will be tested and a configuration file stored at
~/.config/stackstate-cli/config.yaml
.
Docker
The Docker version of the CLI can't be configured with a config file. Specify the configuration of your SUSE Observability instance using environment variables and pass these to Docker:
STS_CLI_URL
- the URL to your SUSE Observability instance.STS_CLI_API_TOKEN
- the API token taken from the SUSE Observability UI Main menu > CLI page.
For example:
Authentication
API token
By default, the CLI will authenticate using the API token that you provided when the CLI configuration was saved.
Service tokens
You can optionally use the CLI to create one or more service tokens to authenticate with the SUSE Observability Base and Admin APIs. For example, a service token can be used to authenticate in CI (Continuous Integration) scenarios where no real user is doing the operations on the SUSE Observability instance.
To create a service token, run the command below:
This will create a new service token and print it. The --expiration
parameter is optional and can be used to set the expiration date of the service token.
Once you have this, you can configure the CLI to use it:
Manage multiple contexts
The sts
CLI supports configuration and management of different (authentication) contexts. This enables you to easily switch between an administrative and regular user, or to switch between different SUSE Observability instances. For example, you could use a different context for a test and production instance of SUSE Observability. You can list, save, delete, set and validate contexts in the sts
CLI. Run sts context -h
for details of the available commands and their usage.
Configuration options
You don't need a configuration file to run the sts
CLI. You can also configure the CLI through a combination of environment variables and flags.
If multiple types of configuration are presented to the CLI the order of processing will be:
Flags
Environment variables
Config file
STS_CLI_URL
--url
URL to your SUSE Observability instance.
STS_CLI_API_TOKEN
--api-token
API token to your SUSE Observability instance. The most secure way to use your API token is through an environment variable. You can store the API token with a secrets manager and inject it as an environment variable into your shell.
STS_CLI_SERVICE_TOKEN
--service-token
A service token to your SUSE Observability instance. The most secure way to use your service token is through an environment variable. You can store the service token with a secrets manager and inject it as an environment variable into your shell.
STS_CLI_API_PATH
n/a
The path appended to the end of the URL to get the API endpoint. (Defaults to /api
)
STS_CLI_CONTEXT
--context
The name of the context to use.
Next to overriding specific parts of the config file, it's also possible to override the default config file location. This is done through the --config <PATH>
flag.
Upgrade
To upgrade to the latest version of the sts
CLI, run the install command again.
You can check the version of the sts
CLI that you are currently running with the command sts version
.
Uninstall
Follow the instructions below to uninstall the SUSE Observability CLI.
Open a Powershell terminal and run:
The sts
CLI and all associated configuration are now removed for the current user.
Open source
The SUSE Observability sts
CLI is open source and can be found on GitHub at:
Last updated