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. transformation

transformation

Scheduled Pinned Locked Moved Support
5 Posts 2 Posters 41.4k 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.
  • L
    L
    lindeamon
    wrote on last edited by
    #1

    hi,

    i have configured a dci to show me the system and agent uptime and when i look at the dci values i see the number of seconds and the only thing i can do is to display it as multiplier.
    i want to view it in days and hours format and came across a function called secondstouptime and i tried to use it but no luck.
    what is the right way to get what i want ?

    10x,
    lindeamon

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

      Hi!

      SecondsToUptime should do the work. Don't forget that function names are case-sensitive, and don't forget to change DCI type to String. You transformation script may looks like following:

      SecondsToUptime($1)
      

      or

      return SecondsToUptime($1);
      

      Best regards,
      Victor

      1 Reply Last reply
      0
      • L
        L
        lindeamon
        wrote on last edited by
        #3

        hi victor,

        u r the man.it worked like a charm,pitty this things do not appear on the user manual.
        another thing regarding this solution:
        i have configured a dci to find uptime through snmp and in the autoapply it told it to apply it on node that have snmp and do not have an agent.what i want to know is,once a node was applyed with this dci and i install an agent on it,will the template be automatically unbind ? if not,what is the right way do unbind it automatically ?

        10x
        lindeamon

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

          @lindeamon said in transformation:

          another thing regarding this solution:
          i have configured a dci to find uptime through snmp and in the autoapply it told it to apply it on node that have snmp and do not have an agent.what i want to know is,once a node was applyed with this dci and i install an agent on it,will the template be automatically unbind ? if not,what is the right way do unbind it automatically ?

          It all depends on your auto apply script. Template is applied when script returns true, and removed when script return false. So, if you wish template to be applied only on nodes with SNMP, but without NetXMS agent, and remoed from SNMP-only node when NetXMS agent installed on it, your auto apply script should looks like following:

          return $node->isSNMP && !$node->isAgent;
          

          Best regards,
          Victor

          1 Reply Last reply
          0
          • L
            L
            lindeamon
            wrote on last edited by
            #5

            thank you very much victor.

            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