Ad Widget

Collapse

Manualy trigger Housekeeper ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jsosic
    Member
    • Apr 2008
    • 47

    #1

    Manualy trigger Housekeeper ?

    Hi

    is there a way to manually trigger the housekeeper process to start it's run? I've lowered housekeeper frequency to every 1h, but because the Zabbix instance I'm working on has been set up with very large history values (90 days, 999 days, etc), I'm trying to clean up the database as quickly and as efficiently as possible....

    This is a part of my zabbix server log:

    Code:
     25205:20131221:224515.597 housekeeper [deleted 624871 hist/trends, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items in 51.229155 sec, idle 1 hour(s)]
     25205:20131221:234515.597 executing housekeeper
     25205:20131221:234616.283 housekeeper [deleted 626446 hist/trends, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items in 60.685129 sec, idle 1 hour(s)]
     25205:20131222:004616.284 executing housekeeper
     25205:20131222:004708.684 housekeeper [deleted 613811 hist/trends, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items in 52.399685 sec, idle 1 hour(s)]
     25205:20131222:014708.685 executing housekeeper
     25205:20131222:014759.198 housekeeper [deleted 610763 hist/trends, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items in 50.512134 sec, idle 1 hour(s)]
     25205:20131222:024759.198 executing housekeeper
     25205:20131222:024851.583 housekeeper [deleted 526950 hist/trends, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items in 52.384463 sec, idle 1 hour(s)]
     25205:20131222:034851.584 executing housekeeper
     25205:20131222:034939.723 housekeeper [deleted 432874 hist/trends, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items in 48.138458 sec, idle 1 hour(s)]
    So, it basically deletes ~ 0.5M entries every hour. I would like to run it every 5 minutes until it cleans the database, is that possible?
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2
    Originally posted by jsosic
    I've lowered housekeeper frequency to every 1h
    HousekeepingFrequency this is not frequency. Name of this parameter and description in dist configuration file is completely misleading.
    1h it is how long zabbix server will wait after finish housekeeping cycle until will start next one. Single cycle may take hours or days even (more items you have longer cycle will be)
    Last edited by kloczek; 23-12-2013, 01:23.
    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
    https://kloczek.wordpress.com/
    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
    My zabbix templates https://github.com/kloczek/zabbix-templates

    Comment

    • jsosic
      Member
      • Apr 2008
      • 47

      #3
      Originally posted by kloczek
      HousekeepingFrequency this is not frequency. Name of this parameter and description in dist configuration file is completely misleading.
      1h it is how long zabbix server will wait after finish housekeeping cycle until will start next one. Single cycle may take hours or days even (more items you have longer cycle will be)
      OK, but can I lower it somehow under 1h? I want it to run with sleep intervals of around 5 minutes max until my history tables are cleaned up...

      Comment

      • kloczek
        Senior Member
        • Jun 2006
        • 1771

        #4
        Originally posted by jsosic
        OK, but can I lower it somehow under 1h? I want it to run with sleep intervals of around 5 minutes max until my history tables are cleaned up...
        Are you going to delete so often something from your zabbix setup (hots or items) that you need constantly remove not used anymore data?
        In zabbix case workload generated by zabbix adds up to 50% more IOs on storage layer used by DB backend only by enable housekeeper and delete historic data by delete SQL queries.

        If you are sing mysql with innodb remember that delete rows and inserting new ones causes in many cases even faster growing DB files and DB files can be shrinked by call OPTIMIZE TABLE table query. During ths operation table will be locked so to do this time to time you should have slave database as well to do OPTIMIZE time to time and swap between master and slave DBs.

        If you have small or POC environment I thin that you should better change HousekeepingFrequency to maximum 24 (hours) and restart server at the end of the working day to do one HK cycle per day when no one actively is changing something in zabbix configuration.

        To be honest I'm preparing my env (with about 600 boxes) to do HK partially by dropping partitions and partially by internal HK.
        On daily bases I want to remove data from history* tables by drop more than two weeks old partitions and delete data from trends* tables by normal housekeeper during the weekend. It will be necessary to patch server code to remove 24h limit between HK cycles.

        Nevertheless if you really want to do HK cycles without interruptions or with interval shorter than 1h just remove in source in src/zabbix_server/housekeeper/housekeeper.c line at the end of this file:

        Code:
        zbx_sleep_loop(CONFIG_HOUSEKEEPING_FREQUENCY * SEC_PER_HOUR);
        and recompile code or change parameter in this line to apply delay not in hours but in minutes (IMO it is waste of IOs but .. it is your choice).
        http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
        https://kloczek.wordpress.com/
        zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
        My zabbix templates https://github.com/kloczek/zabbix-templates

        Comment

        • jsosic
          Member
          • Apr 2008
          • 47

          #5
          I was thinking along the lines of sending HUP or something similar to housekeeper processes, which would then trigger housekeeping cycle.... I need it only temporary so that current history is cleaned up (I've modified lots of templates and shorten history days from ~90 to ~7-15).

          Housekeeper currently deletes ~600 000 lines per run.

          Comment

          • Avinasha
            Member
            • Jan 2018
            • 40

            #6
            zabbix_server -c /etc/zabbix/zabbix_server.conf -R housekeeper_execute

            Comment

            Working...