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. interface id on state change

interface id on state change

Scheduled Pinned Locked Moved Support
4 Posts 2 Posters 33.3k 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.
  • M
    M
    MarcusH
    wrote on last edited by
    #1

    Hi,

    I am monitoring all the ports on our switches to see if and when hardware is added or removed via the state change of the interface.
    These are named after the portnumber so the alarm state for example "Interface "33" unexpectedly changed state..."

    What is the best and most correct way to add alias to ports since i want to add room/local network alias to the interface port so i know where or who it is.
    Change object name does not work since it updates when polling back to port number, change port name on the switch does not work it wont send that when snmp is polling.
    Now i am looking into the custom attribute to set that and if you can use data from these in the alarm message, still trying to find info about how custom attributes are used though.

    Any pointers would be appreciated.

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

      Hi,

      You can use custom attribute or comment field on interface. The only trick here is that event source is a node, not an interface. To access custom attribute (or comment) of an interface for interface event you can use the following script:

      iface = GetInterfaceObject($node, $5);
      return iface->comments;
      // For custom attribute replace with
      // return GetCustomAttribute(iface, "attribute_name");
      

      You can create such script in script library and then use %[script_name] macro in your messages.

      Best regards,
      Victor

      1 Reply Last reply
      0
      • M
        M
        MarcusH
        wrote on last edited by
        #3

        Many thanks for help with the script, i have tested it and i got it to work as intended and it is triggered as planed but $5 does not return anything so it fails.
        If i change $5 to 1 manually as it is the iface i test on it works and the custom attribute is shown in the alert message.

        1 Reply Last reply
        0
        • M
          M
          MarcusH
          wrote on last edited by
          #4

          Been trying to figure this out but every information i find states that parameters are passed as macro %5 or variable $5 in script.

          macro %5 works in message but variable $5 is empty when calling script via macro in message is this bugged in any way, or might i be missing something crucial here?

          Running version 2.0.5

          Edit:
          Found solution, change $5 to $event->parameters[5]

          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