Skip to content

Instantly share code, notes, and snippets.

View grepory's full-sized avatar
😃

Greg Poirier grepory

😃
  • SolarWinds
  • Atlanta, GA
View GitHub Profile
{ "client":
"keepalive": {
"handlers": [ "default" ]
}
}
@grepory
grepory / gist:6301217
Created August 21, 2013 22:48
nova compute.log messages after i submitted a nova start for a machine that was previously in a shutoff state.
compute.log:2013-08-21 17:14:32.202 85382 INFO nova.virt.libvirt.driver [-] [instance: bbee0369-9be1-4ca3-9fd4-43759d47ae22] Instance running successfully.
compute.log:2013-08-21 17:14:32.305 85382 INFO nova.compute.manager [-] [instance: bbee0369-9be1-4ca3-9fd4-43759d47ae22] During sync_power_state the instance has a pending task. Skip.
compute.log:2013-08-21 17:17:34.099 85382 INFO nova.compute.manager [-] Lifecycle event 1 on VM bbee0369-9be1-4ca3-9fd4-43759d47ae22
compute.log:2013-08-21 17:17:35.206 85382 WARNING nova.compute.manager [-] [instance: bbee0369-9be1-4ca3-9fd4-43759d47ae22] Instance shutdown by itself. Calling the stop API.
compute.log:2013-08-21 17:17:35.542 85382 INFO nova.virt.libvirt.driver [-] [instance: bbee0369-9be1-4ca3-9fd4-43759d47ae22] Instance destroyed successfully.
### Keybase proof
I hereby claim:
* I am grepory on github.
* I am grepory (https://keybase.io/grepory) on keybase.
* I have a public key whose fingerprint is 18E5 DF6A 251A BB85 2482 7990 F272 9497 27A5 2E46
To claim this, I am signing this object:
@grepory
grepory / example1.json
Last active August 29, 2015 14:00
Options for multi-datacenter sensu-dashboard
{
"api": {
"dc1": {
"host": "server.dc1"
},
"dc2": {
"host": "server.dc2"
}
}
}
@grepory
grepory / mailer.rb
Created April 29, 2014 19:07
Mailer
#!/usr/bin/env ruby
#
# Sensu Handler: mailer
#
# This handler formats alerts as mails and sends them off to a recipient,
# either defined in the check (optional) or default to a prefined value.
#
# Required: mailer.json that should have at least, mail_to and mail_from
#
# Optional: checks can contain, mail_to, mail_from, and mail_subject that
@grepory
grepory / split.bash
Last active August 29, 2015 14:01
Literally the worst thing ever.
__split () {
local arr=$1
local new_ifs=$2
if [ -z $arr ]; then
echo "__split must be called with at least one argument" && exit 1
fi
if [ ! -z $new_ifs ]; then
IFS="$new_ifs" read -ra $arr
We're talking about service orchestration, and that is a thing that is
near and dear to my heart. I'd like to introduce you to the semaphore primitive
that I want to add to Chef, some chef pseudocode for you and an explanation of
how I envision it operating:
current_services = node.current_services
services = get_services(node.fqdn)
services.each do |svc|
service_data = get_service_data(svc, node.environment)
semaphore_acquire "deploy/#{svc}/#{node.environment}" do
** Reason for termination ==
** {{case_clause,
{{{value,
{15825,
{publish,<0.1876.1333>,
{message_properties,undefined,false},
{basic_message,
{resource,<<"/outbound-dev-rabbitmq">>,exchange,
<<"outbound.generation.exchange">>},
[<<"outbound.generation.4bcc31a4-557b-46dd-86a5-efbaecc77f7b.EMAIL">>],
@grepory
grepory / canary.rb
Last active August 29, 2015 14:02
Service deployments at Opower
deploy 'myservice' do
only_if { get_lock('myservice_counter_lock').got_lock? }
notify 'ruby_block[increment_myserver_counter]'
end
ruby_block 'increment_myservice_counter' do
action :nothing # this is so that it is only run on notify
block do
get_counter('myservice_counter').increment
end
@grepory
grepory / ceph_osd_bench_results.rb
Created June 18, 2014 18:50
Simple script to get useful information out of the ceph osd bench command.
#!/usr/bin/env ruby
require 'yaml'
results_file = ARGV[-1]
results = YAML.load_file(results_file)
blocksize = results.first.last['blocksize']
bytes_written = results.first.last['bytes_written']
avg_bytes_per_sec = results.map { |r| Float(r.last['bytes_per_sec']) }.reduce(:+) / results.length