Ad Widget

Collapse

How to correctly handle OID with dynamic indexes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xtianfab
    Junior Member
    • Aug 2023
    • 15

    #1

    How to correctly handle OID with dynamic indexes

    I have OID that returns the CPU usage value per minute, so the index changes every minute. If I perform a discovery I obtain the item correctly, but I obtain items for every minute. Is it possible to keep only the last value or what would be the correct way to handle these OIDs?

    Click image for larger version

Name:	image.png
Views:	548
Size:	9.0 KB
ID:	478665

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

    #2
    Show some examples of OIDs and values.

    Comment

    • xtianfab
      Junior Member
      • Aug 2023
      • 15

      #3
      Hello, Hamardaban, thanks for answering.


      I share an example:

      This is the OID, and the index changes every minute.

      └─$ snmpwalk -v 2c -c public x.x.x.x.x 1.3.6.1.4.1.1397.2.23.13.2.2
      iso.3.6.1.4.1.1397.2.23.13.2.2.1.1.1.12679912 = STRING: "2024-02-09 11:52:00"
      iso.3.6.1.4.1.1397.2.23.13.2.2.1.2.1.12679912 = Gauge32: 46
      iso.3.6.1.4.1.1397.2.23.13.2.2.1.3.1.12679912 = Gauge32: 45
      iso.3.6.1.4.1.1397.2.23.13.2.2.1.6.1.12679912 = Gauge32: 10

      Next minute:
      └─$ snmpwalk -v 2c -c public x.x.x.x 1.3.6.1.4.1.1397.2.23.13.2.2
      iso.3.6.1.4.1.1397.2.23.13.2.2.1.1.1.12679914 = STRING: "2024-02-09 11:54:00"
      iso.3.6.1.4.1.1397.2.23.13.2.2.1.2.1.12679914 = Gauge32: 46
      iso.3.6.1.4.1.1397.2.23.13.2.2.1.3.1.12679914 = Gauge32: 45
      iso.3.6.1.4.1.1397.2.23.13.2.2.1.6.1.12679914 = Gauge32: 10

      As you can see, the index changes and with each change a new item is generated in zabbix.

      Click image for larger version

Name:	image.png
Views:	507
Size:	9.1 KB
ID:	478710

      Regards
      Attached Files

      Comment

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

        #4
        The general idea is this: get a list of IDs and values with the CA key, convert the "SNMPwalk to JSON" preprocessing to json, and the next step is JS preprocessing: replace by regex "iso.3.6.1.4.1.1397.2.23.13.2.2.1.1.1.cxzcvxas a" to "iso.3.6.1.4.1.1397.2.23.13.2.2.1", "iso.3.6.1.4.1.1397.2.23.13.2.2.1.2.1.zxzzcss" to "iso.3.6.1.4.1.1397.2.23.13.2.2.1.2" ,,,,

        Comment

        • xtianfab
          Junior Member
          • Aug 2023
          • 15

          #5
          Should this be done in a discovery or should it be a discovery dependent item?

          Comment

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

            #6
            It is possible in both cases.
            The goal is to get json data for LLD of the desired content.

            "snmp item" -> data correction in item preprocessing -> "dependent lld rule" ->creating item
            or
            "snmp LLD rule" -> data correction in LLD preprocessing -> creating item

            Last edited by Hamardaban; 09-02-2024, 16:39.

            Comment

            • xtianfab
              Junior Member
              • Aug 2023
              • 15

              #7
              The problem is that every time the item is discovered, a new one is created, wouldn't it have to do with the key? I use the snmpindex for the key and since it is a different one, another item is created every minute

              Click image for larger version  Name:	image.png Views:	1 Size:	2.3 KB ID:	478735

              I can get the values ​​without problems, but they always get duplicated

              Regards
              Last edited by xtianfab; 10-02-2024, 03:08.

              Comment

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

                #8
                So I suggest you cut out the changing part and leave it unchanged. Then there will be no detection of "new" elements.

                Comment

                • xtianfab
                  Junior Member
                  • Aug 2023
                  • 15

                  #9
                  I think I already achieved it, doing a walk from Item and then preprocessing as you have indicated. I'll be testing and seeing how it works.

                  Thank you very much for the help​
                  Last edited by xtianfab; 11-02-2024, 15:50.

                  Comment

                  Working...