Ad Widget

Collapse

Is Zabbix configuration transportable?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pmurtey
    Member
    • Mar 2020
    • 91

    #1

    Is Zabbix configuration transportable?

    Hi All , If we were to build a new Zabbix server to replace an old one, is it possible to transfer all the configuration data from the old server to the new. We aren't concerned about the data, we just dont want to have to completely set it up from scratch again.

    TIA
  • derli1988
    Member
    • Apr 2021
    • 60

    #2
    You can easily import your old configuration back to the new Zabbix Server.

    All you have to do is dump your old database and then import it back to the new server... I've done that many times and it always worked.

    You can do something like this to dump all tables from Zabbix DB.

    mysqldump --user=$USER --password=$PASS --lock-tables zabbix -C -q > /tmp/zabbix_server-$(date +%F).sql
    and then move the SQL file over to your new server and do something like this:

    mysql --user=$USER --password=$PASS zabbix < /tmp/zabbix_server-$(date +%F).sql

    Let me know if it works

    Comment

    • pmurtey
      Member
      • Mar 2020
      • 91

      #3
      Hi All, Will the" mysqldump --user=$USER --password=$PASS --lock-tables zabbix -C -q > /tmp/zabbix_server-$(date +%F).sql" shown above save everything? Including users, and all alarm settings?

      Comment


      • derli1988
        derli1988 commented
        Editing a comment
        This will export everything that you have configured in your Zabbix frontend... Then you will have to import it to the new Zabbix Server or DB server if it is hosted elsewhere.

        Then, on the new system you have the option to copy your old zabbix.conf file
    • tim.mooney
      Senior Member
      • Dec 2012
      • 1427

      #4
      Everything that you configured through the web interface, including users and alarms, is stored in the database, so a complete SQL export of your database and a re-import to a different database server should preserve all of that.

      Anything you've customized in the zabbix_serverd.conf and the web front-end zabbix.conf.php aren't going to be part of the database export/import, so you would need to configure those things as appropriate on the new system.

      I don't know how big your Zabbix install is, but I wouldn't use /tmp/ for the database export. /tmp is usually either a memory filesystem or it's relatively space-constrained. If your zabbix database is large, a mysqldump written there could fill that area and cause any number of issues.

      Comment


      • derli1988
        derli1988 commented
        Editing a comment
        Since I posted the export, what I actually do is this... I've scripted the whole thing


        echo "defining variables"
        USER="xxx"
        PASS="xxxxxxxxxxxxxxxxx"
        YEAR=$(date +%Y)
        MONTH=$(date +%m)
        DAY=$(date +%d)
        OLDDATE=$(date +%F --date="1 week ago")
        DIR=/opt/backup/zabbix

        echo "Creating the backup files"
        cd $DIR
        mysqldump --user=$USER --password=$PASS --lock-tables zabbix -C -q > $DIR/zabbix_server-$(date +%F).sql


        I actually do not export it to /tmp, but you have a very good point back there, thanks.
    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #5
      As long as I see, it will do full dump of your DB, config, data et al...
      As you are not concerned about transferring data, it might be better to export/import your setting over API
      You can export groups, hosts, images, maps, mediaTypes, templates
      Users/usergroups have...

      Comment

      Working...