Ad Widget

Collapse

LLD How can I prevent the creation of new items when only 1 parameter changes?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • frater
    Senior Member
    • Oct 2010
    • 340

    #1

    LLD How can I prevent the creation of new items when only 1 parameter changes?

    I have written a discovery which returns 3 parameters.
    It creates items and triggers based on all those 3 parameters.
    However... I know beforehand that my discovery can give a different value for parameter 3.

    Zabbix then creates a new set of items & triggers and invalids the old one.
    I don't want this!

    I only want a creation when param1 or param2 changes and let it ignore param3.


    I asked this question before in this thread: https://www.zabbix.com/forum/zabbix-...-being-renewed
    But I guess I gave too much info there.

    I've already made some changes to the discovery script that makes it less likely to return a different param3, but it still can.
    I prefer to eliminate the possibility.
    Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP
  • frater
    Senior Member
    • Oct 2010
    • 340

    #2
    I don't think I ever had an answer when asking a question in this forum.
    Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP

    Comment

    • Hamardaban
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • May 2019
      • 2713

      #3
      What can we do if you ask questions that you must answer yourself after reading the documentation? Objects created in lld get their uniqueness by using #macros in them . If you use 3 macros for uniqueness, when you change at least one of them, you get NEW objects, and the old ones are no longer detected. Don't like it? Use 2 macros for uniqueness (in the key)!

      Comment

      • frater
        Senior Member
        • Oct 2010
        • 340

        #4
        Thanks for your reply.

        It's what you get if you do stuff my way. I learn thing by example and started by modifying an existing template.
        I (falsely) assumed the macros were defined there, but now I realize that the defining is done in my discovery script.

        While writing the discovery I had so much more programming to do that I just didn't realize I could just leave out that macro in the template at that position.
        Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP

        Comment

        • frater
          Senior Member
          • Oct 2010
          • 340

          #5
          Mmmm.... I misuderstood your suggestion.

          My script returns 3 macros

          #PATH = found path
          #FILE = regular expression for a cluster of files in that path
          #SIZE = a calculated minimum size that's somewhat smaller than the smallest file found thus far in that cluster.

          It seems I already tried that last Saturday.
          I removed #SIZE in my template in the section Filters and it still creates new items if #SIZE changes.

          How else can I get #SIZE if it's not returned by the discovery script I wrote?

          So in a nutshell my question is:

          I don't want to use #SIZE for uniqueness, but I do want the value of #SIZE.
          How do I get there?

          My pragmatic solution now is done in the discovery script. For #SIZE it return 1/10th of the smallest file rounded down to 10MB
          This way it can cope with variations between 50 MB, but that\'s still not good enough for some cases.
          I also prefer it to be 3/4....
          Most of the time the files get bigger, so there would still be no creations of new items if they double in size (which is good in this context).

          If it can't be done, that's alright too.
          I am asking here because I may be missing something or it can be done in some other way.
          Your answer isn't clear on that.
          If it's currently not a feature, I can ask for it.


          # fileagediscover /var/syncthing/ .stversions
          Code:
          {
          "data": [
          {
          "{#PATH}":"/var/syncthing/Chem/SQL/.stversions",
          "{#FILTER}":"Chem.*",
          "{#SIZE}":"120000"
          },
          {
          "{#PATH}":"/var/syncthing/Models/CDS/.stversions",
          "{#FILTER}":"cds_.*",
          "{#SIZE}":"780000"
          },
          {
          "{#PATH}":"/var/syncthing/Zwegers/MicroHIS/.stversions",
          "{#FILTER}":"KAPP.*",
          "{#SIZE}":"170000"
          }
          ]
          }
          Last edited by frater; 20-05-2020, 11:21.
          Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP

          Comment

          • Hamardaban
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • May 2019
            • 2713

            #6
            don't want to use #SIZE for uniqueness
            Exclude #SIZE from the set of macros returned by LLD.

            but I do want the value of #SIZE.
            Make a prototype of the data element that will get the #SIZE value, with the parameter #PATH for example.

            Comment

            • frater
              Senior Member
              • Oct 2010
              • 340

              #7
              Thanks for the suggestion and confirming there is currently no easy fix in Zabbix for ignoring certain elements of the returned value.
              In this specific implementation I will keep what I have. I have adapted the LLD-script so it almost always returns the same value even though the raw size of the smallest file has changed (by coarse rounding down).

              It even has a positive side-effect as it will remind me when the files keep growing or getting smaller. If I put a TTL of 4 days on it I will get ample time of noticing it and I can even let it slide and remove it out of my dashboard by acknowledging it.

              It's been running for a week now and it has not yet invalidated items and created new ones.

              If I can think of more real-life examples I will consider a feature request.
              Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP

              Comment

              Working...