Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Nivedithaa Mahendran committed Nov 29, 2024
1 parent 305103f commit 7a6f726
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ SLACK_NOTIFY()
cat << ! >.curl_$database.sh
curl -X POST -H 'Content-type: application/json' --data '{"text":"$slackdes"}' ${SLACKURL}
!
if [[ -n "${SLACKURL}" ]]; then
/bin/bash .curl_$database.sh > .curl_$database.out 2>&1
fi

##### Create ICD Incident ####
####### If Backup fails ###
Expand Down Expand Up @@ -86,7 +88,9 @@ cat << ! >.curl_${database}_ICD.sh
"hstype":"BACKUP"
}'
!
if [[ -n "${ICD_AUTH_KEY}" ]]; then
/bin/bash .curl_${database}_ICD.sh > .curl_${database}_ICD.out 2>&1
fi

}

Expand Down Expand Up @@ -293,7 +297,7 @@ echo "BACKUP End time : ${DATETIME}" >> $BACK_LOG
if [[ ${BKUP_STATUS} -gt 0 ]]
then
### Send error alert
SLACK_NOTIFY
SLACK_NOTIFY
fi

### Copy the current backup log to the Backup log history file
Expand Down
49 changes: 49 additions & 0 deletions instance-applications/120-ibm-db2u-database/files/HADRMON.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ SLACK_NOTIFY()
cat << ! >.curl_$database.sh
curl -X POST -H 'Content-type: application/json' --data '{"text":"$longdes"}' $SLACKURL
!
if [[ -n "${SLACKURL}" ]]; then
/bin/bash .curl_$database.sh > .curl_$database.out 2>&1
fi
}


Expand Down Expand Up @@ -160,13 +162,19 @@ cat << ! >curl.sh
}'
!
SLACK_NOTIFY
if [[ -n "${ICD_AUTH_KEY}" ]]; then
/bin/bash curl.sh > .curl_$database.out 2>&1
grep -v Received .curl.out | grep -v Dload | grep -v "\-\-:\-\-:\-\-" >$Maillog
if [ -s $Maillog ]; then
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
else
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
echo " ----------------- " >>$For_audit
echo "HADR is not active at ${DATETIME}" >> $For_audit
touch ${HOME}/.NOSEND_$instance
Expand Down Expand Up @@ -219,13 +227,19 @@ cat << ! >curl.sh
"hstype":"HADR"
}'
!
if [[ -n "${ICD_AUTH_KEY}" ]]; then
/bin/bash curl.sh > .curl.out 2>&1
grep -v Received .curl.out | grep -v Dload | grep -v "\-\-:\-\-:\-\-" >$Maillog
if [ -s $Maillog ]; then
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
else
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
touch ${HOME}/.NOSEND_$i
if echo $i | grep -Ei "maxdb|tridb|bludb" >/dev/null
then
Expand Down Expand Up @@ -307,13 +321,19 @@ cat << ! >curl.sh
"hstype":"HADR"
}'
!
if [[ -n "${ICD_AUTH_KEY}" ]]; then
/bin/bash curl.sh > .curl.out 2>&1
grep -v Received .curl.out | grep -v Dload | grep -v "\-\-:\-\-:\-\-" >$Maillog
if [ -s $Maillog ]; then
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
else
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
touch ${HOME}/.NOSEND_sdb_$i
fi
fi
Expand Down Expand Up @@ -352,13 +372,19 @@ cat << ! >curl.sh
"hstype":"HADR"
}'
!
if [[ -n "${ICD_AUTH_KEY}" ]]; then
/bin/bash curl.sh > .curl.out 2>&1
grep -v Received .curl.out | grep -v Dload | grep -v "\-\-:\-\-:\-\-" >$Maillog
if [ -s $Maillog ]; then
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
else
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
touch ${HOME}/.NOSEND_ddb_$i
fi
#continue
Expand Down Expand Up @@ -400,13 +426,19 @@ cat << ! >curl.sh
"hstype":"HADR"
}'
!
if [[ -n "${ICD_AUTH_KEY}" ]]; then
/bin/bash curl.sh > .curl.out 2>&1
grep -v Received .curl.out | grep -v Dload | grep -v "\-\-:\-\-:\-\-" >$Maillog
if [ -s $Maillog ]; then
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
else
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
touch ${HOME}/.NOSEND_sdb_$i
fi
fi
Expand Down Expand Up @@ -446,13 +478,19 @@ cat << ! >curl.sh
"hstype":"HADR"
}'
!
if [[ -n "${ICD_AUTH_KEY}" ]]; then
/bin/bash curl.sh > .curl.out 2>&1
grep -v Received .curl.out | grep -v Dload | grep -v "\-\-:\-\-:\-\-" >$Maillog
if [ -s $Maillog ]; then
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
else
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
touch ${HOME}/.NOSEND_ddb_$i
fi
fi
Expand Down Expand Up @@ -509,13 +547,18 @@ cat << ! >curl.sh
"hstype":"HADR"
}'
!
if [[ -n "${ICD_AUTH_KEY}" ]]; then
# /bin/bash curl.sh > .curl.out 2>&1
grep -v Received .curl.out | grep -v Dload | grep -v "\-\-:\-\-:\-\-" >$Maillog
if [ -s $Maillog ]; then
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
# mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
else
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
fi
touch ${HOME}/.NOSEND_$i
fi
#continue
Expand Down Expand Up @@ -559,13 +602,19 @@ cat << ! >curl.sh
"hstype":"HADR"
}'
!
if [[ -n "${ICD_AUTH_KEY}" ]]; then
/bin/bash curl.sh > .curl.out 2>&1
grep -v Received .curl.out | grep -v Dload | grep -v "\-\-:\-\-:\-\-" >$Maillog
if [ -s $Maillog ]; then
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
else
echo "###################################################" >>$Maillog
echo $longdes >>$Maillog
mail -s "$Server HADR error, but failed to create task through OSLC API" `cat $Mail_recp` < $Maillog
fi
touch ${HOME}/.NOSEND_$i
fi
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ do
longdes="Failure to start the Backup job ${DATETIME} CUST=${CUSTNAME} ${RC}"
## Send Failure notification to a slack channel ##
cat << ! >.curl_${DBNAME}_RUN.sh
curl -X POST -H 'Content-type: application/json' --data '{"text":"$longdes"}' $SLACKURL
if [[ -n "${SLACKURL}" ]]; then
curl -X POST -H 'Content-type: application/json' --data '{"text":"$longdes"}' $SLACKURL
fi
!
/bin/bash .curl_${DBNAME}_RUN.sh > .curl_${DBNAME}_RUN.out 2>&1

Expand Down Expand Up @@ -97,7 +99,9 @@ cat << ! >.curl_${DBNAME}_ICD.sh
"hstype":"BACKUP"
}'
!
/bin/bash .curl_${DBNAME}_ICD.sh > .curl_${DBNAME}_ICD.out 2>&1
if [[ -n "${ICD_AUTH_KEY}" ]]; then
/bin/bash .curl_${DBNAME}_ICD.sh > .curl_${DBNAME}_ICD.out 2>&1
fi

fi
done
Expand Down

0 comments on commit 7a6f726

Please sign in to comment.