Ad Widget

Collapse

Clearing orphaned history?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scalft
    Junior Member
    • Apr 2008
    • 12

    #1

    Clearing orphaned history?

    I have just deleted several items from a template. We had previous history for those items, and our database is fairly large. Based on the time required to perform the deletes, I do not feel it deleted the associated history for these items.

    Is there a way I can find and clear that history? Will the housekeeper do that for met or do I need to pull out my SQL Cookbook?

    Thanks,

    Thad
  • tekknokrat
    Senior Member
    • Sep 2008
    • 140

    #2
    remove history of deleted items

    We have the same issue,

    i think when first using the Linux_Server Template its just for everyone beginning to use zabbix in production that some items arent set wrong.
    So it needs explicit testing for every template otherwise it causes inconsistency in your information data if you cant delete the history.

    I suggest feature request for clear history of deleted items.

    Comment

    • xs-
      Senior Member
      Zabbix Certified Specialist
      • Dec 2007
      • 393

      #3
      Housekeeper should do this, but (in 1.4 at least) it was possible to have orphaned data.

      Try this, make backups first.
      DELETE history_str.* FROM history_str LEFT OUTER JOIN items ON history_str.itemid = items.itemid WHERE items.itemid IS NULL;
      DELETE history_uint.* FROM history_uint LEFT OUTER JOIN items ON history_uint.itemid = items.itemid WHERE items.itemid IS NULL;
      DELETE history_str_sync.* FROM history_str_sync LEFT OUTER JOIN items ON history_str_sync.itemid = items.itemid WHERE items.itemid IS NULL;
      DELETE history_sync.* FROM history_sync LEFT OUTER JOIN items ON history_sync.itemid = items.itemid WHERE items.itemid IS NULL;
      DELETE history_log.* FROM history_log LEFT OUTER JOIN items ON history_log.itemid = items.itemid WHERE items.itemid IS NULL;
      DELETE history.* FROM history LEFT OUTER JOIN items ON history.itemid = items.itemid WHERE items.itemid IS NULL;
      DELETE trends.* FROM trends LEFT OUTER JOIN items ON trends.itemid = items.itemid WHERE items.itemid IS NULL;
      DELETE events.* FROM events LEFT OUTER JOIN triggers ON events.objectid = triggers.triggerid WHERE triggers.triggerid IS NULL;
      --
      Disclaimer: These sql statements work for me in 1.4. Always make backups before you attempt to mangle the database

      Comment

      Working...