#!/bin/bash # # Example API call script for Die Mobiliar # v0.2 - James Pattinson - August 2021 # # Lists the registered DBs for a given Oracle Host or RAC # and their assigned SLAs # # usage: oracle_list_db.sh MYDIR="$(dirname "$(realpath "$0")")" # source $MYDIR/rbk_api.conf source $MYDIR/oracle_funcs.sh if [ $# -ne 1 ]; then echo "Usage: $0 " exit 1 fi RBK_HOST=$1 echo Connecting to Rubrik with IP $RUBRIK_IP # API call to list Oracle DBs ENDPOINT="https://$RUBRIK_IP/api/internal/oracle/db" rest_api_get echo -e "SID\t\tSLA\t\t\tArchivelogMode\tDG Type\t\tDG Group" echo -e "---\t\t---\t\t\t--------------\t-------\t\t--------" cat /tmp/rbkresponse.$$ | jq -r --arg HOST $RBK_HOST '.data[] | select(.infraPath[0].name==$HOST and .isRelic==false) | {sid,effectiveSlaDomainName,isArchiveLogModeEnabled,dataGuardType,dataGuardGroupName} ' | jq -r ' "\(.sid)\t\(.effectiveSlaDomainName)\t\t\(.isArchiveLogModeEnabled)\t\t\(.dataGuardType)\t\(.dataGuardGroupName)"' cleanup