This file contains hidden or 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/ruby | |
def print_responses(times) | |
%w{ 0.95 0.99 0.995 0.999 }.each do |percentile| | |
pos = (percentile.to_f * times.length).floor | |
p pos.to_s + ": " + times[pos].to_s | |
end | |
end | |
num = 0 |
This file contains hidden or 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
vol = connection.volumes.new(:snapshot_id => snapshot.id, :availability_zone => current_instance.availability_zone, :size => snapshot.volume_size) | |
vol.device = "/dev/sdk" | |
vol.server = current_instance | |
vol.save | |
vol.wait_for { ready? } |
This file contains hidden or 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
bash "generate_random_server_id" do | |
user "root" | |
code <<-EOH | |
echo $RANDOM%900 | bc > /etc/mysql-server-id | |
EOH | |
not_if "test -f /etc/mysql-server-id" | |
end | |
ruby_block "reload_client_config" do | |
block do |
This file contains hidden or 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
template "/etc/my.cnf" do | |
innodb_buffer_pool_size = "256M" | |
if node.attributes?("ec2") | |
case node[:ec2][:instance_type] | |
when "t1.micro" | |
innodb_buffer_pool_size = "256M" | |
when "m1.large" | |
innodb_buffer_pool_size = "5G" | |
end | |
end |
This file contains hidden or 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 'rubygems' | |
require 'fog' | |
connection = Fog::Compute.new(:provider => "AWS", :region => "us-west-1") | |
current_instance_id = `curl http://169.254.169.254/latest/meta-data/instance-id` | |
current_instance = connection.servers.get(current_instance_id) |
This file contains hidden or 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
Generated at Wed May 18 20:14:17 +0000 2011 | |
Chef::Mixin::Template::TemplateError: | |
Chef::Mixin::Template::TemplateError (undefined method `[]' for nil:NilClass) on line #3: | |
1: # THIS FILE IS MAINTAINED BY CHEF, DO NOT MODIFY AS IT WILL BE OVERWRITTEN | |
2: <% @nodes.each do |n| -%> | |
3: <%= n['hostname'] %>,<%= n['ipaddress'] %> ssh-rsa <%= n['keys']['ssh']['host_rsa_public'] %> | |
4: <%= n['hostname'] %>,<%= n['ipaddress'] %> ssh-dsa <%= n['keys']['ssh']['host_dsa_public'] %> | |
5: <% end -%> |
This file contains hidden or 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
ec2-50-18-21-104.us-west-1.compute.amazonaws.com [Thu, 19 May 2011 21:29:30 +0000] INFO: Processing template[/etc/ssh/ssh_known_hosts] action create (ssh_known_hosts::default line 26) | |
ec2-50-18-21-104.us-west-1.compute.amazonaws.com [Thu, 19 May 2011 21:29:30 +0000] DEBUG: Signing the request as i-0ca59b48 | |
ec2-50-18-21-104.us-west-1.compute.amazonaws.com [Thu, 19 May 2011 21:29:30 +0000] DEBUG: String to sign: 'Method:GET | |
ec2-50-18-21-104.us-west-1.compute.amazonaws.com Hashed Path:ST9LEChHtxHxvLkMBWJYo/cpN2k= | |
ec2-50-18-21-104.us-west-1.compute.amazonaws.com X-Ops-Content-Hash:2jmj7l5rSw0yVb/vlWAYkK/YBwk= | |
ec2-50-18-21-104.us-west-1.compute.amazonaws.com X-Ops-Timestamp:2011-05-19T21:29:30Z | |
ec2-50-18-21-104.us-west-1.compute.amazonaws.com X-Ops-UserId:i-0ca59b48' | |
ec2-50-18-21-104.us-west-1.compute.amazonaws.com Header hash: {"X-Ops-Content-Hash"=>"2jmj7l5rSw0yVb/vlWAYkK/YBwk=", "X-Ops-Authorization-1"=>"Rdy89GkeM/xIr9/LRvLsKes9kbIhYHtWzMHuZLV46rnaU44by5GKixAysnig", "X-Ops-Userid"=>"i-0ca59b48", "X-Ops-Sign"=>" |
This file contains hidden or 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
[Fri, 20 May 2011 10:39:28 -0500] INFO: *** Chef 0.10.0 *** | |
[Fri, 20 May 2011 10:39:30 -0500] INFO: Run List is [role[base-packages], recipe[backup-dorkapps::default], role[webserver-bingo], role[app-bingo]] | |
[Fri, 20 May 2011 10:39:30 -0500] INFO: Run List expands to [compilers::default, sysstat::default, munin-node::default, vim-enhanced::default, git::default, ssh_known_hosts::default, users::default, sudoers::default, ssl-certs, backup-dorkapps::default, memcached::ec2, nginx-7, php_fpm] | |
[Fri, 20 May 2011 10:39:30 -0500] INFO: Starting Chef Run for web4.spicerackapps.com | |
[Fri, 20 May 2011 10:39:31 -0500] INFO: Loading cookbooks [backup-dorkapps, compilers, curl-devel, geoip, git, libxml2-devel, memcached, munin-node, mysql-devel, nginx-7, pcre, php_fpm, ssh_known_hosts, ssl-certs, sudoers, sysstat, users, vim-enhanced] | |
[Fri, 20 May 2011 10:39:31 -0500] INFO: Storing updated cookbooks/ssh_known_hosts/recipes/default.rb in the cache. | |
[Fri, 20 May 2011 10:39:34 -0500] ERROR: Running exception handlers | |
[Fri, 2 |
This file contains hidden or 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
Node Name: dev.spicerackapps.com | |
Environment: _default | |
FQDN: dev.spicerackapps.com | |
IP: 74.86.188.194 | |
Run List: role[base-packages], recipe[nginx-7::v_1_0_2], recipe[php_fpm::v_5_3_3_new], recipe[munin-server] | |
Roles: base-packages | |
Recipes compilers::default, sysstat::default, munin-node::default, vim-enhanced::default, git::default, ssh_known_hosts::default, users::default, sudoers::default, ssl-certs, nginx-7::v_1_0_2, php_fpm::v_5_3_3_new, munin-server | |
Platform: redhat 5.5 | |
Attributes: | |
id: dev.spicerackapps.com |
This file contains hidden or 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
# Script used to quickly get a glance of how many queries since a certain time period were longer than X seconds | |
# Customize these 2 parameters | |
STARTDATE="120413" # 2 Digit Year, 2 Digit Month, 2 Digit Day | |
QUERYTIME=3.0 | |
# Runs the commands and prints out Query_time lines | |
FIRST=`grep -n -m 1 "# Time: $STARTDATE" /var/log/mysql-slow.log | cut -d : -f 1`; TOTAL=`wc -l /var/log/mysql-slow.log | cut -d ' ' -f 1`; tail -n `echo "$TOTAL-$FIRST" | bc` /var/log/mysql-slow.log | grep Query_time | awk -v time="$QUERYTIME" '$3 > time {print; }' |
OlderNewer