Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
from graphviz import Graph
import sys
import time
import re
from collections import OrderedDict
from hashlib import md5
graph = Graph("config_info")
@clayg
clayg / reset_container_shard_reconciler.py
Created July 12, 2019 16:46
find shard containers and make them resync their misplaced objects to the reconciler queue
#!/usr/bin/env python3
import sys
import os
import errno
from argparse import ArgumentParser
from swift.container.backend import ContainerBroker
parser = ArgumentParser()
parser.add_argument('-v', '--verbose', help='line oriented output',
@clayg
clayg / .gitignore
Last active October 15, 2020 18:10
Troll the disks for async_pendings and gather some stats
/*.json
@milesbxf
milesbxf / monzo-alertmanager-config.yaml
Last active May 15, 2024 19:37
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@simontraill
simontraill / gist:bf34665372515cd4699fac7f4ec7e2ba
Last active July 18, 2018 16:50
SwiftStack Firewall rules addition - example
#!/usr/bin/env bash
# Allow extra connections to a SwiftStack controller or node through the firewall.
# We require firewall-cmd be installed for this, or else we warn the user.
# On startup this script adds a new input chain called localrules-in...
#
# - To the INPUT chain if on a node;
# - To the IN_public_allow chain if on a controller.
#
# For Enterprise Linux 7 only; for IPv4 only.
#
@clayg
clayg / expirer-queue-cleanup.py
Last active April 3, 2019 05:51
Poke around at expired objects
#!/usr/bin/env python
#
# This looks at what's expired in the expiring objects queue, asks the object
# servers for the current real state of the objects, and then logs it's
# findings. If the object has been deleted but the tombstone timestamp is
# with-in a small delta of the queue entry because of lp bug #1741371 - we'll
# clean-up those queue entries.
import argparse
import logging
import sys
@clayg
clayg / swift-ec-get.py
Created October 24, 2017 19:01
pretty simple way to fetch an EC object direct from object server fragment archives
#!/usr/bin/env python
import argparse
import hashlib
import sys
from eventlet import GreenPile
from swift.common import storage_policy
from swift.common import utils
from swift.common.bufferedhttp import http_connect
#!/usr/bin/env python
import sys
import os
import errno
from argparse import ArgumentParser
from collections import defaultdict
import shutil
import logging
import thread
import threading
@clayg
clayg / classify_handoff_parts.py
Last active April 23, 2020 18:25
check handoffs vs. misplaced parts
import sys
import os
import errno
from argparse import ArgumentParser
from collections import defaultdict
from itertools import islice
from swift.common.storage_policy import split_policy_string
from swift.obj.diskfile import get_data_dir
from swift.common.ring import Ring
@clayg
clayg / priority-container-replicator
Last active May 10, 2018 03:56
skip some parts
#!/usr/bin/env python
from swift.container.replicator import ContainerReplicator
from swift.common.utils import parse_options
from swift.common.daemon import run_daemon
from optparse import OptionParser
from swift.common import db_replicator
from swift.common.utils import list_from_csv
orig_roundrobin = db_replicator.roundrobin_datadirs