[helm-toolkit] add log strings for alert generation
Log string prefixes are added to different error logs for the generation of alert. Change-Id: I483cf08e09b2b56a68414f4cc3ade4c3e3cdd9aa
This commit is contained in:
parent
9d7baa9aa8
commit
11ac37056b
@ -15,7 +15,7 @@ apiVersion: v1
|
|||||||
appVersion: v1.0.0
|
appVersion: v1.0.0
|
||||||
description: OpenStack-Helm Helm-Toolkit
|
description: OpenStack-Helm Helm-Toolkit
|
||||||
name: helm-toolkit
|
name: helm-toolkit
|
||||||
version: 0.2.30
|
version: 0.2.31
|
||||||
home: https://docs.openstack.org/openstack-helm
|
home: https://docs.openstack.org/openstack-helm
|
||||||
icon: https://www.openstack.org/themes/openstack/images/project-mascots/OpenStack-Helm/OpenStack_Project_OpenStackHelm_vertical.png
|
icon: https://www.openstack.org/themes/openstack/images/project-mascots/OpenStack-Helm/OpenStack_Project_OpenStackHelm_vertical.png
|
||||||
sources:
|
sources:
|
||||||
|
@ -265,7 +265,7 @@ remove_old_local_archives() {
|
|||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
# Log error but don't exit so we can finish the script
|
# Log error but don't exit so we can finish the script
|
||||||
# because at this point we haven't sent backup to RGW yet
|
# because at this point we haven't sent backup to RGW yet
|
||||||
log ERROR "${DB_NAME}_backup" "Cannot remove ${ARCHIVE_FILE}"
|
log ERROR "${DB_NAME}_backup" "Failed to cleanup local backup. Cannot remove ${ARCHIVE_FILE}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log INFO "${DB_NAME}_backup" "Keeping file ${ARCHIVE_FILE}."
|
log INFO "${DB_NAME}_backup" "Keeping file ${ARCHIVE_FILE}."
|
||||||
@ -281,7 +281,8 @@ remove_old_remote_archives() {
|
|||||||
|
|
||||||
openstack object list $CONTAINER_NAME > $BACKUP_FILES
|
openstack object list $CONTAINER_NAME > $BACKUP_FILES
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
log_backup_error_exit "Could not obtain a list of current backup files in the RGW"
|
log_backup_error_exit \
|
||||||
|
"Failed to cleanup remote backup. Could not obtain a list of current backup files in the RGW"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Filter out other types of backup files
|
# Filter out other types of backup files
|
||||||
@ -291,7 +292,8 @@ remove_old_remote_archives() {
|
|||||||
ARCHIVE_DATE=$( echo $ARCHIVE_FILE | awk -F/ '{print $NF}' | cut -d'.' -f 4)
|
ARCHIVE_DATE=$( echo $ARCHIVE_FILE | awk -F/ '{print $NF}' | cut -d'.' -f 4)
|
||||||
if [[ "$(seconds_difference ${ARCHIVE_DATE})" -gt "$((${REMOTE_DAYS_TO_KEEP}*86400))" ]]; then
|
if [[ "$(seconds_difference ${ARCHIVE_DATE})" -gt "$((${REMOTE_DAYS_TO_KEEP}*86400))" ]]; then
|
||||||
log INFO "${DB_NAME}_backup" "Deleting file ${ARCHIVE_FILE} from the RGW"
|
log INFO "${DB_NAME}_backup" "Deleting file ${ARCHIVE_FILE} from the RGW"
|
||||||
openstack object delete $CONTAINER_NAME $ARCHIVE_FILE || log_backup_error_exit "Cannot delete container object ${ARCHIVE_FILE}!"
|
openstack object delete $CONTAINER_NAME $ARCHIVE_FILE || log_backup_error_exit \
|
||||||
|
"Failed to cleanup remote backup. Cannot delete container object ${ARCHIVE_FILE}!"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -309,11 +311,14 @@ backup_databases() {
|
|||||||
SCOPE=${1:-"all"}
|
SCOPE=${1:-"all"}
|
||||||
|
|
||||||
# Create necessary directories if they do not exist.
|
# Create necessary directories if they do not exist.
|
||||||
mkdir -p $ARCHIVE_DIR || log_backup_error_exit "Cannot create directory ${ARCHIVE_DIR}!"
|
mkdir -p $ARCHIVE_DIR || log_backup_error_exit \
|
||||||
export TMP_DIR=$(mktemp -d) || log_backup_error_exit "Cannot create temp directory!"
|
"Backup of the ${DB_NAME} database failed. Cannot create directory ${ARCHIVE_DIR}!"
|
||||||
|
export TMP_DIR=$(mktemp -d) || log_backup_error_exit \
|
||||||
|
"Backup of the ${DB_NAME} database failed. Cannot create temp directory!"
|
||||||
|
|
||||||
# Create temporary log file
|
# Create temporary log file
|
||||||
export ERR_LOG_FILE=$(mktemp -p /tmp) || log_backup_error_exit "Cannot create log file!"
|
export ERR_LOG_FILE=$(mktemp -p /tmp) || log_backup_error_exit \
|
||||||
|
"Backup of the ${DB_NAME} database failed. Cannot create log file!"
|
||||||
|
|
||||||
# It is expected that this function will dump the database files to the $TMP_DIR
|
# It is expected that this function will dump the database files to the $TMP_DIR
|
||||||
dump_databases_to_directory $TMP_DIR $ERR_LOG_FILE $SCOPE
|
dump_databases_to_directory $TMP_DIR $ERR_LOG_FILE $SCOPE
|
||||||
@ -333,12 +338,14 @@ backup_databases() {
|
|||||||
TARBALL_FILE="${DB_NAME}.${DB_NAMESPACE}.${SCOPE}.${BACK_UP_MODE}.${NOW}.tar.gz"
|
TARBALL_FILE="${DB_NAME}.${DB_NAMESPACE}.${SCOPE}.${BACK_UP_MODE}.${NOW}.tar.gz"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $TMP_DIR || log_backup_error_exit "Cannot change to directory $TMP_DIR"
|
cd $TMP_DIR || log_backup_error_exit \
|
||||||
|
"Backup of the ${DB_NAME} database failed. Cannot change to directory $TMP_DIR"
|
||||||
|
|
||||||
#Archive the current database files
|
#Archive the current database files
|
||||||
tar zcvf $ARCHIVE_DIR/$TARBALL_FILE *
|
tar zcvf $ARCHIVE_DIR/$TARBALL_FILE *
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
log_backup_error_exit "Backup tarball could not be created."
|
log_backup_error_exit \
|
||||||
|
"Backup ${DB_NAME} to local file system failed. Backup tarball could not be created."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the size of the file
|
# Get the size of the file
|
||||||
|
@ -37,4 +37,5 @@ helm-toolkit:
|
|||||||
- 0.2.28 Set Security context to ks-user job at pod and container level
|
- 0.2.28 Set Security context to ks-user job at pod and container level
|
||||||
- 0.2.29 Enhance mariadb backup
|
- 0.2.29 Enhance mariadb backup
|
||||||
- 0.2.30 Add ability to image pull secrets on pods
|
- 0.2.30 Add ability to image pull secrets on pods
|
||||||
|
- 0.2.31 Add log strings for alert generation
|
||||||
...
|
...
|
||||||
|
Loading…
Reference in New Issue
Block a user