Skip to content

Instantly share code, notes, and snippets.

Report for slow logs: /var/log/mysql/mysql-slow.log
16.30k queries total, 8 unique
Sorted by 't_sum'
Grand Totals: Time 240.86k s, Lock 8 s, Rows sent 39.76k, Rows Examined 1.55G
______________________________________________________________________ 001 ___
Count : 7.80k (47.84%)
Time : 119793.371699 s total, 15.358125 s avg, 10.015 ms to 240.771133 s max (49.74%)
95% of Time : 96388.931761 s total, 13.007953 s avg, 10.015 ms to 34.256583 s max
#!/usr/bin/ruby
require 'rubygems'
require 'gelf'
def send_gelf(ip,method,uri,code,size,referral)
line = ip + " " + method + " " + uri + " " + code + " " + size + " " + referral
n = GELF::Notifier.new("graylog2.posterdev.com", 12201)
n.notify!(:host => "prod-nginx", :level => 1, :short_message => line, :_ip => ip, :_method => method, :_uri => uri, :_code => code, :_size => size, :_referral => referral)
end
cookbook_file "/etc/init.d/set_hostname" do
if node['dmi']['system']['manufacturer'] == "Dell Inc."
source_file = "set_hostname-physical"
else
source_file = "set_hostname"
end
source = source_file
owner "root"
group "root"
mode "0755"
service "riak"
execute "install_riak" do
command "/usr/bin/dpkg -i /srv/posterous/tmp/riak_1.0.2-1_amd64.deb"
action :nothing
user "root"
end
cookbook_file "/srv/posterous/tmp/riak_1.0.2-1_amd64.deb" do
source "riak_1.0.2-1_amd64.deb"
cookbook_file "/etc/ssl/certs/star_#{node.domain}.pem" do
source "star_#{node.domain}.pem"
owner "root"
group "root"
mode 0755
end
cookbook_file "/etc/ssl/private/star_#{node.domain}.key" do
source "star_#{node.domain}.key"
owner "root"
@dodizzle
dodizzle / gist:1483794
Created December 16, 2011 00:41
nested has key for chef recipe
if node.has_key? "filesystem"
if node["filesystem"].has_key? "/dev/sda6"
if node["filesystem"]["/dev/sda6"].has_key? "mount"
if node['filesystem']['/dev/sda6']['mount'] == '/srv'
execute "foo" do
command "touch /tmp/nested_keys_exist!"
action :run
end
end
end
##########################
# users private ssh keys #
##########################
case node[:fqdn]
when "chi-devops11a.posterprod.com","chi-devops11b.posterprod.com"
%w{david rm}.each do |user|
cookbook_file "/home/#{user}/.ssh/id_rsa" do
source "id_rsa.#{user}"
mode 0600
owner "#{user}"
@dodizzle
dodizzle / gist:1511939
Created December 22, 2011 21:29
patch to monitor ec2 nodes remotly
<% if n.has_key? "ec2" -%>
address <%= n['ec2']['public_ipv4'] %>
<% else -%>
address <%= n['ipaddress'] %>
<% end -%>
# Use environment variables
# or specify values manually
production:
host: 127.0.0.1
port: 27017
username: grayloguser
password: xxx
database: graylog2
cache: [GET /] miss
cache: [GET /login] miss
cache: [GET /stylesheets/reset.css?1324660681] miss
cache: [GET /javascripts/login.js?1324660681] miss
cache: [GET /stylesheets/login.css?1324660681] miss
cache: [GET /javascripts/jquery-1.4.2.min.js?1324660681] miss
NoMethodError (super called outside of method):
mongoid (2.3.3) lib/mongoid/callbacks.rb:42
mongoid (2.3.3) lib/mongoid/callbacks.rb:67:in `call'