49 lines
996 B
Bash
Executable File
49 lines
996 B
Bash
Executable File
#!/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
|
|
|
|
|
|
get_script_dir() {
|
|
# Portable way to get script directory for Linux and HP/UX (ksh compatible)
|
|
src="$0"
|
|
while [ -h "$src" ]; do
|
|
dir=$(cd -P $(dirname "$src") >/dev/null 2>&1 && pwd)
|
|
src=$(readlink "$src")
|
|
case $src in
|
|
/*) ;; # absolute path
|
|
*) src="$dir/$src";;
|
|
esac
|
|
done
|
|
cd -P $(dirname "$src") >/dev/null 2>&1 && pwd
|
|
}
|
|
MYDIR=$(get_script_dir)
|
|
. $MYDIR/rbk_api.conf
|
|
. $MYDIR/oracle_funcs.ksh
|
|
|
|
# Script starts here
|
|
|
|
echo "Service account in use is $ID"
|
|
|
|
echo "Managed Volumes"
|
|
|
|
|
|
ENDPOINT="https://$RUBRIK_IP/api/internal/managed_volume"
|
|
rest_api_get
|
|
|
|
awk '{
|
|
pos = 1
|
|
while (match(substr($0, pos), /"name":"[^"]*"/)) {
|
|
name = substr($0, pos + RSTART + 7, RLENGTH - 8)
|
|
# Remove any trailing quote if present
|
|
sub(/"$/, "", name)
|
|
print name
|
|
pos += RSTART + RLENGTH - 1
|
|
}
|
|
}' /tmp/rbkresponse.$$
|
|
|
|
cleanup
|