This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.editrc | |
bind -v | |
bind \\t rl_complete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'librato/metrics' | |
# Estimate the number of sources for each metric | |
Librato::Metrics.authenticate '[email protected]', 'api token' | |
Librato::Metrics.metrics.each do |m| | |
# Grab last 4 hours at hourly resolution | |
puts [m['name'], Librato::Metrics.get_measurements(m['name'], resolution: 3600, count: 4).keys.size] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<!-- They'll need there own version of jquery or whatever --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<script src="https://sdk.librato.com/librato-sdk-v0.5.1-min.js"></script> | |
</head> | |
<body> | |
<div id="thegraph"> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
var app = express(); | |
var librato = require('librato-node') | |
var sleep = require('sleep') | |
librato.configure({ | |
email: '[email protected]', | |
token: 'abc1234', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'faraday' | |
require 'faraday_middleware' | |
require 'json' | |
require 'pry' | |
class LibratoApi | |
ENDPOINT = 'https://metrics-api.librato.com/v1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Required: | |
# http://stedolan.github.io/jq/ | |
# brew install jq | |
LIBRATO_USER="[email protected]" | |
LIBRATO_TOKEN="<your api token>" | |
LIBRATO_AUTH="$LIBRATO_USER:$LIBRATO_TOKEN" | |
ALERTS_ENDPOINT="https://metrics-api.librato.com/v1/alerts?version=2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HOURS_BACK=3 | |
http GET https://metrics-api.librato.com/v1/metrics \ | |
compose='s("AWS.EC2.CPUUtilization", "*", {period: "3600"})' \ | |
resolution=3600 \ | |
start_time=$(echo "$(date +'%s')-$HOURS_BACK*3600" | bc) \ | |
| jq '[.measurements[].series[]]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer