Skip to content

Instantly share code, notes, and snippets.

View beezly's full-sized avatar

Andrew Beresford beezly

View GitHub Profile
@jfryman
jfryman / gist:5808537
Created June 18, 2013 19:36
NagiosDB - Generate Nagios configs from Puppet Exported Resources + PuppetDB
#!/usr/bin/env ruby
#
# Nagios/PuppetDB config generator
#
# Based on concept from puppetdb-external-naginator
# https://github.com/favoretti/puppetdb-external-naginator
#
# Generates nagios configs from puppet(db) exported resources.
#
require 'rubygems'
@beezly
beezly / tidy-kernels.sh
Last active December 24, 2015 13:59
Ubuntu machine keeps getting filled up with old kernels? Why not run this script from your crontab. === Warning - may trash your machine. Don't blame me. You downloaded it. === Run at any time without downloading (so long as you have wget) with wget -O - https://gist.github.com/beezly/6809337/raw | /bin/bash
#!/bin/bash
read -a kernels_installed <<< `dpkg -l 'linux-image-[0-9]*' | grep ^ii | awk '{ print $2 }'`
kernel_links=(/vmlinuz /vmlinuz.old)
kernels_to_keep=( )
DEBUG=0
for i in ${kernel_links[@]}; do
if [ $DEBUG -eq 1 ]; then echo "Checking $i"; fi
real_kernel_link=`readlink $i`
if [ $DEBUG -eq 1 ]; then echo "$i points to /$real_kernel_link"; fi
@beezly
beezly / sr-git-backup
Created December 16, 2013 15:52
Backup Stingray Traffic Manager to a Git repository
#!/bin/bash
# Replace the following variables for your environment
# zxtm - hostname of your Stingray Traffic Manager
# zxtmuser - username used to log in to Stingray SSH interface
# git_path - path to the git repo you want to store the config backups in
#
# I recommend that zxtmuser is able to log in to the Traffic Manager
# without using a password, using SSH keys.
#