Ad Widget

Collapse

Zabbix backup script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • limo
    Senior Member
    • Dec 2004
    • 192

    #1

    Zabbix backup script

    Hi all,

    I know that backup zabbix is as easy as backup database but I think db should be divided into config data and history data. I am trying to open discussion here about standard backup mechanisms. It is not so easy even due locking of database during backup (some backup tools like mysqldump are doing this by default). During backup, zabbix cannot modify history. And only zabbix maintainers know, which tables are interesting and which are only "states" so we do not need to backup them.

    Would be nice to integrate backup into web frontend. It is not so hard to call this eg. by lynx and make regular backups.

    Backup should have parameters:
    - to backup history or not
    - time range for history backup
    - to backup config or not (if we want only history)
    - format of backup (best is probably directly SQL code)

    With regards,
    Lukas
  • krusty
    Senior Member
    • Oct 2005
    • 222

    #2
    Hi,

    at the moment i backup my whole database every night. For your information i still have 312118708 values stored into the database. I would prefer if the zabbix have included some backup options. Perhaps this was a feature for next release.

    To do the backup i use one own script which execute the mysql command mysqldump and search for old backups and delete this. If somebody is interested with the script i can post this.

    Greeting

    Comment

    • limo
      Senior Member
      • Dec 2004
      • 192

      #3
      Yes,

      not problem to make some script for me too. But I think I am advanced user and I know what to backup, how to backup and how to restore. But I am not sure averybody knows this. And I am not sure everybody needs all values in backup. It takes very long time, CPU and disk usage to backup all data in history. And I do not think this is good idea to do entire backup every day. But would be great to backup zabbix config every day.

      So my question is, to zabbix developpers, if they are thinking about implementing backup (and maybe restore) into zabbix frontend. Another approach is some external backup script developed by somebody else. But that script should have possibility to pass arguments which I wrote.

      Another question is, did somebody try to recover zabbix from sql script? When there is milions rows of data in history ? I tried this, and it is very slow, and during recovery, everything is locked , zabbix is unusable. I know that we are not restoring every day, but there should be right and quick way how to recover zabbix from backups.

      I think this should be in 2 passes:
      - recover config tables (zabbix is working and getting data now)
      - maybe housekeeper will recover history and trends (takes long time, line by line or by group, because if we insert entire history or many lines in one turn, history is locked for long time...)

      Maybe I am wrong. But believe me, if you run entire sql script from mysqldump into mysql (with history and trends), it can take VERY long time. And, alphabeticaly, history is before itehs or hosts, so until history is back, zabbix is sleeping
      Last edited by limo; 26-06-2006, 10:39. Reason: Repaired housekeeping reason

      Comment

      • krusty
        Senior Member
        • Oct 2005
        • 222

        #4
        Hi limo,

        i have tested this with our zabbix server. At the moment my backup has a size of 2 GB. The restore procedure takes 1 1/2 hours. I think that is really okay.

        At first i have searched something about incemental backups. But with MySQL you can not implement incrementel backups. Please correct me if i was wrong. I do not found any information about this issue.

        Comment

        • limo
          Senior Member
          • Dec 2004
          • 192

          #5
          OK,

          you was more lucky than me I really do not remember version of mysqld which I had and number of values but I know it took much more time (arround 6hours). Machine was strong enaught to normal zabbix server operation, but restoring was my nightmare.

          Question is still same Isn't it better to load config data first and than load history and trends ? Is there any scenario where this can brake some triggers or do something wrong ? Or another way, load config first, then some amount of recent history and trends, then rest.

          And my sollution of this depends on fact, if it is planned into frontend or if I should write my own script, post it here and work externaly of zabbix tree

          Comment

          • krusty
            Senior Member
            • Oct 2005
            • 222

            #6
            Have you look for some incremental backup facility?

            For MySQL i found nothing.

            Comment

            • subba5678
              Senior Member
              • May 2010
              • 132

              #7
              Hi,
              Could you post the backup and recovery script , this will be help full for me . as iam using Zabbix 1.8 VErsion . Please help me

              Thanks,
              Subbu

              Comment

              • alixen
                Senior Member
                • Apr 2006
                • 474

                #8
                Originally posted by subba5678
                Hi,
                Could you post the backup and recovery script , this will be help full for me . as iam using Zabbix 1.8 VErsion . Please help me

                Thanks,
                Subbu
                Basically, it is a simple command line.
                Backup:
                Code:
                mysqldump zabbix > zabbix.dmp
                Recovery:
                Code:
                mysql zabbix < zabbix.dmp
                You may have to add some options if database access is password protected.

                Regards,
                Alixen
                http://www.alixen.fr/zabbix.html

                Comment

                • subba5678
                  Senior Member
                  • May 2010
                  • 132

                  #9
                  Zabbix Backup Script

                  Hi,
                  Thanks for the reply, the query woks fine , i was in vacation so i didn't get a chance to get back to you . Please send me a query that should take the INCREMENTAL backup for the entire Database. So it will really helpful to me

                  Thanks in advance
                  Subbu
                  Last edited by subba5678; 11-08-2010, 12:59. Reason: missed the zabbix Name

                  Comment

                  • nelsonab
                    Senior Member
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • Sep 2006
                    • 1233

                    #10
                    The MySQL documentation has a section on backups.

                    http://dev.mysql.com/doc/refman/5.1/...p-methods.html
                    RHCE, author of zbxapi
                    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
                    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

                    Comment

                    • subba5678
                      Senior Member
                      • May 2010
                      • 132

                      #11
                      Zabbix Backup Script

                      Hi,
                      Thanks for the reply . Is there any way to take the incremental backup with the below posted script (things in broad). As iam getting the error when iam taking the backup from the link http://dev.mysql.com/doc/refman/5.1/...p-methods.html

                      Basically, it is a simple command line.
                      Backup:
                      Code:
                      mysqldump zabbix > zabbix.dmp
                      Recovery:
                      Code:
                      mysql zabbix < zabbix.dmp

                      Comment

                      • bbrendon
                        Senior Member
                        • Sep 2005
                        • 870

                        #12
                        Here is a script that backs up just the important part of the DB. I switched to backing up the entire DB once a month and backing up the settings in the DB daily using this script.

                        This give you a 1 MB database backup. For the large tables, it just stores the schema so essentially if you restored using this, you'd get everything you had except the history.

                        ZabbixZone scripts for Zabbix Project. Contribute to bbrendon/zabbixzone development by creating an account on GitHub.
                        Unofficial Zabbix Expert
                        Blog, Corporate Site

                        Comment

                        Working...