diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/archivelog_deletion_policy/scripts/archivelog_deletion_policy_check.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/archivelog_deletion_policy/scripts/archivelog_deletion_policy_check.sh
index 59165b0d5..cf1e14894 100644
--- a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/archivelog_deletion_policy/scripts/archivelog_deletion_policy_check.sh
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/archivelog_deletion_policy/scripts/archivelog_deletion_policy_check.sh
@@ -4,17 +4,13 @@
# instance where backups are not being run.
#
-# When the agent runs on engineering hosts the open file limit is set by the root user at boot time
-# (unless agent is restarted manually), so the process limit may be less than that specified in .bash_profile.
-# Check if this is the case and override the process limit if required to prevent an error being thrown.
-PROC_HARD_LIMIT=$(ulimit -Hn)
-PROFILE_PROC_LIMIT=$(grep -E "ulimit.*-u.*-n" ~/.bash_profile | sed -r 's/.*-n ([[:digit:]]+).*/\1/')
+. ~/.bash_profile
-if [[ ${PROFILE_PROC_LIMIT} -gt ${PROC_HARD_LIMIT} ]];
-then
- source <(sed -r "s/ulimit -u ([[:digit:]]+) -n ([[:digit:]]+)/ulimit -u \1 -n ${PROC_HARD_LIMIT}/" ~/.bash_profile)
-else
- . ~/.bash_profile
+# If run on an instance hosting OEM we need to explicitly set up the database environment
+if srvctl config database -d EMREP > /dev/null; then
+ export ORAENV_ASK=NO
+ export ORACLE_SID=EMREP
+ . oraenv >/dev/null
fi
# Check if Archivelog Deletion Policy requires a backup
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/asm_diskgroup_used/collection/ME#24#ASM_DISKGROUP_USED.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/asm_diskgroup_used/collection/ME#24#ASM_DISKGROUP_USED.xml
new file mode 100644
index 000000000..1e57386f4
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/asm_diskgroup_used/collection/ME#24#ASM_DISKGROUP_USED.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/asm_diskgroup_used/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/asm_diskgroup_used/mea.xml
new file mode 100644
index 000000000..77bd9306e
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/asm_diskgroup_used/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/asm_diskgroup_used/metadata/ME#24#ASM_DISKGROUP_USED.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/asm_diskgroup_used/metadata/ME#24#ASM_DISKGROUP_USED.xml
new file mode 100644
index 000000000..209a79e0b
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/asm_diskgroup_used/metadata/ME#24#ASM_DISKGROUP_USED.xml
@@ -0,0 +1,58 @@
+
+
+
+ASM Disk Group Used (Persists Across ASM Patching)
+
+
+
+
+
+
+
+
+
+
+GB
+DATA_SIZE
+
+
+
+
+
+
+
+GB
+DATA_SIZE
+
+
+
+
+
+
+
+GB
+DATA_SIZE
+
+
+
+
+
+
+
+PERCENTAGE
+PERCENTAGE
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/asm_diskgroup_usage.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/asm_diskgroup_used/scripts/asm_diskgroup_usage.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/asm_diskgroup_used/scripts/asm_diskgroup_usage.sh
new file mode 100644
index 000000000..7e58040ac
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/asm_diskgroup_used/scripts/asm_diskgroup_usage.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+. ~/.bash_profile
+
+sqlplus -S / as sysdba <
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/backup_from_standby/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/backup_from_standby/mea.xml
new file mode 100644
index 000000000..fe60b66ca
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/backup_from_standby/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/backup_from_standby/metadata/ME#24#BACKUP_FROM_STANDBY.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/backup_from_standby/metadata/ME#24#BACKUP_FROM_STANDBY.xml
new file mode 100644
index 000000000..b562db356
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/backup_from_standby/metadata/ME#24#BACKUP_FROM_STANDBY.xml
@@ -0,0 +1,48 @@
+
+
+
+Run a trial no-op backup from standby database to check it works
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/backup_from_standby.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/backup_from_standby/scripts/backup_from_standby.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/backup_from_standby/scripts/backup_from_standby.sh
new file mode 100644
index 000000000..58c8d770b
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/backup_from_standby/scripts/backup_from_standby.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. ~/.bash_profile
+
+# Determine which catalog we are using by pinging both possible options. Only 1 will resolve.
+# Set the TRANSPORT_CONNECT_TIMEOUT to 3 seconds so we do not waste time trying to connect to
+# the wrong catalog.
+export TNS_DCAT="(DESCRIPTION=(TRANSPORT_CONNECT_TIMEOUT=3000ms)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rman-db-1.engineering-dev.probation.hmpps.dsd.io)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=DCAT)))"
+export TNS_PCAT="(DESCRIPTION=(TRANSPORT_CONNECT_TIMEOUT=3000ms)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rman-db-1.engineering-prod)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=PCAT)))"
+
+tnsping ${TNS_PCAT} >/dev/null
+if [[ $? == 0 ]]; then
+ CATALOG=${TNS_PCAT}
+else
+ tnsping ${TNS_DCAT} >/dev/null
+ if [[ $? == 0 ]]; then
+ CATALOG=${TNS_DCAT}
+ else
+ echo "unable to connect to either catalog."
+ exit 1
+ fi
+fi
+
+RMANPWD=$(. /etc/environment && aws ssm get-parameters --region ${REGION} --with-decryption --name /${HMPPS_ENVIRONMENT}/${APPLICATION}/oracle-db-operation/rman/rman_password | jq -r '.Parameters[].Value' )
+
+# For test purposes we will backup the smallest file in the database. We are not looking to create an actual backup;
+# simply verify that a backup can be successfully run.
+SMALLEST_FILE=$(echo -e "report schema;" | rman target / | grep DATAFILE | sort -n -k2 | head -1 | cut -d' ' -f 1)
+
+BACKUP_TEST=$(
+cat <
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blackout_age/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blackout_age/mea.xml
new file mode 100644
index 000000000..bee99af4c
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blackout_age/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blackout_age/metadata/ME#24#BLACKOUT_AGE.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blackout_age/metadata/ME#24#BLACKOUT_AGE.xml
new file mode 100644
index 000000000..c6c60be54
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blackout_age/metadata/ME#24#BLACKOUT_AGE.xml
@@ -0,0 +1,44 @@
+
+
+
+Report Age of Oldest Blackout on Host in Days
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+DAYS
+TIME
+
+
+
+
+/bin/bash
+%scriptsDir%/blackout_age.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blackout_age/scripts/blackout_age.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blackout_age/scripts/blackout_age.sh
new file mode 100644
index 000000000..77d2683f9
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blackout_age/scripts/blackout_age.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# We cannot check the Blackout Age from the host itself as, if it IS in a Blackout, it cannot then report the fact.
+# Therefore this script can only run on the OMS.
+#
+# We explicitly exclude any host with the name sandpit on the assumption that this is regularly blacked out.
+#
+
+. ~/.bash_profile
+
+EMCLI=/u01/app/oracle/oem/middleware/bin/emcli
+
+SYSMAN_PASSWORD=$( . /etc/environment && aws ssm get-parameters --region ${REGION} --with-decryption --name /${HMPPS_ENVIRONMENT}/${APPLICATION}/oem-database/db/oradb_sysman_password | jq -r '.Parameters[].Value' )
+
+$EMCLI login -username=sysman -password=${SYSMAN_PASSWORD} -force 1>/dev/null
+$EMCLI sync 1>/dev/null
+for HOST in $( $EMCLI get_targets -targets="host" -format="name:script" -noheader | grep -v sandpit | awk '{print $NF}' );
+do
+ $EMCLI get_blackouts -hostnames="$HOST" -noheader -format="name:csv" | grep Started | while read BLACKOUT
+ do
+ NAME=$(echo $BLACKOUT | awk -F, '{print $1}')
+ STARTDATE=$(echo $BLACKOUT | awk -F, '{print $5}')
+ AGE=$(echo "scale=2; ($(date +%s) - $(date --date="$STARTDATE" +%s)) / (60*60*24)" | bc)
+ echo "${HOST}_$NAME|$HOST|$NAME|$STARTDATE|$AGE"
+ done
+done
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blocked_sessions_count/collection/ME#24#BLOCKED_SESSIONS_COUNT.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blocked_sessions_count/collection/ME#24#BLOCKED_SESSIONS_COUNT.xml
new file mode 100644
index 000000000..56490673c
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blocked_sessions_count/collection/ME#24#BLOCKED_SESSIONS_COUNT.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blocked_sessions_count/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blocked_sessions_count/mea.xml
new file mode 100644
index 000000000..4f4459a5b
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blocked_sessions_count/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blocked_sessions_count/metadata/ME#24#BLOCKED_SESSIONS_COUNT.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blocked_sessions_count/metadata/ME#24#BLOCKED_SESSIONS_COUNT.xml
new file mode 100644
index 000000000..8091755ea
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blocked_sessions_count/metadata/ME#24#BLOCKED_SESSIONS_COUNT.xml
@@ -0,0 +1,32 @@
+
+
+
+Count of blocked sessions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/blocked_sessions_count.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blocked_sessions_count/scripts/blocked_sessions_count.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blocked_sessions_count/scripts/blocked_sessions_count.sh
new file mode 100644
index 000000000..3db3d40c1
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/blocked_sessions_count/scripts/blocked_sessions_count.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+. ~/.bash_profile
+
+# Exit without failure if database is not up
+srvctl status database -d $ORACLE_SID >/dev/null || exit 0
+
+sqlplus -s / as sysdba< 0
+ AND NOT (s.event = 'enq: CI - contention' AND s.p1 LIKE '112%' and s.program like 'rman@%' ) -- Ignore Cross Instance Call Waits for ASM Map Locks during RMAN Backup
+ AND s.type != 'BACKGROUND')
+SELECT b.sid||'|'||b.serial#||'|'||count(*)
+FROM blocking_session b,
+ waiting_session w
+WHERE w.id1 = b.id1
+AND w.id2 = b.id2
+AND w.sid <> b.sid
+AND NOT EXISTS (SELECT 1
+ FROM dba_objects o
+ WHERE w.id1 = o.object_id
+ AND (o.owner,o.object_name) IN (('NDMIS_DATA','AUDITED_INTERACTION'))
+ )
+GROUP BY b.sid,b.serial#;
+EXIT
+EOF
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/data_guard_apply_off/collection/ME#24#DATA_GUARD_APPLY_OFF.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/data_guard_apply_off/collection/ME#24#DATA_GUARD_APPLY_OFF.xml
new file mode 100644
index 000000000..8d7ed06d5
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/data_guard_apply_off/collection/ME#24#DATA_GUARD_APPLY_OFF.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/data_guard_apply_off/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/data_guard_apply_off/mea.xml
new file mode 100644
index 000000000..6ab5cc1dd
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/data_guard_apply_off/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/data_guard_apply_off/metadata/ME#24#DATA_GUARD_APPLY_OFF.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/data_guard_apply_off/metadata/ME#24#DATA_GUARD_APPLY_OFF.xml
new file mode 100644
index 000000000..91b1a00aa
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/data_guard_apply_off/metadata/ME#24#DATA_GUARD_APPLY_OFF.xml
@@ -0,0 +1,29 @@
+
+
+
+Detect Data Guard Instance with Redo Apply Off
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/data_guard_apply_off.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/data_guard_apply_off/scripts/data_guard_apply_off.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/data_guard_apply_off/scripts/data_guard_apply_off.sh
new file mode 100644
index 000000000..9f30b1dda
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/data_guard_apply_off/scripts/data_guard_apply_off.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+. ~/.bash_profile
+
+echo -e "show database ${ORACLE_SID};" | dgmgrl / | awk -v ORACLE_SID=${ORACLE_SID} -F: '/Intended State/{printf("%s|%s\n",ORACLE_SID,$2)}' | sed 's/ //g'
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/deadlock_count/collection/ME#24#DEADLOCKS.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/deadlock_count/collection/ME#24#DEADLOCKS.xml
new file mode 100644
index 000000000..42eff2b04
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/deadlock_count/collection/ME#24#DEADLOCKS.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/deadlock_count/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/deadlock_count/mea.xml
new file mode 100644
index 000000000..f6a42ae5c
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/deadlock_count/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/deadlock_count/metadata/ME#24#DEADLOCKS.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/deadlock_count/metadata/ME#24#DEADLOCKS.xml
new file mode 100644
index 000000000..6c997662e
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/deadlock_count/metadata/ME#24#DEADLOCKS.xml
@@ -0,0 +1,22 @@
+
+
+
+Count number of deadlocks
+
+
+
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/deadlocks.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/deadlock_count/scripts/deadlocks.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/deadlock_count/scripts/deadlocks.sh
new file mode 100644
index 000000000..b58ad49a6
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/deadlock_count/scripts/deadlocks.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+ALERT_LOG="$ORACLE_BASE/diag/rdbms/${ORACLE_SID,,}/$ORACLE_SID/trace/alert_$ORACLE_SID.log"
+DEADLOCK_PATTERN="ORA-00060: Deadlock detected"
+DEADLOCK_COUNT=$(grep -c "$DEADLOCK_PATTERN" "$ALERT_LOG")
+BEGINEPOCH=$(date "+%s" --date='- 15 minutes')
+FIRST_SQL_TO_MATCH="UPDATE OFFENDER O SET O.CURRENT_TIER = PKG_LOOKUPS.FUNCGETTABRECORD( P_TABLE => 'MANAGEMENT_TIER', P_REF_COL => 'offender_id', P_REF_VAL => :B1 , P_DATA_FLD => 'tier_id', P_ORDER_BY => 'date_changed DESC, tier_id DESC') WHERE OFFENDER_ID = :B1"
+SECOND_SQL_TO_MATCH="DELETE FROM OFFENDER WHERE ROWID = :p_row_id"
+
+if [[ $DEADLOCK_COUNT -ge 1 ]]
+then
+ DEADLOCK_DATES=$(grep -B 1 "$DEADLOCK_PATTERN" "$ALERT_LOG" | grep -v "$DEADLOCK_PATTERN")
+
+ # Check whether they are greater than begin epoch date specified
+
+ for d in ${DEADLOCK_DATES[@]}
+ do
+ DEADLOCK_DATE=$(echo $d | cut -d'.' -f1)
+ if [[ `date "+%s" -d "$DEADLOCK_DATE"` -ge $BEGINEPOCH ]]
+ then
+ # Read the trace file associated with the deadlock
+ TRACEFILE=$(grep -A 1 "$d" $ALERT_LOG | grep -v "$d" | awk '{print $NF}' | sed -e 's/\.//2')
+ if [[ -f $TRACEFILE ]]
+ then
+ # Get certain client details which have identified to be conflict between
+ # Delius API testing (scheduled in the evenings) and the Tiering Service
+ # when testing attempting to delete an offender record which is being processed by the tiering service.
+ FIRST_USER=$(grep -A1 'client details:' $TRACEFILE |egrep -v 'client details:' | awk '{print $4}' | grep -v "^$" | head -1 | sed -e s/,//)
+ FIRST_SQL=$(grep -A1 'current SQL:' $TRACEFILE |egrep -v 'current SQL:' | head -1 | sed -e 's/^ *//; s/ *$//')
+ SECOND_USER=$(grep -A1 'client details:' $TRACEFILE |egrep -v 'client details:' | awk '{print $4}' | grep -v "^$" | head -2 | tail -1 | sed -e s/,//)
+ SECOND_SQL=$(grep -A1 'current SQL:' $TRACEFILE |egrep -v 'current SQL:' | tail -1 | sed -e 's/^ *//; s/ *$//')
+
+ if [[ "$FIRST_USER" == "appuser" && "$FIRST_SQL" == "$FIRST_SQL_TO_MATCH"
+ && "$SECOND_USER" == "root" && "$SECOND_SQL" == "$SECOND_SQL_TO_MATCH" ]]
+ then
+ STATUS="DISCARD"
+ else
+ DEADLOCK_KEEP+=( ${d} )
+ fi
+ fi
+ fi
+ done
+fi
+
+# Output number of occurrences in deadlock epochs which we want to keep
+echo ${#DEADLOCK_KEEP[@]}
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/defunct_ssm_worker/collection/ME#24#DEFUNCT_SSM_WORKER.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/defunct_ssm_worker/collection/ME#24#DEFUNCT_SSM_WORKER.xml
new file mode 100644
index 000000000..a848d9e5a
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/defunct_ssm_worker/collection/ME#24#DEFUNCT_SSM_WORKER.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/defunct_ssm_worker/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/defunct_ssm_worker/mea.xml
new file mode 100644
index 000000000..5a00acf0c
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/defunct_ssm_worker/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/defunct_ssm_worker/metadata/ME#24#DEFUNCT_SSM_WORKER.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/defunct_ssm_worker/metadata/ME#24#DEFUNCT_SSM_WORKER.xml
new file mode 100644
index 000000000..a510c59c1
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/defunct_ssm_worker/metadata/ME#24#DEFUNCT_SSM_WORKER.xml
@@ -0,0 +1,38 @@
+
+
+
+Count Defunct SSM Worker Processes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/count_defunct_and_long_running_ssm_processes.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/defunct_ssm_worker/scripts/count_defunct_and_long_running_ssm_processes.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/defunct_ssm_worker/scripts/count_defunct_and_long_running_ssm_processes.sh
new file mode 100644
index 000000000..0b741677f
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/defunct_ssm_worker/scripts/count_defunct_and_long_running_ssm_processes.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+PARENT_IDS=$(ps -ef | grep ssm-session-worker | grep -v grep | awk '{print $2}' | paste -sd "|")
+
+# Find Defunct ssm-session-worker processes
+DEFUNCT_COUNT=$(ps -ef | egrep -e "(${PARENT_IDS:-NONEFOUND})" | grep -c "")
+
+# Find ssm-user sh processes running for over a day
+LONG_RUNNING_SH_COUNT=$(ps -e -o user,cmd,etimes= | grep ssm-user | grep -E "[[:space:]]sh[[:space:]]"| awk '{if($3>86400){print $0}}' | wc -l)
+
+# Find ssm-session-worker processes running for over a day
+LONG_RUNNING_SSM_COUNT=$(ps -e -o user,cmd,etimes= | grep root | grep -E "[[:space:]]/usr/bin/ssm-session-worker[[:space:]]"| awk '{if($3>86400){print $0}}' | wc -l)
+
+echo "$DEFUNCT_COUNT|$LONG_RUNNING_SH_COUNT|$LONG_RUNNING_SSM_COUNT"
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/iowait/collection/ME#24#IOWAIT.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/iowait/collection/ME#24#IOWAIT.xml
new file mode 100644
index 000000000..53747f5bb
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/iowait/collection/ME#24#IOWAIT.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/iowait/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/iowait/mea.xml
new file mode 100644
index 000000000..6b833001f
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/iowait/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/iowait/metadata/ME#24#IOWAIT.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/iowait/metadata/ME#24#IOWAIT.xml
new file mode 100644
index 000000000..9417cafa3
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/iowait/metadata/ME#24#IOWAIT.xml
@@ -0,0 +1,26 @@
+
+
+
+Percentage of Time Spent on IO Wait
+
+
+
+
+
+PERCENTAGE
+PERCENTAGE
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/iostat.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/iowait/scripts/iostat.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/iowait/scripts/iostat.sh
new file mode 100644
index 000000000..60700ca68
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/iowait/scripts/iostat.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# Get average IO Wait Percent over last 10 seconds rather than instantaneous time - ignore short lived spikes
+
+iostat -c 10 2 | tail -2 | head -1 | awk '{print $4}'
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/long_running_sql/collection/ME#24#LONG_RUNNING_SQL.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/long_running_sql/collection/ME#24#LONG_RUNNING_SQL.xml
new file mode 100644
index 000000000..b086eae3b
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/long_running_sql/collection/ME#24#LONG_RUNNING_SQL.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/long_running_sql/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/long_running_sql/mea.xml
new file mode 100644
index 000000000..40ba075b7
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/long_running_sql/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/long_running_sql/metadata/ME#24#LONG_RUNNING_SQL.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/long_running_sql/metadata/ME#24#LONG_RUNNING_SQL.xml
new file mode 100644
index 000000000..cf1a030f8
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/long_running_sql/metadata/ME#24#LONG_RUNNING_SQL.xml
@@ -0,0 +1,24 @@
+
+
+
+Detect longest running SQL still active in the database
+
+
+
+
+
+SECOND
+RATE
+
+
+
+
+/bin/bash
+%scriptsDir%/long_running_sql.sql
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/long_running_sql/scripts/long_running_sql.sql b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/long_running_sql/scripts/long_running_sql.sql
new file mode 100644
index 000000000..c80b58ffc
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/long_running_sql/scripts/long_running_sql.sql
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# Get active user sessions
+#
+
+. ~/.bash_profile
+
+# Exit without failure if database is not up
+srvctl status database -d $ORACLE_SID >/dev/null || exit 0
+
+sqlplus -s / as sysdba <
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/password_expiry/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/password_expiry/mea.xml
new file mode 100644
index 000000000..d80e9f80d
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/password_expiry/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/password_expiry/metadata/ME#24#PASSWORD_EXPIRY.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/password_expiry/metadata/ME#24#PASSWORD_EXPIRY.xml
new file mode 100644
index 000000000..aeb53639f
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/password_expiry/metadata/ME#24#PASSWORD_EXPIRY.xml
@@ -0,0 +1,31 @@
+
+
+
+Passwords To Expire
+
+
+
+
+
+
+
+
+
+
+DAYS
+TIME
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/passwords_to_expire.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/password_expiry/scripts/passwords_to_expire.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/password_expiry/scripts/passwords_to_expire.sh
new file mode 100644
index 000000000..8fd5bca6b
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/password_expiry/scripts/passwords_to_expire.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+. ~/.bash_profile
+
+
+# Exit without failure if database is not up
+srvctl status database -d $ORACLE_SID >/dev/null || exit 0
+
+sqlplus -s / as sysdba <
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/pga_limit/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/pga_limit/mea.xml
new file mode 100644
index 000000000..1fd348306
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/pga_limit/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/pga_limit/metadata/ME#24#PGA_LIMIT.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/pga_limit/metadata/ME#24#PGA_LIMIT.xml
new file mode 100644
index 000000000..69ce4db48
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/pga_limit/metadata/ME#24#PGA_LIMIT.xml
@@ -0,0 +1,44 @@
+
+
+
+Percentage of pga_aggregate_limit currently in Use
+
+
+
+
+
+BYTE
+DATA_SIZE
+
+
+
+
+
+
+
+BYTE
+DATA_SIZE
+
+
+
+
+
+
+
+PERCENTAGE
+PERCENTAGE
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/Untitled
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/pga_limit/scripts/Untitled b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/pga_limit/scripts/Untitled
new file mode 100644
index 000000000..4affdbe98
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/pga_limit/scripts/Untitled
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+. ~/.bash_profile
+
+# Exit without failure if database is not up
+srvctl status database -d $ORACLE_SID >/dev/null || exit 0
+
+sqlplus -s / as sysdba<
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/restore_point_age/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/restore_point_age/mea.xml
new file mode 100644
index 000000000..568c54b1b
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/restore_point_age/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/restore_point_age/metadata/ME#24#RESTORE_POINT_AGE.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/restore_point_age/metadata/ME#24#RESTORE_POINT_AGE.xml
new file mode 100644
index 000000000..392019bda
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/restore_point_age/metadata/ME#24#RESTORE_POINT_AGE.xml
@@ -0,0 +1,26 @@
+
+
+
+Maximum Restore Point Age
+
+
+
+
+
+DAYS
+TIME
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/max_restore_point_age.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/restore_point_age/scripts/max_restore_point_age.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/restore_point_age/scripts/max_restore_point_age.sh
new file mode 100644
index 000000000..9a02722d5
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/restore_point_age/scripts/max_restore_point_age.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+. ~/.bash_profile
+
+
+# Exit without failure if database is not up
+srvctl status database -d $ORACLE_SID >/dev/null || exit 0
+
+sqlplus -s / as sysdba <
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/standby_parameter_comparison/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/standby_parameter_comparison/mea.xml
new file mode 100644
index 000000000..6d9f6e877
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/standby_parameter_comparison/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/standby_parameter_comparison/metadata/ME#24#STANDBY_PARAMETER_COMPARISON.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/standby_parameter_comparison/metadata/ME#24#STANDBY_PARAMETER_COMPARISON.xml
new file mode 100644
index 000000000..ada59338e
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/standby_parameter_comparison/metadata/ME#24#STANDBY_PARAMETER_COMPARISON.xml
@@ -0,0 +1,37 @@
+
+
+
+Ensure Database Instance Parameters match between Primary and Standby
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/compare_parameters.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/common/standby_parameter_comparison/scripts/compare_parameters.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/standby_parameter_comparison/scripts/compare_parameters.sh
new file mode 100644
index 000000000..892fcf932
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/common/standby_parameter_comparison/scripts/compare_parameters.sh
@@ -0,0 +1,264 @@
+#!/bin/bash
+#
+# This script highlights any parameters which differ between primary and standby instances.
+# It is only intended to run from the primary instance. No parameters are required.
+# Note that some parameters are "normalised" by removing references to server names etc.
+# to avoid spurious mismatches between databases which are expected.
+
+. ~/.bash_profile
+
+function get_password()
+{
+USERNAME=$1
+. /etc/environment && aws ssm get-parameters --region ${REGION} --with-decryption --name /${HMPPS_ENVIRONMENT}/${APPLICATION}/${HMPPS_ROLE}-database/db/oradb_${USERNAME,,}_password | jq -r '.Parameters[].Value'
+}
+
+function get_jdbc()
+{
+DATABASE=$1
+tnsping ${DATABASE} | grep "Attempting" | sed -r 's/(.*)HOST\s+=\s+(.*)\)\(PORT\s+=\s+([0-9]+).*\(SERVICE_NAME\s+=\s+(\w*)\)+$/\2:\3\/\4/'
+}
+
+
+function report_differences()
+{
+PRIMARY_DATABASE=$1
+STANDBY_DATABASE=$2
+
+JDBC_CONNECT=$(get_jdbc ${STANDBY_DATABASE})
+
+sql -S /nolog <>', 1, 0,
+ 'i')
+ WHEN a.name IN('background_dump_dest', 'core_dump_dest', 'user_dump_dest') THEN
+ regexp_replace((regexp_replace(a.value, '/'
+ || a.instance_name
+ || '/', '/<>/', 1, 0,
+ 'i')),
+ '/'
+ || a.instance_name
+ || '/',
+ '/<>/',
+ 1,
+ 0,
+ 'i')
+ WHEN a.name IN('audit_file_dest', 'dg_broker_config_file1', 'dg_broker_config_file2') THEN
+ regexp_replace(a.value, '/'
+ || a.instance_name
+ || '/', '/<>/', 1, 0,
+ 'i')
+ WHEN a.name IN('control_files') THEN
+ regexp_replace(regexp_replace(lower(a.value),
+ '/'
+ || a.instance_name
+ || '/',
+ '/<>/',
+ 1,
+ 0,
+ 'i'),
+ '\d+',
+ '0')
+ WHEN a.name IN('local_listener') THEN
+ regexp_replace(a.value, '\(HOST=\d+\.\d+\.\d+\.\d+\)', '(HOST=xx.xx.xx.xx)')
+ WHEN a.name IN('log_archive_dest_1') THEN
+ (
+ SELECT
+ LISTAGG(dest_desc, ',') WITHIN GROUP(
+ ORDER BY
+ dest_desc
+ )
+ FROM
+ (
+ SELECT
+ instance_name,
+ upper(regexp_substr(lad1, '[^ ]+', 1, level)) dest_desc
+ FROM
+ (
+ SELECT
+ instance_name,
+ regexp_replace(replace(regexp_replace(z.value, 'db_unique_name='
+ || z.instance_name
+ || '(,|$)', 'db_unique_name=<>', 1, 0
+ ,
+ 'i'),
+ ', ',
+ ','),
+ '\((\w+),\s+(\w+)\)',
+ '(\1,\2)') lad1
+ FROM
+ parameter_values z
+ WHERE
+ z.name = 'log_archive_dest_1'
+ AND z.instance_name = a.instance_name
+ )
+ CONNECT BY
+ regexp_substr(lad1, '[^ ]+', 1, level) IS NOT NULL
+ )
+ )
+ WHEN a.name IN('fal_server', 'log_archive_dest_2', 'log_archive_dest_3', 'service_names') THEN
+ '<>'
+ WHEN a.name IN('log_archive_dest_state_1', 'log_archive_dest_state_2', 'log_archive_dest_state_3', 'standby_file_management'
+ , 'shadow_core_dump',
+ 'plscope_settings') THEN
+ upper(a.value)
+ WHEN a.name IN('db_file_multiblock_read_count', 'shared_pool_reserved_size')
+ AND a.isdefault = 'TRUE' THEN
+ 'DEFAULT'
+ WHEN a.name IN('audit_trail')
+ AND a.database_role = 'PHYSICAL STANDBY'
+ AND a.open_mode = 'READ ONLY WITH APPLY' THEN
+ 'DB'
+ WHEN a.name IN('log_archive_config') -- Make ordering consistent for values in log_archive_config
+ THEN
+ (
+ SELECT
+ LISTAGG(lower(tns_alias),
+ ',') WITHIN GROUP(
+ ORDER BY
+ tns_alias
+ ) log_archive_config_value
+ FROM
+ (
+ SELECT
+ regexp_substr(tns_alias, '[^,]+', 1, level) tns_alias
+ FROM
+ (
+ SELECT
+ regexp_replace(value, '^.*\((.*)\)$', '\1') tns_alias
+ FROM
+ parameter_values z
+ WHERE
+ z.name = 'log_archive_config'
+ AND z.instance_name = a.instance_name
+ )
+ CONNECT BY
+ regexp_substr(tns_alias, '[^,]+', 1, level) IS NOT NULL
+ )
+ )
+ WHEN a.name IN('spfile') THEN
+ regexp_replace((regexp_replace(a.value, '/'
+ || a.instance_name
+ || '/', '/<>/', 1, 0,
+ 'i')),
+ 'spfile'
+ || a.instance_name
+ || '.ora',
+ 'spfile<>.ora',
+ 1,
+ 0,
+ 'i')
+ ELSE
+ value
+ END,
+ '^(.*)(\s+|,)(.*)$',
+ '"'
+ || '\1\2\3'
+ || '"') normalized_value
+ FROM
+ parameter_values a
+), primary_parameters AS (
+ SELECT
+ *
+ FROM
+ normalized_parameter_values b
+ WHERE
+ b.instance_name = '${PRIMARY_DATABASE}'
+), standby_parameters AS (
+ SELECT
+ *
+ FROM
+ normalized_parameter_values b
+ WHERE
+ b.instance_name = '${STANDBY_DATABASE}'
+), parameter_comparison AS (
+ SELECT
+ '${STANDBY_DATABASE}' instance_name,
+ c.name,
+ c.normalized_value primary_value,
+ d.normalized_value standby_value,
+ CASE
+ WHEN ( c.normalized_value = d.normalized_value )
+ OR ( c.normalized_value IS NULL
+ AND d.normalized_value IS NULL ) THEN
+ 'Y'
+ ELSE
+ 'N'
+ END parameter_match
+ FROM
+ primary_parameters c
+ FULL OUTER JOIN standby_parameters d ON c.name = d.name
+)
+SELECT
+ instance_name||'|'||
+ name||'|'||
+ primary_value||'|'||
+ standby_value
+FROM
+ parameter_comparison e
+WHERE
+ e.parameter_match != 'Y';
+
+EXIT
+EOSQL
+}
+
+DBSNMP_PASSWORD=$(get_password dbsnmp)
+SYS_PASSWORD=$(get_password sys)
+
+for DB in $(echo -e "show configuration;" | dgmgrl / | grep "standby database" | cut -d'-' -f1)
+do
+ report_differences ${ORACLE_SID} ${DB^^}
+done
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/dataguard_active_target/collection/ME#24#DATA_GUARD_ACTIVE_TARGET.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/dataguard_active_target/collection/ME#24#DATA_GUARD_ACTIVE_TARGET.xml
new file mode 100644
index 000000000..3449dffeb
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/dataguard_active_target/collection/ME#24#DATA_GUARD_ACTIVE_TARGET.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/dataguard_active_target/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/dataguard_active_target/mea.xml
new file mode 100644
index 000000000..c0bb30711
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/dataguard_active_target/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/dataguard_active_target/metadata/ME#24#DATA_GUARD_ACTIVE_TARGET.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/dataguard_active_target/metadata/ME#24#DATA_GUARD_ACTIVE_TARGET.xml
new file mode 100644
index 000000000..79e330b16
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/dataguard_active_target/metadata/ME#24#DATA_GUARD_ACTIVE_TARGET.xml
@@ -0,0 +1,26 @@
+
+
+
+Check that the Data Guard Active Target is the First Standby
+
+
+
+
+
+BOOLEAN
+BOOLEAN
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/active_target.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/dataguard_active_target/scripts/active_target.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/dataguard_active_target/scripts/active_target.sh
new file mode 100644
index 000000000..83ff1f47f
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/dataguard_active_target/scripts/active_target.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Check Active Target is the 1st Standby Database
+
+. ~/.bash_profile
+
+ACTIVE_TARGET=$( echo "show configuration;" | dgmgrl / | grep "(*) Physical standby database" | awk '{print substr($1,length($1)-1)}')
+# Check if target is not being Observed
+NO_OBSERVER=$( echo "show configuration;" | dgmgrl / | grep -c "ORA-16820" )
+
+if [[ "${ACTIVE_TARGET}" == "s1" && ${NO_OBSERVER} -eq 0 ]];
+then
+ echo "YES"
+else
+ echo "NO"
+fi
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/failed_prf_thread/collection/ME#24#FAILED_PRF_THREAD.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/failed_prf_thread/collection/ME#24#FAILED_PRF_THREAD.xml
new file mode 100644
index 000000000..b791640de
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/failed_prf_thread/collection/ME#24#FAILED_PRF_THREAD.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/failed_prf_thread/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/failed_prf_thread/mea.xml
new file mode 100644
index 000000000..c3e9bb669
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/failed_prf_thread/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/failed_prf_thread/metadata/ME#24#FAILED_PRF_THREAD.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/failed_prf_thread/metadata/ME#24#FAILED_PRF_THREAD.xml
new file mode 100644
index 000000000..e6062f4b6
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/failed_prf_thread/metadata/ME#24#FAILED_PRF_THREAD.xml
@@ -0,0 +1,34 @@
+
+
+
+Detect failure of custom performance monitoring threads
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/prf_thread_status.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/failed_prf_thread/scripts/prf_thread_status.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/failed_prf_thread/scripts/prf_thread_status.sh
new file mode 100644
index 000000000..fb2d715a6
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/failed_prf_thread/scripts/prf_thread_status.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Get status code for PRF threads (2=failed)
+#
+
+. ~/.bash_profile
+
+# Exit without failure if database is not up
+srvctl status database -d $ORACLE_SID >/dev/null || exit 0
+
+sqlplus -s / as sysdba <
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/materialized_view_refresh_time/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/materialized_view_refresh_time/mea.xml
new file mode 100644
index 000000000..542db24fe
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/materialized_view_refresh_time/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/materialized_view_refresh_time/metadata/ME#24#MATERIALIZED_VIEW_REFRESH_TIME.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/materialized_view_refresh_time/metadata/ME#24#MATERIALIZED_VIEW_REFRESH_TIME.xml
new file mode 100644
index 000000000..0f146a54f
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/materialized_view_refresh_time/metadata/ME#24#MATERIALIZED_VIEW_REFRESH_TIME.xml
@@ -0,0 +1,24 @@
+
+
+
+Calculated in Minutes
+
+
+
+
+
+MINUTES
+TIME
+
+
+
+
+/bin/bash
+%scriptsDir%/time_since_oldest_mv_refresh.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/materialized_view_refresh_time/scripts/time_since_oldest_mv_refresh.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/materialized_view_refresh_time/scripts/time_since_oldest_mv_refresh.sh
new file mode 100644
index 000000000..5d8e83520
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/materialized_view_refresh_time/scripts/time_since_oldest_mv_refresh.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Calculate the time since the oldest materialized refresh (in minutes)
+#
+
+. ~/.bash_profile
+
+# Exit without failure if database is not up
+srvctl status database -d $ORACLE_SID >/dev/null || exit 0
+
+sqlplus -s / as sysdba <
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/preserved_audited_interaction_data_age/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/preserved_audited_interaction_data_age/mea.xml
new file mode 100644
index 000000000..d0ccf1117
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/preserved_audited_interaction_data_age/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/preserved_audited_interaction_data_age/metadata/ME#24#PRESERVED_AUDITED_INTERACTION_DATA_AGE.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/preserved_audited_interaction_data_age/metadata/ME#24#PRESERVED_AUDITED_INTERACTION_DATA_AGE.xml
new file mode 100644
index 000000000..d33a7fef9
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/preserved_audited_interaction_data_age/metadata/ME#24#PRESERVED_AUDITED_INTERACTION_DATA_AGE.xml
@@ -0,0 +1,31 @@
+
+
+
+Preserved Audited Interaction Data Age (days) By Environment
+
+
+
+
+
+
+
+
+
+
+DAYS
+TIME
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/preserved_audited_interaction_data_age.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/preserved_audited_interaction_data_age/scripts/preserved_audited_interaction_data_age.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/preserved_audited_interaction_data_age/scripts/preserved_audited_interaction_data_age.sh
new file mode 100644
index 000000000..1667c4152
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/preserved_audited_interaction_data_age/scripts/preserved_audited_interaction_data_age.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+. ~/.bash_profile
+
+# Exit without failure if database is not up
+srvctl status database -d $ORACLE_SID >/dev/null || exit 0
+
+sqlplus -s / as sysdba <
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/user_notes_replication/mea.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/user_notes_replication/mea.xml
new file mode 100644
index 000000000..106f3e4c5
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/user_notes_replication/mea.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/user_notes_replication/metadata/ME#24#USER_NOTES_REPLICATION.xml b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/user_notes_replication/metadata/ME#24#USER_NOTES_REPLICATION.xml
new file mode 100644
index 000000000..170c68387
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/user_notes_replication/metadata/ME#24#USER_NOTES_REPLICATION.xml
@@ -0,0 +1,26 @@
+
+
+
+Detect if User Notes are not being replicated by DMS
+
+
+
+
+
+OPERATIONDAY
+RATE
+
+
+
+
+
+
+/bin/bash
+%scriptsDir%/user_notes_replication.sh
+%scriptsDir%
+|
+NAME
+
+
+
+
\ No newline at end of file
diff --git a/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/user_notes_replication/scripts/user_notes_replication.sh b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/user_notes_replication/scripts/user_notes_replication.sh
new file mode 100644
index 000000000..c39e8c2ba
--- /dev/null
+++ b/ansible/roles/oracle-oms-setup/files/metric_extensions/delius/user_notes_replication/scripts/user_notes_replication.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# Count number of USER_ entries for the last day where:
+# (1) The record was created by Data Maintenance
+# (2) The NOTES field is NULL
+# (3) It is not a SERVICE account
+#
+# If the count is non-zero this may have identified an audit stub user which has been replicated to this database
+# with a missing Notes column. (All such users should have Notes populated to state that they are stubs).
+
+. ~/.bash_profile
+
+sqlplus -s / as sysdba < sysdate - 1
+ AND u.notes IS NULL
+ AND u.created_by_user_id = (
+ SELECT
+ user_id
+ FROM
+ data_maintenance_user
+ )
+ AND u.user_id > (
+ SELECT
+ MAX(service_user.user_id)
+ FROM
+ delius_app_schema.user_ service_user
+ WHERE
+ service_user.surname = 'Service'
+ AND service_user.created_by_user_id = (
+ SELECT
+ user_id
+ FROM
+ data_maintenance_user
+ )
+ );
+EXIT
+EOSQL
\ No newline at end of file