Skip to main content

sloctl user guide

Reading time: 0 minute(s) (0 words)

Site reliability teams often deal with complex SLO tracking and management. Nobl9's command-line interface, sloctl, emerges as a streamlined solution, offering a robust CLI tool that transforms how you monitor and analyze service performance by complementing Nobl9's reliability monitoring toolset. Use sloctl to connect data sources, set up alerting on SLI data, create, update, and manage multiple SLOs and objectives at once as part of CI/CD.

While the Nobl9 web interface provides an easy way to create and update SLOs, sloctl offers DevOps and SRE teams a systematic, code-driven approach to maintaining service reliability objectives with greater automation and precision.

Learn more ways of leveraging the SLOs as code approach.

SLO automation with sloctl

  • CI/CD integration: sloctl integrates seamlessly with CI/CD pipelines.
  • Version control: you can keep definitions of SLOs and other resources in the version control system.
  • Bulk operations: sloctl allows you to create or update multiple SLOs and other Nobl9 resources simultaneously.
  • Advanced configuration: sloctl provides access to advanced functionalities through YAML-based resource definitions, including (but not limited to):
    • Complex alert policies: with sloctl, you can define alert policies with any number and combination of alert conditions, exceeding the limitations of the Nobl9 Web (one condition of a type).
    • Credential retrieval: you can run the sloctl get agents command to retrieve credentials for agents within your organization at any time.

Overview of commands, flags, and objects

This section summarizes common sloctl root and config commands, objects, and flags. Using them, you can automate SLO creation in CI/CD pipelines, retrieve agent credentials, configure complex alert policies, and perform other reliability monitoring operations.

Basic syntax

sloctl [command]
Incorrect context configuration

Check your current context credentials if sloctl returns the access token error:

Error: error getting new access token from the customer identity provider: cannot access the token, customer identity provider replied with 401 {"errorCode":"invalid_client","errorSummary":"Invalid value for 'client_id' parameter.","errorLink":"invalid_client","errorId":"oaejFe6MwoIRo200IuIj7Hp1g","errorCauses":[]}

Root commands

With sloctl root commands, you can manage your Nobl9 resources, handle contexts, and retrieve reference details.

CommandDescription
sloctl applyApply resource definitions in YAML or JSON format. Supports glob patterns with the -f flag, including '**' for recursive file and directory reading.
sloctl aws-iam-idsRetrieve authentication identifiers for integration with AWS services.
sloctl budgetadjustments eventsHandle budget adjustment events.
sloctl completionGenerate autocompletion scripts for the specified shell.
sloctl configHandle contexts.
sloctl convertConvert an OpenSLO specification to the Nobl9 definition.
sloctl deleteDelete resource definition. Supports glob patterns with the -f flag, including '**' for recursive file and directory reading.
sloctl getDisplay information about objects managed by sloctl.
sloctl helpDisplay help information for commands.
sloctl replayReplay objects and manage Replays.
sloctl versionPrint the current sloctl version.

Configuration subcommands

sloctl config provides the context handling options.

SubcommandDescription
add-contextAdd a new sloctl configuration context
current-contextDisplay current context.
Use -v (--verbose) for context details
delete-contextDelete chosen context
get-contextsDisplay all available contexts.
Use -v (--verbose) for detailed information
rename-contextRename the chosen context
use-contextSet the default context

Global flags

Global flags define the scope of the current command, such as the project, context, or location of the configuration file:

FlagShorthandDescription
--all-projects-ADisplay the objects from all of the projects.
--config stringN/ASpecify the path to the config file (without this flag, sloctl checks in %UserProfile%\.config\nobl9\config.toml on Windows and ~/.config/nobl9/config.toml on other operating systems).
--context string-cOverride the default context for the duration of the command.
--help-hGet help for a command.
--no-config-fileN/ADon't create config.toml, operate only on env variables.

A broader set of flags is available for individual commands. For more details, refer to your required command.

Objects

The following API objects can be used as subcommands with the sloctl delete and sloctl get root commands.

Objects refer to Nobl9 resources and are specified by YAML definitions.

sloctl objectNobl9 Web resourceYAML definitionAvailable for
agentsData sources added using the agent methodkind: Agentsloctl delete, sloctl get
alertmethodsAlert methodskind: AlertMethodsloctl delete, sloctl get
alertpoliciesAlert policieskind: AlertPolicysloctl delete, sloctl get
alertsilencesRules to silence alertskind: AlertSilencesloctl delete, sloctl get
alertsAlert eventskind: Alertsloctl get
annotations1Annotationskind: Annotationsloctl delete, sloctl get
budgetadjustmentsBudget adjustment definitionskind: BudgetAdjustmentsloctl delete, sloctl get
dataexportsData export configuration objectskind: DataExportsloctl delete, sloctl get
directsData sources added using the direct methodkind: Directsloctl delete, sloctl get
projectsProjectskind: Projectsloctl delete, sloctl get
reportsReportskind: Reportsloctl delete, sloctl get
rolebindingsRole bindingskind: RoleBindingsloctl delete, sloctl get
servicesServiceskind: Servicesloctl delete, sloctl get
slosSLOskind: SLOsloctl delete, sloctl get
usergroupsUser groupskind: UserGroupsloctl get

1 sloctl does not return system annotations. When applying the sloctl get annotation[s] command, sloctl will return only annotations created by the user.

For a more in-depth look, consult additional resources: