This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def multigroup(entries, items=None, groups=None, rollup=True): | |
"""Object grouping with multiple groups that supports optional rollup | |
:arg entries: A list of objects that supports `getattr` for each field in `items` | |
:arg items: Attribute fields to retrieve from entry namedtuples | |
:arg groups: Attribute fields to group by | |
:arg rollup: Whether to put common fields in a group in "_rollup" | |
:type entries: list | |
:type items: list or None | |
:type groups: list or None | |
:type rollup: bool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Estimate time to slave replication recovery using an accumulated average | |
time_interval=60 | |
samples=0 | |
delay_moving_average=0 | |
delay="$(mysql -e 'SHOW SLAVE STATUS\G' | awk '/Seconds_Behind_Master:/ {print $2}')" | |
echo "Initial replication delay: ${delay} seconds. Polling recovery rate every ${time_interval} seconds." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Manage slave threads in a Multi-threaded slave without GTID | |
# Author: Tyler Mitchell | |
# Usage: mts.sh (disable|enable) | |
worker_file=/root/mts/slave_parallel_workers.count | |
# Function slave_sql_thread. Controls the running state of the Slave SQL_THREAD | |
# Args: | |
# $1: (stop|start|sync) [required] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# refresh.sh - Quickly deploy some cloud servers on which to run playbooks | |
# | |
# Requires: rackspace-cli ( http://rackspace-cli.readthedocs.org/ ) | |
# Usage: refresh.sh (create|destroy) | |
# | |
# Variables are read from this script instead of argv. Edit them until | |
# they match your environment | |
# | |
# BUG (possibly in rackspace-cli): Using --image-id with a custom image id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Usage: ${name} stop|start|status|help | |
# | |
# Manages an SSH tunnel between two servers. This script uses SSH sockets | |
# to multiplex a forwarded connection and allow interactive control of | |
# the tunnel | |
name="$(basename "${0}")" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import pyrax | |
import ConfigParser | |
import sys | |
import getopt | |
class Config(ConfigParser.ConfigParser): | |
def __getitems__(self, section): | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
python-bottle based MySQL replication monitor. | |
Configuration is specified via [server:<server_name>] and [bottle] directives | |
in /etc/rack_replmon/monitor.conf. The monitor will parse any entry that | |
begins with ^server as directives for a server to scan | |
Valid [server:<server_name>] directives: | |
host, port, user, passwd |