Skip to content

Instantly share code, notes, and snippets.

View MrPink's full-sized avatar

William Pink MrPink

View GitHub Profile
@MrPink
MrPink / nagios2jira
Created June 8, 2011 14:57
Nagios2Jira
require 'rubygems'
require 'jira4r'
jira = Jira4R::JiraTool.new(2, "http://ourjira.onjira.com")
jira.login("user", "password")
# create the issue.
options = {}
OptionParser.new do |opts|
@MrPink
MrPink / blanks.py
Created October 4, 2011 14:31
Ganglia Python module to graph results from a SQL query
import sys
import _mysql
import time
import re
def blank_logger(name):
db=_mysql.connect(user="user",passwd="password",db="hitstats")
db.query(""" SELECT sum(if(filename='nginx_timeout',totalhits,0)) blanks
FROM `hitstats`.`serverhits` """)
1 #!/bin/bash
2
3 NAG_DIR='/etc/nagios3/servers'
4
5 case "$1" in
6 enable-mpd)
7 if [ -a $NAG_DIR/mpd.live.cfg ]; then
8 echo "MPD Live already enabled!"
9 exit 1
10 else
class Chef
class Recipe
def sensu_instance_identifier
sensu_metrics_environment_name = node[:environment][:name].gsub(/^tape_/, "").gsub(/_production$/, "_p").gsub(/_staging$/, "_s")
sensu_metrics_node_name = "#{node[:instance_role]}_#{node[:name]}".gsub(/_$/, "")
"#{sensu_metrics_environment_name}.#{sensu_metrics_node_name}".gsub(/-$/, "")
end
end
end
@MrPink
MrPink / tf
Created August 11, 2016 19:27
Elasticache replication group with Cloudformation and controlled by Terraform
resource "template_file" "cf" {
vars {
cluster_name = "${var.cluster_name}"
csg_name = "${aws_elasticache_subnet_group.default_redis_sg.name}"
cluster_internal_sg_id = "${module.ecs-cluster.cluster_internal_sg_id}"
}
template = <<STACK
{
"Resources" : {
### Keybase proof
I hereby claim:
* I am mrpink on github.
* I am mrpinks (https://keybase.io/mrpinks) on keybase.
* I have a public key ASDGnlJkzc9YPh75JseESUdeaxYZY-SyXS18c6OCrrchawo
To claim this, I am signing this object:
@MrPink
MrPink / tips_and_tricks.md
Last active May 2, 2018 16:44
DevOps Troubleshooting tips and tricks

Tips and tricks for Linux troubleshooting

Terraform commands

  • Initialize Terraform terraform init

  • Terraform plan terraform plan

@MrPink
MrPink / .bash_profile
Created September 4, 2019 10:04 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@MrPink
MrPink / sh
Created July 1, 2020 16:08
Shell tidbits
get a list of KMS keys and describe them
for key in `aws kms list-keys | jq '.Keys[].KeyId' | tr -d '"'`; do aws kms describe-key --key-id $key; done