Skip to content

Instantly share code, notes, and snippets.

@simontraill
simontraill / swiftstack_alerts.sh
Created October 26, 2017 13:17
check_mk probe for SwiftStack Controller alert status. If any unacknowleged alerts exist, return a WARNING.
#!/usr/bin/env bash
# Probe for Swiftstack alerts. If we find ANY unacknowleged alerts in the controller, spit out a WARNING in check_mk.
# straill 2017/11/26
. /opt/ss/etc/profile.d/01-swiftstack-controller.sh
# PGPASS location
export PGPASSFILE=/home/swiftstack/repstatus/pgpass
[ ! -f $PGPASSFILE ] && PGPASSFILE=/opt/ss/etc/pgpass
@simontraill
simontraill / swiftstack_ring_dispersion
Created October 26, 2017 13:52
Ring Dispersion checker for Swiftstack Storage Policies
#!/usr/bin/env bash
# Check a given storage policy dispersion. If non-zero, return a warning.
# straill 2017/11/26
. /opt/ss/etc/profile.d/01-swiftstack-controller.sh
# Configure me here.
# Usage note: when you change your storage layout, the dispersion of your storage policy WILL BE NON ZERO for some time.
# Further, if your cluster layout is not entirely balanced across failure domains (same amount of disks and nodes in each, and each disk has the same size), dispersion will increase. This doesn't indicate a cluster failure - just that swift is either rebalancing or doing the best it can with the storage it's been given.
@simontraill
simontraill / swift_live_object_replication.sh
Last active October 26, 2017 15:11
Check that a normal object upload is replicating as we'd expect.
#!/usr/bin/env bash
# Openstack Swift Object Live Replication Test
# straill (SwiftStack) 2017/10/26
#
# Setup:
# - Ensure you have a swift account created - see SWIFT_USER below.
# - Then set the config varibles below for your endpoints and password.
#
# We push a test object into a swift cluster, then use swift-get-nodes to see where the replicas actually are.
@simontraill
simontraill / Project Gutenberg To Swift Scraper
Last active April 18, 2018 16:30
Scrapes the top 100 books from the Gutenberg project (https://www.gutenberg.org) and uploads them to Swift - with metadata.
# Quick and Dirty Project Scraper. Pulls top 100 text Ebooks, massages the metadata to make it more Elasticsearch friendly, and uploads to Swift.
# Usage: Edit the params below and run me.
# It's slow. This is deliberate, because otherwise Gutenberg will block your connection (for up to 24 hours). Which is slower.
# straill 2018/04/18
SWIFT_HOST=localhost:3880
SWIFT_PROTO=http # ( http | https )
SWIFT_USER=gutenberg
SWIFT_PASSWORD=password
SWIFT_AUTH_URL=${SWIFT_PROTO}://${SWIFT_HOST}/auth/v1.0
@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.
#