Ad Widget

Collapse

Cleaning database from orphaned LLD items/triggers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Moebius
    Member
    • Dec 2022
    • 43

    #1

    Cleaning database from orphaned LLD items/triggers

    Zabbix 7.2.4., MySQL DB.

    I had attached a new version of a template to some existing hosts, then I went back to the previous template since I had to review some parameters.
    However, some discovered triggers from the new template continued to fire up.
    I deleted the new template altogether, but some orphaned LLD items and templates are still present in the database, since some triggers still continue to being fired up.

    I am unable to find those orphaned entries in the web interface. There are several sql scripts to clean up the database on github, but all of them are for very old Zabbix versions.

    Does anybody have some scripts to clean the database that have been tested on recent Zabbix versions?
    Or else, can anybody suggest a query to find those orphaned items in the database?
  • mrnobody
    Member
    • Oct 2024
    • 61

    #2

    To avoid this and remove templates without problems, using only FrontEnd resources; remember to use "Unlink and clear" in single Host configuration, or selecting a group of hosts and using "Mass update" button, with "unlink" and checkbox "Clear when unlinking". This is a good pratical, without it usage, problems like these can happen.

    To solve this in BackEnd, i don't know how, hope someone does. Good luck!

    Comment

    • Moebius
      Member
      • Dec 2022
      • 43

      #3
      The problem is that using "Unlink and clear" all past history is lost. Just using "unlink" without "clear" preserves the history for all the items with the same name in the new template.

      Keeping the past history for many items when upgrading the templates is important to me. That's why when doing that I always use "unlink" only.

      Comment


      • mrnobody
        mrnobody commented
        Editing a comment
        Okay. I think you can copy items from a template to another, but can't unlink and "relink" in a new template, 'cuz Database indexing requeriments. The history continue existing, but their links are broken now.
    • Moebius
      Member
      • Dec 2022
      • 43

      #4
      This is what I mean.
      This single host has duplicate trigger prototypes, half of them (the first four in this case, those whose name is not prefixed by the template name) are orphaned and leftovers from a previous template.

      Click image for larger version  Name:	immagine.png Views:	1 Size:	99.5 KB ID:	500574
      It's easy to detect and delete them on a single trigger prototype on a single host, but I have to repeat this for all trigger prototypes for ALL hosts.
      I'm looking for a way to have all orphaned trigger prototypes listed (in the web interface or with a sql query), to delete them all at once.

      Edit in response to previous comment: if the item name is the same the history is preserved and continues. Try it yourself and you'll see.
      Last edited by Moebius; 15-03-2025, 11:58.

      Comment

      Working...