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 (Russian)
  3. New DCI source: NXSL script executed on server

New DCI source: NXSL script executed on server

Scheduled Pinned Locked Moved Support (Russian)
1 Posts 1 Posters 10.9k 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.
  • ArtKZA
    ArtKZA
    ArtKZ
    wrote on last edited by
    #1

    В библиотеке скриптов имеется скрипт, который вызывается из transformation script и которому передаются в качестве аргументов custom attributes объекта. Захотел использовать новую возможность, указал этот скрипт как параметр метрики в виде DCI::NumOfLearnedMAC($node->node,$node->vlan,$node->port). Скрипт завершается со значением -1, говорящим о том, что ему не передаются аргументы.... может их как-то по другому надо указывать?

    Ниже сам скрипт

    // Count MAC adresses, learned on port of vlan on node
    // Arguments: node, vlan, port
    // Return number of learned MAC address
    
    sub main() {
    return NumOfLearnedMAC($1,$2,$3);
    }
    
    sub NumOfLearnedMAC() {
    node = FindObject($1);
    vlan = $2;
    port = $3;
    
    if (node == null)
    {
        println "ERROR: Node not found";
        return -1;
    }
    
    transport = CreateSNMPTransport(node);    // Create SNMP transport for node
    if (transport == null)
    {
        println "Failed to create SNMP transport, exit";
        return -1;
    }
    
    vars = SNMPWalk(transport, ".1.3.6.1.2.1.17.7.1.2.2.1.2.".vlan);
    if (vars == null)
    {
        println "Failed to issue SNMP WALK request";
        return -2;
    }
    
    ret = 0;
    foreach (v: vars) {
      if (v->value == port)
      {
        ++ret;
      }
    }
    
    return ret;
    }
    

    ... и transformation script

    use DCI::NumOfLearnedMAC;
    
    sub main() {
    return NumOfLearnedMAC($node->node,$node->vlan,$node->port);
    }
    
    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