Giter VIP home page Giter VIP logo

dogscaler's Introduction

Dogscaler

Dogscaler was written to scale up autoscale groups based on the results of a datadog query.

Installation

Installation is easy just as any other gem:

gem install dogscaler

Configuration

Datadog API

Within datadog, you need to generate an application key and also include your api key. You can find this information from Integrations -> Api

Amazon Permissions

Create a set of credentials in IAM and give them access to: Autoscale -> DescribeAutoscaleGroups and Autoscale -> UpdateAutoscaleGroups

These permissions are used to lookup autoscale groups, check their size and updated the desired number of instances.

Config File

Create a dogscaler.yaml file with contents like:


datadog:
  api_key: <KEYHERE>
  application_key: <KEYHERE>
aws:
  region: 'us-west-2'
  profile: 'main'  # This expects a .aws/credentials file with a section matching this name
slack:
  channel: '#production'
  api_token: 'token_here'

instances:
  'mailer_prod':
    queries:
      - name: unsent_invites
        query: max:mail.db.v3.unsent_invitations{*}
        scale_up_threshhold: 1500
        scale_down_threshhold: 20
        transform: avg
      - name: mailer load
        query: avg:system.cpu.user{env:production,type:mailer}
        scale_up_threshhold: 75
        scale_down_threshhold: 20
        transform: avg
    asg_tag_filters:
      Type: mailer
      Environment: production
    grow_by: 1
    shrink_by: 1
    cooldown_period: 240
  'web_prod':
    queries:
      - name: web load
        query: avg:system.cpu.user{env:production,type:web}
        scale_up_threshhold: 75
        scale_down_threshhold: 20
        transform: avg
    asg_tag_filters:
      Type: web
      Environment: production
    grow_by: 2
    shrink_by: 1
    cooldown_period: 240

Usage

Below are some simple examples

Help output:

dogscaler help
Commands:
  dogscaler apply           # Scale the environment based on a query
  dogscaler config          # Generate a default configuration
  dogscaler debug           # testing command, describes the query it ran and the results
  dogscaler help [COMMAND]  # Describe available commands or one specific command

Options:
  d, [--debug=Enable debug mode], [--no-debug]
  r, [--region=AWS Region]
                                                 # Default: us-west-2
  v, [--verbose=Verbose Output], [--no-verbose]
  t, [--terse=Terse Output], [--no-terse]
      [--dryrun=Do a dry run], [--no-dryrun]
      [--config=Path to configuration file]

The basic example - Apply the configuration.

  $ dogscaler apply --config dogscaler.yaml

Test the configuration without making changes, with verbose output:

$ dogscaler apply --dryrun -v --config dogscaler.yaml
INFO -- : Value: 147.01052631578946 Threshold: 75.
INFO -- : Would scale up by 2 instances.
INFO -- : Value: 147.01052631578946 Threshold: 75.
INFO -- : Would scale up by 2 instances.
INFO -- : Updating autoscale group production
INFO -- : From current capacity: 1 to: 2
INFO -- : Not updating due to dry run mode
INFO -- : Value: 3.0 Threshold: 5.
INFO -- : Would scale down by 1 instances.
INFO -- : Would have reduced capacity of production-web but already at minimum.
INFO -- : Current desired: 3
INFO -- : Current min: 3

And then in slack you'll see:

dogscaler's People

Contributors

michalbabu avatar blaf avatar davidgibbons avatar eciramella avatar

Watchers

James Cloos avatar Jasson Casey avatar Evan Farrell avatar Nick Matviko avatar Logan Attwood 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.