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. Script as Instance Discovery

Script as Instance Discovery

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 22.5k 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
    Luis Montaño
    wrote on last edited by
    #1

    Hi all,
    sorry for my english, I'm from Ecuador and I don't speak English very well.

    I'm using netxms and I think that its great. I have the next problem:
    I have some switches cisco 2960, I want to create a template to poll consumed ram from them
    I checked cisco documentation and I know that I can get used ram wid oid ".1.3.6.1.4.1.9.9.48.1.1.1.5.1" and free ram with oid ".1.3.6.1.4.1.9.9.48.1.1.1.6.1"
    those oid are not tables. The problem is that I dont have a oid to poll used ram in percentage so I create an script that I called SNMPOperations wich calculate percentage consumed.
    I have tried this in several ways and I can't figure out what is wrong.
    For example:
    If I create the script with the function GetValueSNMP that recive a node object and return consumed ram (in percentage)

    Script version 1:
    sub GetValueSNMP(parameter)
    {
        transport = CreateSNMPTransport(parameter);  // "parameter" is a node object
        usedRAM = SNMPGetValue(transport, ".1.3.6.1.4.1.9.9.48.1.1.1.5.1");
        freeRAM = SNMPGetValue(transport, ".1.3.6.1.4.1.9.9.48.1.1.1.6.1");
        totalRAM = usedRAM + freeRAM;
        usedRAMPercentage = ((usedRAM * 100)/totalRAM);
        return usedRAMPercentage;
    }
    I'm calling previous script in TransformationTab (doesn't work) and Instance Discovery(doesn't work)  in the following way:

    use SNMPOperations;
    return GetValueSNMP($node);

    Script version 2:
        transport = CreateSNMPTransport($node);
        usedRAM = SNMPGetValue(transport, ".1.3.6.1.4.1.9.9.48.1.1.1.5.1");
        freeRAM = SNMPGetValue(transport, ".1.3.6.1.4.1.9.9.48.1.1.1.6.1");
        totalRAM = usedRAM + freeRAM;
        usedRAMPercentage = ((usedRAM * 100)/totalRAM);
        return usedRAMPercentage;
    I'm using previous script in Instance Discovery(doesn't work)

    I dont know if the script is wrong, or If I'm doing something wrong on dci template.
    Please your help.


    script as dci.png

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

      Hi,

      you don't need instance discovery here. Script 2 is correct, you just have to place it into script library and use in script DCI. You can test it by selecting "Execute server script" on your switch node object, selecting library script or pasting script code, and executing.

      Best regards,
      Victor

      1 Reply Last reply
      0
      • L
        L
        Luis Montaño
        wrote on last edited by
        #3

        Thanks For the Help.
        It works.  😄

        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