Skip to content

CLI reference

alarm export

stacktape alarm export prints the alarm rules created in the Stacktape Console as entries for the alarms list of a resource in your configuration. The Console no longer creates or edits alarm rules. The old ones are listed under Legacy alarm rules on the Console's Alarms page and keep applying to every matching resource until you exclude or delete them.

The command needs a Console sign-in (stacktape login) and changes nothing. It only prints.

Usage

stacktape alarm export

The output starts with how many rules it found. Each rule follows as a YAML list entry, with a comment that names the rule and the projects and stages it applies to:

YAML
# alarm "api-error-rate"# applies to projects: all · stages: production- trigger:    type: lambda-error-rate    properties:      thresholdPercent: 5  notificationChannels:    - type: console-channel      properties:        channelName: production-alerts

The Console channels a rule sent to become console-channel entries. When the organization has no Console rules, the command prints This organization has no Console-defined alarms. Nothing to export.

Moving the rules into your configuration

  1. Run stacktape alarm export.
  2. Add each entry to the alarms list of every resource it should watch. Where a rule applies only to some stages, use stage-based configuration.
  3. On the same resources, add the rule's name to disabledGlobalAlarms. Without it the Console rule keeps applying next to your new alarm, and the resource gets two alarms that notify twice.
  4. Deploy each affected stage.
  5. Check the alarms on the Console's Alarms page or with stacktape alarm list. Once every stack the rule applies to has deployed, delete the legacy rule in the Console.

For the api-error-rate rule above, the function's configuration looks like this:

YAML
resources:  api:    type: function    properties:      # ...      alarms:        - trigger:            type: lambda-error-rate            properties:              thresholdPercent: 5          notificationChannels:            - type: console-channel              properties:                channelName: production-alerts      disabledGlobalAlarms:        - api-error-rate

Alarms explains the alarm settings.

Options

stacktape alarm export3 options
  • Show Help

    More about --help

    If provided, the command will not execute and will instead print help information.

  • --log-level"info" | "debug" | "error"

    Log Level

    More about --log-level

    The level of logs to print to the console.

    • info: Basic information about the operation.
    • error: Only errors.
    • debug: Detailed information for debugging.
  • --quietboolean

    Quiet

    More about --quiet

    Hide progress, banners, success messages and hints. Command output, warnings and errors are still printed.

  • alarm list shows the state of the alarms of a deployed stack.
  • deploy creates the alarms you added to the configuration.