Skip to content

Commit

Permalink
Update Zabbix Template
Browse files Browse the repository at this point in the history
  • Loading branch information
tiredofit committed Nov 4, 2023
1 parent 3837bea commit dad5294
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions install/assets/functions/10-db-backup
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,11 @@ generate_checksum() {
checksum_value=$(run_as_user cat "${target}"."${checksum_extension}" | awk '{print $1}')
checksum_routines_finish_time=$(date +'%s')
checksum_routines_total_time=$(echo $((checksum_routines_finish_time-checksum_routines_start_time)))
zabbix_checksum_time=$(cat <<EOF
- dbbackup.backup.checksum.duration.[${backup_job_db_host}.${backup_job_db_name}] ${checksum_routines_total_time}
- dbbackup.backup.checksum.hash.[${backup_job_db_host}.${backup_job_db_name}] ${checksum_value}
EOF
)
write_log debug "${checksum_extension^^}: ${checksum_value} - ${target}"
write_log debug "Checksum routines time taken: $(echo ${checksum_routines_total_time} | awk '{printf "Hours: %d Minutes: %02d Seconds: %02d", $1/3600, ($1/60)%60, $1%60}')"
else
Expand Down Expand Up @@ -1313,6 +1318,7 @@ post_dbbackup() {
- dbbackup.backup.datetime.[${backup_job_db_host}.${backup_job_db_name}] "${dbbackup_date}"
- dbbackup.backup.status.[${backup_job_db_host}.${backup_job_db_name}] "${exit_code}"
- dbbackup.backup.duration.[${backup_job_db_host}.${backup_job_db_name}] "$(echo $((dbbackup_finish_time-dbbackup_start_time)))"
${zabbix_checksum_time}
EOF
if [ "$?" != "0" ] ; then write_log error "Error sending statistics, consider disabling with 'CONTAINER_ENABLE_MONITORING=FALSE'" ; fi
fi
Expand Down
19 changes: 19 additions & 0 deletions zabbix_templates/db_backup.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@
"key": "dbbackup.backup.[{#NAME}]",
"delay": "0",
"item_prototypes": [
{
"uuid": "5a2c4d1cacf844829bc1fbf912e071c5",
"name": "[{#NAME}] Checksum duration",
"type": "TRAP",
"key": "dbbackup.backup.checksum.duration.[{#NAME}]",
"delay": "0",
"history": "7d",
"units": "unixtime"
},
{
"uuid": "6e49769ec07344a4974b13dab00c3539",
"name": "[{#NAME}] Checksum Hash",
"type": "TRAP",
"key": "dbbackup.backup.checksum.hash.[{#NAME}]",
"delay": "0",
"history": "30d",
"trends": "0",
"value_type": "TEXT"
},
{
"uuid": "bb6472e30bff4d9c908b1d34b893e622",
"name": "[{#NAME}] Last Backup",
Expand Down

0 comments on commit dad5294

Please sign in to comment.