Skip to content

Instantly share code, notes, and snippets.

@f5-rahm
f5-rahm / lbu.sh
Created March 7, 2024 22:03
listing backups for BIG-IP Next instances on Central Manager
#!/bin/bash
# Get volume name
volname=$(kubectl get pvc mbiq-local-storage-pv-claim -o yaml | grep "volumeName:" | awk '{print $2}')
if [[ -z "$volname" ]]; then
echo "volumeName could not be found."
exit 1
fi
@f5-rahm
f5-rahm / cliscript_xfer.sh
Created January 31, 2024 20:36
BIG-IP cli script transfer
#!/bin/bash
# Check for the correct number of arguments
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <script_name> <source_IP> <destination_IP>"
exit 1
fi
script_name="$1"
source_ip="$2"
@f5-rahm
f5-rahm / ce_coords.py
Created January 8, 2024 22:23
Get Lat/Lon coordinates by address for F5 Distributed Cloud CE devices
"""
Usage:
~/testlab/venv/bin/python ~/testlab/ce_coords.py
Enter the installation address for your F5 Distributed Cloud CE device:
801 5th Ave, Seattle WA 98104
Latitude: 47.60518879999999, Longitude: -122.33104424785958
@f5-rahm
f5-rahm / gist:11bae66d697f24eda888cd6b34116b27
Created November 29, 2023 23:57
BIG-IP Session Table Control
ltm rule session_table_control {
when HTTP_REQUEST {
set APPNAME "subtables";
set luri [string tolower [HTTP::uri]]
set app [getfield $luri "/" 2];
set cmd [getfield $luri "/" 3];
set tname [URI::decode [getfield [HTTP::uri] "/" 4]];
set arg1 [URI::decode [getfield [HTTP::uri] "/" 5]];
set arg2 [URI::decode [getfield [HTTP::uri] "/" 6]];
@f5-rahm
f5-rahm / dc-code-tag-fix.js
Last active May 30, 2023 19:54
DevCentral code block client-side fix with Tampermonkey
// ==UserScript==
// @name DC Code Tag Fix v2
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Jason Rahm w/ ChatGPT Assist
// @match https://community.f5.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=f5.com
// @grant none
// ==/UserScript==
@f5-rahm
f5-rahm / poolstats.tcl
Created May 26, 2023 17:13
Collect LTM Pool Member Stats
proc script::run {} {
# where to store the data - /shared/images
set fp [open "/shared/images/poolstats.csv" w+]
tmsh::cd /
# CSV HEADER
puts $fp "pool,member,ss.bits-in,ss.bits-out,ss.pkts-in,ss.pkts-out"
@f5-rahm
f5-rahm / poolstats.py
Created May 26, 2023 17:11
Download LTM pool members stats from all partitions
from bigrest.bigip import BIGIP
from time import sleep
import argparse
import getpass
import sys
def build_parser():
parser = argparse.ArgumentParser()
parser.add_argument("host", help="BIG-IP IP/FQDN")
"""
Source File CSV Contents:
10.10.10.10,
10.10.10.11,hi there
10.10.11.0/24,
10.10.12.0/24,/url/path/here
10.10.13.0/24,
Output File Txt Contents:
host 10.10.10.10,
@f5-rahm
f5-rahm / 2022_AoC_Day1.irul
Created January 12, 2023 21:46
iRules Solution to Day 1 of the 2022 Advent of Code. Requires iFiles as named with the test and puzzle data (with final newline)
ltm rule aoc_day1 {
proc find_sum { snack_list } {
set calorie_sum 0
foreach snack [string map { \{ "" \} "" } $snack_list] {
set calorie_sum [expr {$calorie_sum + $snack}]
}
return $calorie_sum
}
@f5-rahm
f5-rahm / heatmap
Last active November 17, 2022 22:49
Colin Walker's original heatmap iRule (for reference - use heatmap_2022 instead)
ltm rule /Common/heatmap {
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/heatmap"} {
set chld ""
set chd ""
foreach state [table keys -subtable states] {
append chld $state
append chd "[table lookup -subtable states $state],"
}
set chd [string trimright $chd ","]