Skip to content

Conversation

@ironbishop
Copy link

Version 0.9.3 doesn't list zabbix 5 new tables, and (on psql/timescaledb) outputs:

Reading database options from /etc/zabbix/zabbix_server.conf...
 Configuration:
  - type:     psql
  - host:     ...
  - port:     5432
  - schema:   public
  - database: zabbix
  - user:     zabbix
  - output:   /root
 Fetching list of existing tables...
 ERROR
 Unknown tables found in database:
  - interface_snmp
  - lld_override
  - lld_override_condition
  - lld_override_opdiscover
  - lld_override_operation
  - lld_override_ophistory
  - lld_override_opinventory
  - lld_override_opperiod
  - lld_override_opseverity
  - lld_override_opstatus
  - lld_override_optag
  - lld_override_optemplate
  - lld_override_optrends
  - media_type_message
  - module
  - task_data
  - task_result
 To include them (full data backup) specify -f, to ignore them use -i

Note: this PR contains a version bump.

@ironbishop
Copy link
Author

Checked that it's the same column set on MySQL too.

@rufik
Copy link

rufik commented Jul 16, 2020

Output for Zabbix 5.0.1 on MySQL 8.0:

Configuration:
 - type:     mysql
 - host:     xxxxxx
 - port:     3306
 - database: xxxxxx
 - user:     xxxxxx
 - output:   /root/zbx_backup
Fetching list of existing tables...

ERROR
Unknown tables found in database:
 - interface_snmp
 - lld_override
 - lld_override_condition
 - lld_override_opdiscover
 - lld_override_operation
 - lld_override_ophistory
 - lld_override_opinventory
 - lld_override_opperiod
 - lld_override_opseverity
 - lld_override_opstatus
 - lld_override_optag
 - lld_override_optemplate
 - lld_override_optrends
 - media_type_message
 - module
 - task_data
 - task_result
To include them (full data backup) specify -f, to ignore them use -i

@tanertas
Copy link

Is this patch tested for dump and restore?

@ironbishop
Copy link
Author

Backup is working for me. Restore not tested.

Dishonor on me, dishonor on my cow.

@hermanekt
Copy link

Backup and restore working fine.

@hermanekt
Copy link

hermanekt commented Jul 30, 2020

BACKUP
git clone https://github.com/hermanekt/zabbix-backup/blob/master/zabbix-dump
./zabbix-dump -t psql -H localhost -P 5432 -o /var/backup

RESTORE
systemctl stop zabbix-server.service
sudo -u postgres dropdb zabbix
sudo -u postgres createdb -O zabbix zabbix

echo "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" | sudo -u postgres psql zabbix
echo "SELECT timescaledb_pre_restore();" | sudo -u postgres psql zabbix

gunzip /var/backup/zabbix_cfg_localhost_20200730-1810_db-psql-5.0.1.sql.gz
sudo -u postgres psql zabbix < /var/backup/zabbix_cfg_localhost_20200730-1810_db-psql-5.0.1.sql

echo "SELECT timescaledb_post_restore();" | sudo -u postgres psql zabbix
systemctl restart postgresql-12.service
systemctl start zabbix-server.service

@maxhq
Copy link
Owner

maxhq commented Jul 30, 2020

Hey all! Thanks a lot for testing and reporting. As soon as I am working with Zabbix again I will merge this. But it will take some more days.
Sorry for the delay ... as usual ;-)

@jokay
Copy link

jokay commented Aug 6, 2020

What about replacing all existing (and still existing 😉) from x.x.x - 4.4.4 to x.x.x - 5.0.0 as well?

@ironbishop
Copy link
Author

ok but, i tought that was only a comment, isn't it? it is not used in the code. what is those columns purpose?

zabbix-backup/zabbix-dump

Lines 418 to 423 in 811d064

while read -r line; do
table=$(echo "$line" | cut -d" " -f1)
echo "$line" | cut -d" " -f5 | grep -qi "SCHEMAONLY"
test $? -eq 0 && SCHEMAONLY_TABLES+=($table)
KNOWN_TABLES+=($table)
done < <(sed '0,/^__DATA__$/d' "${BASH_SOURCE[*]}" | tr -s " ")

@maxhq
Copy link
Owner

maxhq commented Aug 6, 2020

@ironbishop You are right, it is not currently used.
I might use it in a future version to warn if old tables still exist in the database...

@jokay
Copy link

jokay commented Aug 6, 2020

ok but, i tought that was only a comment, isn't it? it is not used in the code.

Yes, but the fact it's only a comment doesn't mean it shouldn't be maintained.

@ironbishop
Copy link
Author

i bumped all tables present in my environment. im currently using 5.0.2

@jurim76
Copy link

jurim76 commented Feb 23, 2021

zabbix 5.2. has a new tables

  • item_parameter
  • role
  • role_rule
  • trigger_queue

@xray-sky
Copy link

We really need support for 5.0. Any estimate when this might be merged? If there are outstanding tasks needing done, e.g. around testing, I'm happy to contribute what I can to that.

@jokay
Copy link

jokay commented Apr 2, 2021

@maxhq any updates on this?

@maxhq
Copy link
Owner

maxhq commented Apr 2, 2021

@jokay @xray-sky my problem is that I rarely interact with Zabbix these days, do not have a recent version installed and currently have no spare time.
As @hermanekt wrote above the patch is working for him, so please use his version (https://raw.githubusercontent.com/hermanekt/zabbix-backup/master/zabbix-dump) until I find time for releasing a new version with the recent PRs.
If anyone is willing to take over the maintenance of this script, just tell me, fork this repo and I‘ll mention it in my README.
Sorry for the inconvenience!

@jokay
Copy link

jokay commented Apr 2, 2021

@maxhq thx for the feedback 👍

@ironbishop
Copy link
Author

ironbishop commented Apr 7, 2021

I am already maintaining the script for my needs, the fork is npotorino/zabbix-backup ...

I do not plan to have a lab with every version installed, so I do not plan to support intermediate versions (x.2 and x.4, for x >=5) unless I'm actively using it in my environment.

edit:
using Github actions, it might be possible to automate all versions check .. and that could solve the tests issue, at least partially.

@jokay
Copy link

jokay commented Apr 7, 2021

I think supporting active LTS version(s) may already work for the most people?

@colttt
Copy link

colttt commented Jul 20, 2021

with Zabbix 5.4 I got an error:

ERROR
Unknown tables found in database:
 - dashboard_page
 - httptest_tag
 - item_parameter
 - item_tag
 - report
 - report_param
 - report_user
 - report_usrgrp
 - role
 - role_rule
 - script_param
 - sysmaps_element_tag
 - token
 - trigger_queue
 - valuemap
 - valuemap_mapping
To include them (full data backup) specify -f, to ignore them use -i

ironbishop added a commit to npotorino/zabbix-backup that referenced this pull request Jul 20, 2021
@ironbishop
Copy link
Author

@colttt can you please test branch https://github.com/npotorino/zabbix-backup/tree/zabbix-5-4-tables and confirm it's working fine without the "unknown tables" message?

ironbishop added a commit to npotorino/zabbix-backup that referenced this pull request Jul 21, 2021
@ironbishop
Copy link
Author

tested on 5.2 and 5.4, good for me 👍

@accessone67
Copy link

@ironbishop - new version works zabbix v5.4.6. Thank you,

@hermanekt
Copy link

hermanekt commented Nov 30, 2021

Hi i created updated version for 6.0 ready, i also fix some issues. https://github.com/hermanekt/zabbix-backup

@ironbishop
Copy link
Author

@hermanekt would you like to add your tables as a PR to https://github.com/npotorino/zabbix-backup
also which issues did you fix
also please make edits on a branch instead of directly commit to master/main branch
also i dont fully understand why you need the custom format dump

@maxhq
Copy link
Owner

maxhq commented Dec 13, 2021

Everybody following here might want to read my comment about the future development.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants