@liflig/cdk
    Preparing search index...

    Class ServiceAlarms

    Various alarms and monitoring.

    By itself no alarms is created. Use the methods available to add alarms.

    See SlackAlarm construct for SNS Action.

    Hierarchy

    • Construct
      • ServiceAlarms
    Index

    Constructors

    Properties

    node: Node

    The tree node.

    Methods

    • For logs stored as JSON, monitor log entries logged with level ERROR or higher, as well as any requests that causes 500 for logging with liflig-logging.

      Parameters

      • props: {
            action?: IAlarmAction;
            alarmDescription?: string;
            enableOkAction?: boolean;
            logGroup: ILogGroup;
        }
        • Optionalaction?: IAlarmAction

          An action to use for CloudWatch alarm state changes instead of the default action

        • OptionalalarmDescription?: string
        • OptionalenableOkAction?: boolean

          Set to false to stop the alarm from sending OK events.

          true
          
        • logGroup: ILogGroup

      Returns void

    • Sets up three CloudWatch Alarms for monitoring an ECS service behind a target group:

      1. one that triggers if the target is responding with too many 5xx errors.
      2. one that triggers if the 95% percentile of response times from the target is too high.
      3. one that triggers if there are no healthy targets or if the load balancer fails to connect to targets.

      Parameters

      • props: {
            loadBalancerFullName: string;
            targetGroupFullName: string;
            targetHealthAlarm?: {
                action?: IAlarmAction;
                description?: string;
                enabled?: boolean;
                evaluationPeriods?: number;
                period?: Duration;
                threshold?: number;
            };
            targetResponseTimeAlarm?: {
                action?: IAlarmAction;
                description?: string;
                enabled?: boolean;
                evaluationPeriods?: number;
                period?: Duration;
                threshold?: Duration;
            };
            tooMany5xxResponsesFromTargetsAlarm?: {
                action?: IAlarmAction;
                description?: string;
                enabled?: boolean;
                evaluationPeriods?: number;
                period?: Duration;
                threshold?: number;
            };
        }
        • loadBalancerFullName: string

          The full name of the application load balancer.

        • targetGroupFullName: string

          The full name of the target group.

        • OptionaltargetHealthAlarm?: {
              action?: IAlarmAction;
              description?: string;
              enabled?: boolean;
              evaluationPeriods?: number;
              period?: Duration;
              threshold?: number;
          }

          Configuration for a composite alarm.

          Configured with sane defaults.
          
          • Optionalaction?: IAlarmAction

            An action to use for CloudWatch alarm state changes instead of the default action

          • Optionaldescription?: string
          • Optionalenabled?: boolean
            true
            
          • OptionalevaluationPeriods?: number
            1
            
          • Optionalperiod?: Duration
            60 seconds
            
          • Optionalthreshold?: number
            1
            
        • OptionaltargetResponseTimeAlarm?: {
              action?: IAlarmAction;
              description?: string;
              enabled?: boolean;
              evaluationPeriods?: number;
              period?: Duration;
              threshold?: Duration;
          }

          Configuration for an alarm.

          Configured with sane defaults.
          
          • Optionalaction?: IAlarmAction

            An action to use for CloudWatch alarm state changes instead of the default action

          • Optionaldescription?: string
          • Optionalenabled?: boolean
            true
            
          • OptionalevaluationPeriods?: number
            1
            
          • Optionalperiod?: Duration
            5 minutes
            
          • Optionalthreshold?: Duration
            500 milliseconds
            
        • OptionaltooMany5xxResponsesFromTargetsAlarm?: {
              action?: IAlarmAction;
              description?: string;
              enabled?: boolean;
              evaluationPeriods?: number;
              period?: Duration;
              threshold?: number;
          }

          Configuration for an alarm.

          Configured with sane defaults.
          
          • Optionalaction?: IAlarmAction

            An action to use for CloudWatch alarm state changes instead of the default action

          • Optionaldescription?: string
          • Optionalenabled?: boolean
            true
            
          • OptionalevaluationPeriods?: number
            3
            
          • Optionalperiod?: Duration
            60 seconds
            
          • Optionalthreshold?: number
            10
            

      Returns void

    • Returns a string representation of this construct.

      Returns string

    • Checks if x is a construct.

      Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

      Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

      Parameters

      • x: any

        Any object

      Returns x is Construct

      true if x is an object created from a class which extends Construct.