#!/usr/bin/ksh # # List MVs using API call to RSC, for diagnostic purposes # Written for HCL / Nokia # v1.1 - James Pattinson - October 2025 # # usage: list_mv.ksh _SCRIPT_="$0" get_script_dir() { script="$1" case "$script" in /*) abs_path="$script" ;; *) abs_path="$PWD/$script" ;; esac while [ -L "$abs_path" ]; do link=$(readlink "$abs_path") case "$link" in /*) abs_path="$link" ;; *) abs_path="$(dirname "$abs_path")/$link" ;; esac done script_dir=$(dirname "$abs_path") cd "$script_dir" 2>/dev/null && pwd } MYDIR=$(get_script_dir "$_SCRIPT_") . $MYDIR/rubrik.conf . $MYDIR/oracle_funcs.ksh # Script starts here echo "Service account in use is $ID" echo "Managed Volumes visible to this account:" ENDPOINT="https://$RUBRIK_IP/api/internal/managed_volume" rest_api_get awk ' { line = $0 pos = 1 while (match(substr(line, pos), /"name":"[^"]*"/)) { start = pos + RSTART + 7 len = RLENGTH - 9 name = substr(line, start, len) pos += RSTART + RLENGTH - 1 if (match(substr(line, pos), /"isWritable":[ ]*(true|false)/)) { start_w = pos + RSTART + 12 len_w = RLENGTH - 13 writable = substr(line, start_w, len_w) print name ": isWritable=" writable pos += RSTART + RLENGTH - 1 } } } ' /tmp/rbkresponse.$$ cleanup