Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Instance Discovery Filter Script [SOLVED]

Instance Discovery Filter Script [SOLVED]

Scheduled Pinned Locked Moved Support
34 Posts 4 Posters 173.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V
    V
    Victor Kirhenshtein
    wrote on last edited by
    #25

    Check that you really get the value with SNMPGetValue - it will return null if SNMP query fails for some reason, and null != 0, so instance that cannot be read will be accepted.

    Best regards,
    Victor

    1 Reply Last reply
    0
    • N
      N
      Nikk
      wrote on last edited by
      #26

      Victor you are right, i'm receiving null values, so is there a chance to get rid of them too? I tried to add != null, but no success.

      1 Reply Last reply
      0
      • V
        V
        Victor Kirhenshtein
        wrote on last edited by
        #27

        Hi,

        != null should work. Can you show full script please?

        Best regards,
        Victor

        1 Reply Last reply
        0
        • N
          N
          Nikk
          wrote on last edited by
          #28

          Script looks like this:

          snmp = CreateSNMPTransport($node);
          value = SNMPGetValue(snmp, ".1.3.6.1.2.1.16.1.1.1.3." . $1);
          if (value != null || value != 0) return value;
          else return false;

          Maybe i just don't get it 🙂

          1 Reply Last reply
          0
          • S
            S
            sperlm
            wrote on last edited by
            #29

            Hello, just a question...

            IF value is 0, doesnt it automatically mean that return value is equivalent to return false ?
            (thus not passing the filter script)

            MS

            1 Reply Last reply
            0
            • V
              V
              Victor Kirhenshtein
              wrote on last edited by
              #30

              Hi!

              Condition (value != null || value != 0) is always true - if value is null then it will not be 0, and vise versa. Correct condition will be (value != null && value != 0), so full script could look like this:

              snmp = CreateSNMPTransport($node);
              value = SNMPGetValue(snmp, ".1.3.6.1.2.1.16.1.1.1.3." . $1);
              return (value != null) && (value != 0);
              

              @sperlm:

              you are right, returning 0 is the same as returning false.

              Best regards,
              Victor

              1 Reply Last reply
              0
              • N
                N
                Nikk
                wrote on last edited by
                #31

                Thanks for correcting me!

                I tried your given script, but still getting 0 values.

                I guess i'm doing something wrong, or i haven't given all the necessary information.

                1 Reply Last reply
                0
                • S
                  S
                  sperlm
                  wrote on last edited by
                  #32

                  The filter discussed above is for the instanced DCIs, right ?
                  At the time of applying of the DCI it checks if there are values (non-zero and non-null) and creates real DCI for that one OID.

                  Where exactly are you getting those 0 values ?

                  If there are semi-stable values in the OIDs and DCIs are created at that time, these will exist even if OID return 0 afterwards... Check history of the DCIs which are showing 0 now.

                  You can also check snmpwalk if the 0 value is correct or not.

                  1 Reply Last reply
                  0
                  • N
                    N
                    Nikk
                    wrote on last edited by
                    #33

                    Yes, for instanced dcis.

                    I have checked history and snmpwalk, these values have never been more than 0, see attachment.


                    walk.png

                    1 Reply Last reply
                    0
                    • S
                      S
                      sperlm
                      wrote on last edited by
                      #34

                      When you remove those DCIs with zero values manually, they pop back up ?
                      If not, it must have been something while creating the DCI (mind that whenever you open or modify the DCI it reapplies).
                      If these return after modyfying/opening the root DCI, there is something in it.

                      1 Reply Last reply
                      0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      Powered by NodeBB Contributors
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups