Skip to content

Instantly share code, notes, and snippets.

@toddlers
toddlers / check_forkrate.sh
Created February 3, 2014 07:23
The process counter in /proc/stat . Normally you would only expect a fork rate of 1-10/sec on a production box with steady traffic.
#!/bin/bash
DATAFILE="/var/tmp/nagios_check_forkrate.dat"
VALID_INTERVAL=600
OK=0
WARNING=1
CRITICAL=2
UNKNOWN=-1
@toddlers
toddlers / check_swap_paging_rate.sh
Created February 3, 2014 07:34
it’s actually the rate it’s swapped in/out that can impact performance, not the quantity
#!/bin/bash
# Show the rate of swapping (in number of pages) between executions
OK=0
WARNING=1
CRITICAL=2
UNKNOWN=-1
EXITFLAG=$OK
WARN_THRESHOLD=1
@toddlers
toddlers / notify.sh
Created February 3, 2014 07:37
Notify when the system rebooted
#!/bin/bash
#
# *************************************************
# chkconfig: 2345 99 99
# description: notify email address on system boot.
# *************************************************
# Installing:
# 1) save as /etc/rc.d/init.d/notify
# 2) set the desired email address in "MAILADD" variable
# 3) chmod a+w /etc/rc.d/init.d/notify
@toddlers
toddlers / varant.rb
Created February 9, 2014 10:49
absolute path for cookbooks in vagrant file
20 homebase = "/Users/sureshprajapati/chef/dirty/dirty-chef"
21 #config.vm.synced_folder "/Users/sureshprajapati/chef/dirty/dirty-chef/cookbooks", "/cookbooks"
22 config.vm.provision "chef_solo" do |chef|
23 ¦ chef.cookbooks_path = "#{homebase}/cookbooks"
24 ¦ #chef.run_list = [ "recipe[dirty::default]" ]
25 ¦ chef.add_recipe "dirty::default"
26 ¦ chef.log_level = :debug
27 ¦ chef.verbose_logging = :true
28 end
@toddlers
toddlers / error.txt
Created February 9, 2014 13:01
creating users via chef
[2014-02-09T13:33:52+01:00] INFO: Processing directory[/home/oper/.ssh] action create (dirty::example11 line 24)
================================================================================
Error executing action `create` on resource 'directory[/home/oper/.ssh]'
================================================================================
Chef::Exceptions::EnclosingDirectoryDoesNotExist
------------------------------------------------
Parent directory /home/oper does not exist, cannot create /home/oper/.ssh
@toddlers
toddlers / Vagrantfile
Created February 10, 2014 05:51
Syntax and using the cookbooks in vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"
@toddlers
toddlers / Vagrantfile.rb
Created February 10, 2014 11:04
Vagrant file for testing
homebase = "/path/to/homebase"
Vagrant::Config.run do |config|
config.vm.box = "opscode-ubuntu-12.04-chef11"
config.vm.box_url = "https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_chef-11.2.0.box" # from https://github.com/opscode/bento
config.vm.network :hostonly, "10.111.222.33"
config.vm.customize ["modifyvm", :id, "--memory", 2048]
config.vm.provision :chef_solo do |chef|
# chef.log_level = :debug
chef.cookbooks_path = "#{homebase}/cookbooks"
#!/usr/bin/env bash
# call like this on the target server:
# NODENAME='foo' CHEF_ENV='production' RUNLIST='["role[foo]","recipe[bar]"]' CHEFREPO='git@example.com:repo.git' bash <( curl -L https://raw.github.com/gist/1026628 )
# You will need to ensure that the ssh key is already set up on the server.
set -e
export CHEF_DIR="${HOME}/chef"
sudo rm -rf $CHEF_DIR
mkdir -p "$CHEF_DIR"
@toddlers
toddlers / Vagrantfile
Created March 2, 2014 08:36
vagrant file for aws provisioning
Vagrant.configure("2") do |config|
config.vm.provider :aws do |aws|
aws.access_key_id = ###
aws.secret_access_key = ###
aws.keypair_name = ###
aws.ssh_private_key_path = ###
aws.region = 'us-east-1'
aws.security_groups = ####
@toddlers
toddlers / coredump.cfg
Created March 5, 2014 10:01
enable coredump in centos
Step 1.
Edit /etc/security/limits.conf
Step 2.
Notice this is set to all processes but if you have a process running as a service account replace the * with the service account.
Step 3.
Next, you will have to restart the process for this change to go into effect.
# vi /etc/security/limits.conf