Ad Widget

Collapse

Database backups without the data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fittim
    Junior Member
    • Apr 2016
    • 15

    #1

    Database backups without the data

    Hello,

    There are couple of similar topics but does a streamlined solution exist for backing up your DB without backing up the past graph data?

    I am using:

    Code:
    ii  zabbix-agent                    1:3.4.1-1+stretch              amd64        Zabbix network monitoring solution - agent
    ii  zabbix-frontend-php             1:3.4.1-1+stretch              all          Zabbix network monitoring solution - PHP front-end
    ii  zabbix-get                      1:3.4.1-1+stretch              amd64        Zabbix network monitoring solution - get
    ii  zabbix-server-mysql             1:3.4.1-1+stretch              amd64        Zabbix network monitoring solution - server (MySQL)
    Here are some table sizes:

    Code:
    +----------------------------+---------------+---------------+
    | Table Name                 | Quant of Rows | Total Size Kb |
    +----------------------------+---------------+---------------+
    | acknowledges               |          6323 |        896.00 |
    | actions                    |             2 |         48.00 |
    | alerts                     |             0 |        144.00 |
    | application_discovery      |             0 |         48.00 |
    | application_prototype      |             0 |         48.00 |
    | application_template       |           111 |         48.00 |
    | applications               |           288 |         32.00 |
    | auditlog                   |          7907 |       1952.00 |
    | auditlog_details           |           949 |        144.00 |
    | autoreg_host               |            18 |         32.00 |
    | conditions                 |             6 |         32.00 |
    | config                     |             0 |         48.00 |
    | corr_condition             |             0 |         32.00 |
    | corr_condition_group       |             0 |         32.00 |
    | corr_condition_tag         |             0 |         16.00 |
    | corr_condition_tagpair     |             0 |         16.00 |
    | corr_condition_tagvalue    |             0 |         16.00 |
    | corr_operation             |             0 |         32.00 |
    | correlation                |             0 |         16.00 |
    | dashboard                  |             0 |         32.00 |
    | dashboard_user             |             0 |         48.00 |
    | dashboard_usrgrp           |             0 |         48.00 |
    | dbversion                  |             0 |         16.00 |
    | dchecks                    |             6 |         32.00 |
    | dhosts                     |            52 |         32.00 |
    | drules                     |             2 |         48.00 |
    | dservices                  |            79 |         48.00 |
    | escalations                |             0 |         32.00 |
    | event_recovery             |         60948 |       5680.00 |
    | event_tag                  |             0 |         32.00 |
    | events                     |        327561 |      44672.00 |
    | expressions                |             0 |         32.00 |
    | functions                  |          1443 |        288.00 |
    | globalmacro                |             0 |         32.00 |
    | globalvars                 |             0 |         16.00 |
    | graph_discovery            |             0 |         32.00 |
    | graph_theme                |             2 |         32.00 |
    | graphs                     |           441 |        160.00 |
    | graphs_items               |           921 |        192.00 |
    | group_discovery            |             0 |         32.00 |
    | group_prototype            |             0 |         64.00 |
    | groups                     |             7 |         32.00 |
    | history                    |     122267235 |    9488384.00 |
    | history_log                |         11710 |       1856.00 |
    | history_str                |        322120 |      33856.00 |
    | history_text               |            14 |         32.00 |
    | history_uint               |      85896574 |    6666240.00 |
    | host_discovery             |             0 |         48.00 |
    | host_inventory             |             0 |         16.00 |
    | hostmacro                  |             0 |         32.00 |
    | hosts                      |            62 |        112.00 |
    | hosts_groups               |            60 |         48.00 |
    | hosts_templates            |            15 |         48.00 |
    | housekeeper                |          7028 |        416.00 |
    | httpstep                   |             0 |         32.00 |
    | httpstep_field             |             0 |         32.00 |
    | httpstepitem               |             0 |         48.00 |
    | httptest                   |             0 |         80.00 |
    | httptest_field             |             0 |         32.00 |
    | httptestitem               |             0 |         48.00 |
    | icon_map                   |             0 |         48.00 |
    | icon_mapping               |             0 |         48.00 |
    | ids                        |            16 |         16.00 |
    | images                     |            20 |         80.00 |
    | interface                  |            11 |         48.00 |
    | interface_discovery        |             0 |         32.00 |
    | item_application_prototype |             0 |         48.00 |
    | item_condition             |             0 |         32.00 |
    | item_discovery             |             0 |         48.00 |
    | item_preproc               |          2072 |        208.00 |
    | items                      |          6176 |       2592.00 |
    | items_applications         |          4735 |        800.00 |
    | maintenances               |             0 |         48.00 |
    | maintenances_groups        |             0 |         48.00 |
    | maintenances_hosts         |             0 |         48.00 |
    | maintenances_windows       |             0 |         48.00 |
    | mappings                   |            31 |         32.00 |
    | media                      |             0 |         48.00 |
    | media_type                 |             3 |         32.00 |
    | opcommand                  |             0 |         32.00 |
    | opcommand_grp              |             0 |         48.00 |
    | opcommand_hst              |             0 |         48.00 |
    | opconditions               |             0 |         32.00 |
    | operations                 |             2 |         32.00 |
    | opgroup                    |             0 |         48.00 |
    | opinventory                |             0 |         16.00 |
    | opmessage                  |             0 |         32.00 |
    | opmessage_grp              |             0 |         48.00 |
    | opmessage_usr              |             0 |         48.00 |
    | optemplate                 |             2 |         48.00 |
    | problem                    |           902 |        208.00 |
    | problem_tag                |             0 |         48.00 |
    | profiles                   |           461 |        144.00 |
    | proxy_autoreg_host         |             0 |         32.00 |
    | proxy_dhistory             |             0 |         32.00 |
    | proxy_history              |             0 |         32.00 |
    | regexps                    |             0 |         32.00 |
    | rights                     |             0 |         48.00 |
    | screen_user                |             0 |         48.00 |
    | screen_usrgrp              |             0 |         48.00 |
    | screens                    |             3 |         48.00 |
    | screens_items              |            17 |         32.00 |
    | scripts                    |             2 |         64.00 |
    | service_alarms             |             0 |         48.00 |
    | services                   |             0 |         32.00 |
    | services_links             |             0 |         48.00 |
    | services_times             |             0 |         32.00 |
    | sessions                   |            46 |         32.00 |
    | slides                     |             0 |         48.00 |
    | slideshow_user             |             0 |         48.00 |
    | slideshow_usrgrp           |             0 |         48.00 |
    | slideshows                 |             0 |         48.00 |
    | sysmap_element_trigger     |             0 |         48.00 |
    | sysmap_element_url         |             0 |         32.00 |
    | sysmap_shape               |             0 |         32.00 |
    | sysmap_url                 |             0 |         32.00 |
    | sysmap_user                |             0 |         48.00 |
    | sysmap_usrgrp              |             0 |         48.00 |
    | sysmaps                    |             0 |         80.00 |
    | sysmaps_elements           |             0 |         96.00 |
    | sysmaps_link_triggers      |             0 |         48.00 |
    | sysmaps_links              |             0 |         64.00 |
    | task                       |             0 |         48.00 |
    | task_acknowledge           |           351 |         16.00 |
    | task_close_problem         |             0 |         16.00 |
    | task_remote_command        |             0 |         16.00 |
    | task_remote_command_result |             0 |         16.00 |
    | timeperiods                |             0 |         16.00 |
    | trends                     |       1856354 |     133856.00 |
    | trends_uint                |       2471128 |     178016.00 |
    | trigger_depends            |             0 |         48.00 |
    | trigger_discovery          |             0 |         32.00 |
    | trigger_tag                |             0 |         32.00 |
    | triggers                   |          1526 |        416.00 |
    | users                      |             0 |         32.00 |
    | users_groups               |             0 |         48.00 |
    | usrgrp                     |            11 |         32.00 |
    | valuemaps                  |             7 |         32.00 |
    | widget                     |             9 |         32.00 |
    | widget_field               |             0 |        112.00 |
    +----------------------------+---------------+---------------+
    140 rows in set (0.02 sec)
    I could put the auditlogs, history* and trends* for ignore in mysqlbackup, however that would still mean I need to dump the structure for those. I just wonder if there is now a more conveniant way to back Zabbix up. I need all the settings, accounts, graphs but not the historical data, since Zabbix is mostly used in case of troubleshooting in my case I don't care about past values.

    Thank you.
  • bbrendon
    Senior Member
    • Sep 2005
    • 870

    #2
    I'm pretty sure this works on any version of zabbix.
    ZabbixZone scripts for Zabbix Project. Contribute to bbrendon/zabbixzone development by creating an account on GitHub.
    Unofficial Zabbix Expert
    Blog, Corporate Site

    Comment

    • fittim
      Junior Member
      • Apr 2016
      • 15

      #3
      Thanks I would just note 1 error in the script:

      Code:
      sed "s/\b$exclude\b//g"`
      The \b is not required, for me it breaks the sed data extraction.

      Comment

      Working...