Skip to content

Instantly share code, notes, and snippets.

View colebrooke's full-sized avatar

Justin Miller colebrooke

  • @concrete-cc
  • United Kingdom
View GitHub Profile
@colebrooke
colebrooke / nagios_notify_slack.sh
Last active August 18, 2017 08:38
Script to allow nagios to generate a slack notification
#!/bin/bash
# Slack notification script, for use by Nagios or other similar monitoring systems.
#
# Author: Justin Miller
# Github: github.com/colebrooke
#
# Usage:
#
# ./nagios_notify_slack.sh <SLACKCHANNEL>
# example: python find_username_by_access_key.py <your_key>
import sys, boto3
TARGET_ACCESS_KEY = sys.argv[1]
client = boto3.client('iam')
paginator = client.get_paginator('list_users')
response_iterator = paginator.paginate(
PaginationConfig={
'MaxItems': 150,
@colebrooke
colebrooke / make-docker-swarm.sh
Created February 14, 2017 16:51
Script to create a docker swarm
#!/bin/bash
# quick script to start a docker swarm
# Justin Miller
# 14-02-17
# pre-requisites:
# set up public key authentication on all nodes
# ensure docker-engine 1.13 is installed and can be used by the admin user
@colebrooke
colebrooke / ls-s3-sizes.sh
Last active September 8, 2022 06:16
Quickly list sizes of AWS S3 buckets without traversing all objects.
#!/bin/bash
# Justin Miller 12/01/17
# Script to calculate the human readable size of S3 buckets
# The script uses cloudwatch metrics. These may need time to update if you've added data to a bucket within 24hrs.
# It happily DOES NOT need to travese potentially millions of files to calculate your S3 bucket sizes.
#
# Usage:
# ./ls-s3-sizes.sh
#
# TODO: Could be further parameterised depending on usage requirements.
@colebrooke
colebrooke / audit.sh
Created April 8, 2016 16:19
Setting up auditd on Ubuntu 14.04 to monitor both tty and root commands
#!/bin/bash
# Justin Miller 08/04/16
# Setup auditd
# command example:
# aureport --tty
#
# to view root commands:
# ausearch -ue 0
# to view user commands:
# ausearch -ua <userid>