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] [flags] <objects>
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 applyApplies resource definitions in YAML or JSON format. Supports glob patterns with the -f flag, including '**' for recursive file and directory reading.
sloctl aws-iam-idsRetrieves authentication identifiers for integration with AWS services.
sloctl budgetadjustments eventsProvides budget adjustment event handling options.
sloctl completionGenerates autocompletion scripts for the specified shell.
sloctl configProvides context handling options.
sloctl convertConvert an OpenSLO specification to the Nobl9 definition.
sloctl deleteDeletes resource definition. Supports glob patterns with the -f flag, including '**' for recursive file and directory reading.
sloctl getDisplays information about objects managed by sloctl.
sloctl helpDisplays help information for commands.
sloctl replayProvides Replay options.
sloctl versionPrints the current sloctl version.

Configuration commands​

sloctl config provides the context handling options.

CommandDescription
add-contextAdds a new sloctl configuration context
current-contextDisplays current context. Use -v (--verbose) for context details
delete-contextDeletes chosen context
get-contextsDisplays all available contexts. Use -v (--verbose) for detailed information
rename-contextRenames chosen context
use-contextSets the default context

Flags​

Common flags pass data to a command or parameter:

FlagLong formDescription
-h--helpGet help.
-o--output stringSpecify the output format: one of yaml|json|csv (default yaml).

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

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

ShortLongDescription
-A--all-projectsDisplay the objects from all of the projects.
--config stringSpecify 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).
-c--context stringOverride the default context for the duration of the command.
--no-config-fileDon't create config.toml, operate only on env variables.
-p--project stringOverride the default project from the active context for the duration of the command.

Common objects​

The following are the API objects that you can manipulate with sloctl using the different commands.

Objects are passed as YAML definitions. For object YAML configuration, see the YAML guide.

sloctl objectNobl9 Web termDescription
agentsData sources added using the agent methodA YAML definition of a monitoring solution that your Nobl9 SLOs receive data from.
kind: Agent
alertmethodsAlert methodsA YAML definition of your tool for sending alert notifications.
kind: AlertMethod
alertpoliciesAlert policiesA set of conditions that trigger alerts and send notifications to your predefined alert methods.
kind: AlertPolicy
alertsilencesRules to silence alertsA scheduled period for muting alerts that would otherwise trigger when an alert policy's conditions are met.
kind: AlertSilence
alertsAlert eventsA YAML definition of an alert event triggered by an alert policy. Alerts are generated automatically based on the alert policy and its conditions and contain alert details.
annotations1System and user annotationsA note attached to SLO charts containing user-defined information or indicating an event that affected an SLO.
kind: Annotation
budgetadjustmentsBudget adjustment definitionsA set of exceptions that prevent SLO error budget burn by planned or allowed activity.
kind: BudgetAdjustment
dataexportsRules for data exportA YAML configuration for exporting data from Nobl9 to AWS S3 or GCP.
kind: DataExport
directsData sources added using the direct methodA YAML definition of a monitoring solution that your Nobl9 SLOs receive data from.
kind: Direct
projectsProjectsA project YAML definition. Projects are the primary logical grouping of resources in Nobl9. All Nobl9 resources, such as data sources, SLOs, and alerts, are created within a project.
kind: Project
rolebindingsRole bindingsA YAML definition for binding a user role in the project with users.
kind: RoleBinding
servicesServicesA service YAML definition. A service can represent a logical service endpoint like an API, a database, an application, or anything else you need to monitor using SLOs.
kind: Service
slosSLOsA service level objective YAML definitionβ€”a reflection of the desired performance of your system with the defined target, error budget calculation method, time window, and a query to retrieve data from your data source.
kind: SLO

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: