I hereby claim:
- I am jderrett on github.
- I am jdirt (https://keybase.io/jdirt) on keybase.
- I have a public key ASApU96LyfxAE9Wlm1lS8FMvxieJnyo0E1H8m44eYRRTpwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| #!/bin/bash | |
| # Script to download AWS Lambda function code to zip files | |
| # This assumes that AWS CLI, curl, and jq are installed | |
| # List all functions in your account | |
| for fnName in $( aws lambda list-functions | jq -r '.Functions[].FunctionName' ); do | |
| # Get code location (zip file format) | |
| codeLocation=$( aws lambda get-function --function-name $fnName | jq -r '.Code.Location' ) | |
| # echo codeLocation: $codeLocation | |
| # Actually download the code (zip file) | |
| fileName="$fnName.zip" |
| require 'faraday' | |
| require 'faraday_middleware' | |
| require 'json' | |
| require 'pry' | |
| class SpacesApi | |
| LIBRATO_API = 'https://metrics-api.librato.com' | |
| LIBRATO_API_VERSION = 'v1' | |
| ENDPOINT = [LIBRATO_API, LIBRATO_API_VERSION].join('/') |
| require 'faraday' | |
| require 'faraday_middleware' | |
| require 'json' | |
| class DashboardApi | |
| LIBRATO_API = 'https://metrics-api.librato.com' | |
| LIBRATO_API_VERSION = 'v1' | |
| ENDPOINT = [LIBRATO_API, LIBRATO_API_VERSION].join('/') | |
| attr_accessor :username |
| #!/usr/bin/env ruby | |
| require 'faraday' | |
| require 'json' | |
| conn = Faraday.new(url: "https://metrics-api.librato.com/v1/") do |f| | |
| f.basic_auth ENV['LIBRATO_USER'], ENV['LIBRATO_TOKEN'] | |
| # f.response :logger | |
| f.adapter Faraday.default_adapter | |
| end |
| import requests, json | |
| username = '[email protected] | |
| token = 'abcd1234' | |
| api = "https://metrics-api.librato.com" | |
| # Find spaces | |
| search = 'string to search' | |
| url = api + "/v1/spaces?name=%s" % search |
| import librato | |
| username = '[email protected]' | |
| token = '1234abcd' | |
| api = librato.connect(username, token) | |
| metric_name = 'AWS.EC2.CPUUtilization' | |
| source = '*' # Use source name or display name here to filter stuff |
| require 'librato/metrics' | |
| require 'json' | |
| c = Librato::Metrics | |
| c.authenticate '[email protected]', 'token' | |
| alerts = JSON.parse(c.connection.get('/v1/alerts?version=2').body)['alerts'] | |
| alert_ids = alerts.map {|a| a['id']} | |
| show_ok_alerts = true |
| require 'librato/metrics' | |
| Librato::Metrics.authenticate '[email protected]', 'token' | |
| months_ago = 2 | |
| metric_name = 'AWS.EC2.CPUUtilization' | |
| resolution = 84600 # Daily | |
| source_matcher = "us-east-1*" # Set to nil for all sources | |
| next_time = Time.now.to_i - (months_ago * 730 * 3600) |