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 'optparse' | |
require 'excon' | |
require 'json' | |
require 'uri' | |
require 'netrc' | |
class LibratoLogsUriFetcher | |
attr_reader :name, :user, :secret |
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
$ time be ruby -e 'puts "Hello World"' | |
Hello World | |
bundle exec ruby -e 'puts "Hello World"' 0.51s user 0.06s system 93% cpu 0.613 total | |
$ ruby --version | |
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.5.0] | |
$ time be ruby -e 'puts "Hello World"' | |
Hello World | |
bundle exec ruby -e 'puts "Hello World"' 12.71s user 0.40s system 183% cpu 7.132 total | |
$ ruby --version |
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 'socket' | |
require 'net/https' | |
require "uri" | |
# Pings all addresses of an ELB every INTERVAL | |
interval = (ARGV[0] || 1).to_f | |
elb_name = ARGV[1] |
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
before_fork do |server, worker| | |
fork do | |
begin | |
STDOUT.sync = true | |
start = Time.now | |
sockets = `netstat -lnae|grep #{ENV['PORT']}|grep ESTABLISHED|awk '{print $2,$3}'`.split("\n") | |
queue_sums = sockets.map{|s| s.split(/\s+/).map(&:to_i) }.inject([0,0]){|m,e| [m[0] + e[0], m[1] + e[1]] } | |
puts "measure.tcp_recv_q=#{queue_sums[0]} measure.tcp_send_q=#{queue_sums[1]} elapsed_netstat_time=#{Time.now - start}" | |
end while sleep(10) | |
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
gem 'raindrops' |
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 'net/https' | |
https = Net::HTTP.new('logplex.herokai.com', 443) | |
https.use_ssl = true | |
https.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
# use system defaults | |
https.cert_store = OpenSSL::X509::Store.new | |
https.cert_store.set_default_paths |
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
echo '{ | |
"handlers": ["debug"], | |
"name": "push_woot_test", | |
"output": "woot!", | |
"status": 1 | |
}' | nc -w1 127.0.0.1 3030 |
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 'time' | |
STDOUT.sync = true | |
def time(stuff) | |
Time.at(stuff.to_f).strftime("%H:%M:%S") | |
end | |
while line = $stdin.readline | |
if line =~ /\A\[(.*?)\] \[.*?\] \[.*?\] Attempting to run scheduled check of service '([^']+)' on host '([^']+)'/ |
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
[["*.heroku.com", "kyoto-5887.herokussl-eu-west-1-a.com"], | |
["testapp.com", "gifu-2160.herokussl-eu-west-1-a.com"], | |
["testapp.com", "saga-2555.herokussl-eu-west-1-a.com"], | |
["*.herokai.com", "nagios-default.herokussl-eu-west-1-a.com"], | |
["mls.herokussl-eu-west-1-a.com", | |
"eu-west-1-a-mls-default.herokussl-eu-west-1-a.com"], | |
["elb000003-1944048936.eu-west-1.elb.amazonaws.com", | |
"eu-west-1-a-maestro-default.herokussl-eu-west-1-a.com"], | |
["psmgr.herokussl-eu-west-1-a.com", | |
"eu-west-1-a-psmgr-default.herokussl-eu-west-1-a.com"], |
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
[[1, "*.herokuapp.com"], | |
[2, "psmgr.herokussl-eu-west-1-a.com"], | |
[3, "elb000003-1944048936.eu-west-1.elb.amazonaws.com"], | |
[4, "mls.herokussl-eu-west-1-a.com"], | |
[5, "canary-eu-west-1-a-endpoint-1.herokuapp.com"], | |
[6, "canary-eu-west-1-a-endpoint-2.herokuapp.com"], | |
[7, "canary-eu-west-1-a-endpoint-3.herokuapp.com"], | |
[8, "canary-eu-west-1-a-endpoint-4.herokuapp.com"], | |
[9, "canary-eu-west-1-a-endpoint-5.herokuapp.com"], | |
[11, "*.heroku.com"], |