Skip to content

Instantly share code, notes, and snippets.

#########
# The routes in this config use the firewall for routing between spokes and
# and for spoke traffic to the internet. Additional routes needed if hub
# shared subnet should also go through the firewall
# Region
$azregion = 'westus3'
# Resource Group
$vnetresourcegroup = "rg-network-prod-wus3-001"
Function VMPing {
[CmdletBinding(DefaultParameterSetName="1")]
# Sourced from https://github.com/vxav/Scripting/blob/master/VMPing.ps1
param(
[parameter(position=0,ValueFromPipeline=$True,ValueFromPipelineByPropertyname=$True,Mandatory=$True)]
$VM,
[parameter(parametersetname=1)][Alias('n')][int]$Count = 4,
@rbenigno
rbenigno / NTAP-plink.ps1
Created June 14, 2018 12:42
Run commands over SSH using plink. Use when NetApp PowerShell Toolkit cannot be installed.
@rbenigno
rbenigno / pure_tools.py
Last active May 9, 2017 04:11
Performs various administrative operations for Pure Storage Flash Array
#!/usr/bin/env python2.7
'''
File name: pure_tools.py
Author: Ryan Benigno
Date created: 05/08/2017
Purpose: Command line script to perform various administrative operations on
Pure Storage Flash Array.
'''
@rbenigno
rbenigno / dump_pure_luns.py
Created April 26, 2017 20:57
Dump volume list for a Pure FlashArray
#!/usr/bin/env python2.7
"""
Dump LUN inventory from Pure array
"""
# Import purestorage
try:
from purestorage import *
except ImportError, e:
@rbenigno
rbenigno / config_for_pure.sh
Last active April 27, 2017 20:29
Configure DM Multipath (RHEL 6.2+) and udev rules (RHEL 6.x, 7.x) for Pure Storage
#!/bin/bash
# Create default multipath.conf
[[ -f "/etc/multipath.conf" ]] && read -r -p "/etc/multipath.conf exists. Continue? [y/N] " response
if [[ "$response" =~ ^(no|n)$ ]]; then
echo "Quitting."
exit 1
else
echo "Writing /etc/multipath.conf"
@rbenigno
rbenigno / storage_info.sh
Last active March 16, 2017 21:42
Gather storage info from a Linux server
#!/bin/bash
# To run with redirect to a file:
# bash ./storage_info.sh &> discover_$(hostname).txt
print_h1(){
printf '\n# %s\n\n' "$@"
}
print_h2(){
printf '\n## %s\n\n' "$@"
@rbenigno
rbenigno / Logging.psm1
Created February 8, 2017 15:19
PowerShell function for logging in key value pairs for Splunk
# Write log entries in a format that can be easily ingested by Splunk
<# Add the following to your script, then use "Write-MyLog" to add log entries
Import-Module "D:\BATCH_JOBS\Logging.psm1"
Function Write-MyLog {
Param ([string]$logstring)
$Logfile = "D:\BATCH_JOBS\LOGS\<<JOB_NAME>>.log"
Add-LogEntry -LogPath $LogFile -JobName "<<JOB_NAME>>" -Message "$logstring"
}
#>
@rbenigno
rbenigno / ec2_route53_update.sh
Last active November 13, 2016 17:33
Update Route53 CNAME for an ec2 instance, from that instance
#!/bin/bash
# Ubuntu: Place this script in /var/lib/cloud/scripts/per-boot
HOST_CNAME=<CNAME to Update>
HOSTED_ZONE_ID=<Route53 Zone ID>
INSTANCE_ID=$(ec2metadata | grep 'instance-id:' | cut -d ' ' -f 2)
PUBLIC_HOSTNAME=$(ec2metadata | grep 'public-hostname:' | cut -d ' ' -f 2)
@rbenigno
rbenigno / ib_lookup_ip.py
Created October 10, 2016 22:17
InfoBlox IP Lookup
#!/usr/bin/env python
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
from infoblox_client import connector
from infoblox_client import objects
import logging