Using stanctl commands

Use stanctl commands for installing and configuring Instana.

Frequently used commands

The following stanctl commands are frequently used. Use stanctl --help to see all available commands.

  • stanctl agent
  • stanctl backend
  • stanctl up

For more information about a command, use the --help flag.

stanctl [command] --help

Flags for custom configuration values

The stanctl command uses default values for some configurations.

To use custom values instead of the default values, you can use flags to pass configuration values to the stanctl commands. Use stanctl [command] --help to see the list of available configuration options.

For example, stanctl uses the default /mnt/instana/stanctl/analytics mount point for Analytics. If you want to use a custom mount point, you can use the --volume-analytics flag. See the following example:

stanctl up --volume-analytics <custom-path>

Environment variables

You can store custom configuration values as environment variables either by exporting the values or by storing them in an environment file (.env).

The environment variable name of a configuration flag must start with STANCTL_. Use --help to see the environment variable name of a flag.

For example, if you run stanctl up --help, you see that the environment variable name for the --volume-analytics flag is STANCTL_VOLUME_ANALYTICS.

When you define environment variables for flags, the stanctl command automatically uses the environment variable values for configuration.

Consider the --volume-analytics example used in the previous section. If you defined an environment variable for the flag, you can run the stanctl up command without specifying the --volume-analytics flag. The command uses the environment variable value.

However, if you define the environment variable and also specify the flag with the command, stanctl uses the value from the flag and not from the environment variable.

Export environment variables

You can set environment variables by using the export command. However, this setting is not persistent.

See the following examples:

  • export STANCTL_VOLUME_ANALYTICS=/data/analytics
  • export STANCTL_CORE_BASE_DOMAIN=instana.example.com
  • export STANCTL_INSTALL_TYPE=production

Use environment file

Add the environment variables in a .env file.

STANCTL_VOLUME_ANALYTICS=/data/analytics
STANCTL_CORE_BASE_DOMAIN=instana.example.com
STANCTL_INSTALL_TYPE=production

You can run the stanctl commands from the directory of the .env file.

stanctl up

Or, use the --env-file flag to specify the path to the environment file.

stanctl up --env-file <path-to-the-.env-file>