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. Set/get CustomAttribute issue in v4.3.6

Set/get CustomAttribute issue in v4.3.6

Scheduled Pinned Locked Moved Support
2 Posts 2 Posters 11.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.
  • C
    C
    cserzs
    wrote on last edited by
    #1

    Hi, 

    We have upgraded our NetXMS system from v3.9 to v4.3.6 and since then the set and getcustomattribute functions are not working properly. I use these functions in a trap processing script as below:

    // fmRadioAlarmState (0:warning event, 1:critical event, 2:alarm ceased)
    //m - contains the unique ID of the alarm
      t = time();
      evts = " ON";
      str3 = "";
      switch($event->parameters[2])
      {
          case 0:
            evt = "SME_PIRA_TRAP_WARNING";
            break;
          case 1:
            evt = "SME_PIRA_TRAP_CRITICAL";
            $node->setCustomAttribute(".signalLossTime" . format(m, 1, 0), t);
            break;
          case 2:
          evt = "SME_PIRA_TRAP_CLOSE";
          evts = " OFF";
          t0 = $node->getCustomAttribute(".signalLossTime" . format(m, 1, 0));
          if (t0 != null)
            {
            str3 = "Starting from:" . strftime("%Y.%m.%d %H:%M:%S", t0) . ", duration: " . format((t-t0), 1, 0) . "s";
            }
          break; 
          default:
            evt = "SME_PIRA_TRAP_INFO";
            break;
      }

    As I see the main problem is that the getcustomatrribute function always returns null. Anyone have any idea what could be the problem?

    Thank you in advance.

    1 Reply Last reply
    0
    • F
      F
      Filipp Sudanov
      wrote on last edited by
      #2

      I was not able to replicate this. What kind of ID do you have in m variable, is it decimal number or hex?

      I'd try a few things:

      • executing this script via "Execute server script" from node context menu. May be you'll see some errors there.
      • you can try removing the dot from the beginning of custom attribute name - in this case custom attribute will be visible in node properties. Does setCustomAttribute actually add custom attribute to the node?
      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