From 23208bab168c3ced9ca57097db183d3b81c430d0 Mon Sep 17 00:00:00 2001 From: Dave Date: Tue, 15 Jul 2014 10:55:31 -0700 Subject: [PATCH] Update zabbix-mysql-backupconf.sh Adding new tables for Zabbix 2.2 and removing one unused one. Changing "backuping" to "Backing up". --- zabbix-mysql-backupconf.sh | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/zabbix-mysql-backupconf.sh b/zabbix-mysql-backupconf.sh index 4851066..7268079 100644 --- a/zabbix-mysql-backupconf.sh +++ b/zabbix-mysql-backupconf.sh @@ -1,9 +1,9 @@ #!/bin/bash # # zabbix-mysql-backupconf.sh -# v0.2 - 20111105 +# v0.3 - 2014-July-15 # -# Configuration Backup for Zabbix 1.8 w/MySQL +# Configuration Backup for Zabbix 2.2 w/MySQL # # Author: Ricardo Santos (rsantos at gmail.com) # http://zabbixzone.com @@ -11,7 +11,10 @@ # Thanks for suggestions from: # - Oleksiy Zagorskyi (zalex) # - Petr Jendrejovsky +# - Dave Orth # +# v0.3 - Updated with 6 new tables introduced with Zabbix 2.2 and deleted one table no longer present. +# New tables have been placed in CONFTABLES # mysql config DBHOST="localhost" @@ -31,18 +34,19 @@ DUMPDIR="${MAINDIR}/`${DATEBIN} +%Y%m%d%H%M`" ${MKDIRBIN} -p ${DUMPDIR} # configuration tables -CONFTABLES=( actions applications autoreg_host conditions config dchecks dhosts \ -drules dservices escalations expressions functions globalmacro graph_theme \ -graphs graphs_items groups help_items hostmacro hosts hosts_groups \ -hosts_profiles hosts_profiles_ext hosts_templates housekeeper httpstep \ -httpstepitem httptest httptestitem ids images items items_applications \ -maintenances maintenances_groups maintenances_hosts maintenances_windows \ -mappings media media_type node_cksum nodes opconditions operations \ -opmediatypes profiles proxy_autoreg_host proxy_dhistory proxy_history regexps \ -rights screens screens_items scripts service_alarms services services_links \ -services_times sessions slides slideshows sysmaps sysmaps_elements \ -sysmaps_link_triggers sysmaps_links timeperiods trigger_depends triggers \ -user_history users users_groups usrgrp valuemaps ) +CONFTABLES=( actions application_template applications autoreg_host conditions config \ +dchecks dhosts dbversion drules dservices escalations expressions functions globalmacro \ +globalvars graph_discovery graph_theme graphs graphs_items groups group_discovery \ +group_prototype host_discovery host_inventory hostmacro hosts hosts_groups hosts_templates \ +housekeeper httpstep httpstepitem httptest httptestitem icon_map icon_mapping ids images \ +interface interface_discovery item_discovery items items_applications maintenances \ +maintenances_groups maintenances_hosts maintenances_windows mappings media media_type \ +node_cksum nodes opcommand opcommand_grp opcommand_hst opconditions operations \ +opgroup opmessage opmessage_grp opmessage_usr optemplate profiles proxy_autoreg_host \ +proxy_dhistory proxy_history regexps rights screens screens_items scripts service_alarms \ +services services_links services_times sessions slides slideshows sysmap_element_url \ +sysmap_url sysmaps sysmaps_elements sysmaps_link_triggers sysmaps_links timeperiods \ +trigger_depends trigger_discovery triggers user_history users users_groups usrgrp valuemaps ) # tables with large data DATATABLES=( acknowledges alerts auditlog_details auditlog events \ @@ -52,7 +56,7 @@ history_uint history_uint_sync trends trends_uint ) # CONFTABLES for table in ${CONFTABLES[*]}; do DUMPFILE="${DUMPDIR}/${table}.sql" - echo "Backuping table ${table}" + echo "Backing up table ${table}" ${MYSQLDUMP} -R --opt --extended-insert=FALSE \ -h ${DBHOST} -u ${DBUSER} -p${DBPASS} ${DBNAME} --tables ${table} >${DUMPFILE} ${GZIP} -f ${DUMPFILE} @@ -61,7 +65,7 @@ done # DATATABLES for table in ${DATATABLES[*]}; do DUMPFILE="${DUMPDIR}/${table}.sql" - echo "Backuping schema table ${table}" + echo "Backing up schema table ${table}" ${MYSQLDUMP} -R --opt --no-data \ -h ${DBHOST} -u ${DBUSER} -p${DBPASS} ${DBNAME} --tables ${table} >${DUMPFILE} ${GZIP} -f ${DUMPFILE}