Giter VIP home page Giter VIP logo

ansible-role-rds-alarms's Introduction

Build Status

RDS Alarms

Creates warning and critical alarms for RDS instances on Amazon CloudWatch. For more details, check out the blog post.

๐Ÿ’ฅ Battle-tested at Grofers

Requirements

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt19471460522000",
            "Effect": "Allow",
            "Action": [
                "cloudwatch:DeleteAlarms",
                "cloudwatch:DescribeAlarms",
                "cloudwatch:PutMetricAlarm"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "Stmt1947940274000",
            "Effect": "Allow",
            "Action": [
                "rds:DescribeDBInstances"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

Installation

To install, just run

$ ansible-galaxy install grofers.rds-alarms

Role Variables

  • rds_alarms_region - AWS region (Required)
  • rds_alarms_common_action_list - List of ARN of topics in AWS SNS
  • rds_alarms_period - Time (in seconds) between metric evaluations
  • rds_alarms_evaluation_periods - The number of times in which the metric is evaluated before final calculation
  • rds_alarms_common_action_list - Always include this alarm actions
  • rds_alarms_warning_threshold - Threshold for warning (default - 75%)
  • rds_alarms_critical_threshold - Threshold for warning (default - 90%)
  • rds_alarms_warning_cpu_credits_threshold - Threshold for CPU Credits (default - 30)
  • rds_alarms_critical_cpu_credits_threshold - Threshold for CPU Credits (default - 15)
  • rds_alarms_db_instances - Dict with the following format:
rds_alarms_db_instances:
  <rds-instance-identifier>:
    warning_db_connections_threshold: 100
    critical_db_connections_threshold: 200
    warning_burst_balance_threshold: 100
    critical_burst_balance_threshold: 200
    alarm_action_list: ["arn:aws:sns:us-east-1:9783248248:MYALARM"]
    critical_threshold: 90 # Optional
    warning_threshold: 75 # Optional
    storage_critical_threshold: 90 # Optional
    storage_warning_threshold: 75 # Optional
    memory_critical_threshold: 90 # Optional
    memory_warning_threshold: 75 # Optional
    credit_warning_threshold: 30 # Optional
    credit_critical_threshold: 15 # Optional
    replica_lag_threshold: 1800 # Required Only for replicas. Units seconds

Conventions

The format of name of alarms created in Amazon CloudWatch is: rds-<instance_name>-<metric_name>-<alert_type>.

For example, warning alarm for CPU for an instance with identifier my-rds-instance will be created as rds-my-rds-instance-cpu-warning.

Example Playbook

This playbook will create alarms for my-rds-instance-identifier with the default thresholds. Where as for alarms created for my-replica-rds-instance-identifier will be created with warning threshold of 80% and critical threshold will be the default value(90%). If the instance is a replica then an alarm will also be created for the replica lag. For every t2 instance, alarms are also created for remaining CPU credits.

- hosts: localhost
  connection: local
  vars:
    rds_alarms_common_action_list:
      - "arn:aws:sns:us-east-1:9783248248:ALARMS"
    rds_alarms_period: 60
    rds_alarms_evaluation_periods: 2
    rds_alarms_region: us-east-1
    rds_alarms_warning_threshold: 70
    rds_alarms_critical_threshold: 90
    rds_alarms_warning_cpu_credits_threshold: 60
    rds_alarms_critical_cpu_credits_threshold: 30
    rds_alarms_db_instances:
      my-rds-instance-identifier: # this will use the defaults
        warning_db_connections_threshold: 100
        critical_db_connections_threshold: 200
        alarm_action_list: ["arn:aws:sns:us-east-1:9783248248:MYALARM"]
      my-replica-rds-instance-identifier:
        warning_threshold: 80
        warning_db_connections_threshold: 100
        critical_db_connections_threshold: 200
        alarm_action_list: ["arn:aws:sns:us-east-1:9783248248:MYALARM"]
        credit_warning_threshold: 20
        credit_critical_threshold: 10
        replica_lag_threshold: 1800
  roles:
    - rds-alarms

Limitations

You need to create multiple playbooks for different regions.

License

MIT License

ansible-role-rds-alarms's People

Contributors

dash1291 avatar emaxi avatar vaidik avatar vishesh92 avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.