Skip to content

Instantly share code, notes, and snippets.

View burdandrei's full-sized avatar
👻

Andrei Burd burdandrei

👻
View GitHub Profile
@burdandrei
burdandrei / ec2ssh.sh
Created May 18, 2020 09:43
Wrapper for CSSH running instances by tag
#!/usr/bin/env bash
#
# Wrapper for CSSH running instances by tag
usage(){
cat << EOF >&2
usage: $0 options
This script Gathers instances from AWS and runs ClusterSSH to them

Keybase proof

I hereby claim:

  • I am burdandrei on github.
  • I am burdandrei (https://keybase.io/burdandrei) on keybase.
  • I have a public key ASDguvcCMbH6l-SunKUSg_UFYI6X5UTad8ujaq_K6_rfhAo

To claim this, I am signing this object:

@burdandrei
burdandrei / crash.log
Created February 14, 2018 10:08
Terraform v0.11.3 crashes trying to plab changes to vault 0.9.3 #17346
This file has been truncated, but you can view the full file.
2018/02/14 11:51:51 [INFO] Terraform version: 0.11.3 3802b14260603f90c7a1faf55994dcc8933e2069
2018/02/14 11:51:51 [INFO] Go runtime version: go1.9.1
2018/02/14 11:51:51 [INFO] CLI args: []string{"/home/bandrei/bin/terraform", "plan"}
2018/02/14 11:51:51 [DEBUG] Attempting to open CLI config file: /home/bandrei/.terraformrc
2018/02/14 11:51:51 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/02/14 11:51:51 [INFO] CLI command args: []string{"plan"}
2018/02/14 11:51:51 [TRACE] Preserving existing state lineage "f7d72e7a-9092-4307-b01c-a00d9778b334"
2018/02/14 11:51:51 [TRACE] Preserving existing state lineage "f7d72e7a-9092-4307-b01c-a00d9778b334"
2018/02/14 11:51:51 [INFO] Building AWS region structure
2018/02/14 11:51:51 [INFO] Building AWS auth structure
@burdandrei
burdandrei / gist:376b8974a22efd0a180d75c62011f331
Created February 6, 2018 13:51
Resque cleanup workers without heartbeat
Resque.workers.each do |w|
w.unregister_worker if w.heartbeat.nil?
end
@burdandrei
burdandrei / nginx_logformat_json.conf
Created December 5, 2017 13:23
Nginx JSON stype logformat ready to be sent Logstash/Graylog/Splunk
log_format json escape=json
'{ "msec": "$msec", '
'"remote_addr": "$remote_addr", '
'"request_method": "$request_method", '
'"request_uri": "$request_uri", '
'"status": "$status", '
'"body_bytes_sent": "$body_bytes_sent", '
'"http_referer": "$http_referer", '
'"http_user_agent": "$http_user_agent", '
'"request_time": "$request_time" , '
@burdandrei
burdandrei / consul-nomad-server-systemd-dnsmasq-userdata-bootstrap.sh
Created December 5, 2017 12:17
UserData Script for bootstrapping Consul and Nomad clients in AWS, connect them with AWS auto discovery and run using systemd
#!/bin/bash
#
# This script is intendent to install both Consul and Nomad servers
# on Ubuntu 16.04 Xenial managed by SystemD
# including DnsMasq for *.service.consul DNS resolving
set -i
export TERM=xterm-256color
export DEBIAN_FRONTEND=noninteractive
export DATACENTER_NAME="example"
@burdandrei
burdandrei / consul-nomad-client-systemd-docker-dnsmasq-userdata-bootstrap.sh
Created December 5, 2017 12:15
UserData Script for bootstrapping Consul and Nomad servers in AWS, connect them with AWS auto discovery and run using systemd
#!/bin/bash
#
# This script is intendent to install both Consul and Nomad clients
# on Ubuntu 16.04 Xenial managed by SystemD
# including docker and DnsMasq for *.service.consul DNS resolving
#
# Script assume that instance is running in AWS and have "ec2:DescribeInstances" permissions in IAM Role
set -x
export TERM=xterm-256color
@burdandrei
burdandrei / DescribeInstances_IAM_role.json
Last active December 5, 2017 12:21
IAM policy needed for Consul AWS discovery
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:DescribeTags"
],
"Resource": [
@burdandrei
burdandrei / ec2-check-reserved-instances.py
Created January 16, 2017 21:09
AWS Check reserved instances usage
#!/usr/bin/python
import boto3
import logging
import argparse
from pprint import pformat,pprint
parser = argparse.ArgumentParser(description='Cross reference existing ec2 reservations to current instances.')
parser.add_argument('--log', default="WARN", help='Change log level (default: WARN)')
parser.add_argument('--region', default='us-east-1', help='AWS Region to connect to')
@burdandrei
burdandrei / telegraf.conf
Last active August 20, 2021 10:01
Receive consul and nomad telemetry in influx in usable form
# Templates are updated to be compatible with nomad > 0.7.1
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "3s"
precision = ""