About This Document

This is the official documentation for NXSL (NetXMS Scripting Language), the embedded scripting language for the NetXMS network monitoring system.

The documentation is organized into the following main sections:

  • Language Guide - Introduction, script security, getting started, working with NetXMS, and language syntax

  • Function Reference - Complete reference of all NXSL functions organized by category

  • Class Reference - Complete reference of all NXSL classes organized by domain

  • Alphabetical Index - Quick-reference of all functions and classes in alphabetical order

  • Appendices - Global constants, formal grammar, examples, and deprecated functions

You can also download a PDF version of this document.

This documentation is maintained at https://github.com/netxms/nxsl-doc/

If you find any errors or issues in this documentation, please report them on GitHub: https://github.com/netxms/nxsl-doc/issues

Introduction

In many parts of the system, fine tuning can be done by using NetXMS built-in scripting language called NXSL (stands for NetXMS Scripting Language). NXSL was designed specifically to be used as embedded scripting language within NetXMS, and because of this has some specific features and limitations. Most notable is very limited access to data outside script boundaries – for example, from NXSL script you cannot access files on server without explicit permission, nor call external programs, nor even access data of the node object other than script is running for without explicit permission. NXSL is interpreted language – scripts first compiled into internal representation (similar to byte code in Java), which than executed inside NXSL VM.

Script Security

Because NXSL provides functions for searching objects, and because all scripts are executed on management server, user with write access to only one node can potentially acquire information about nodes to which he normally does not have access. For example, without additional security checks user with write access to node A and no access to node B can create transformation script for DCI on node A and use FindNodeObject function to access node B and get information about it, thus breaking security settings.

To prevent such scenario, all NXSL functions capable of accessing NetXMS objects requires "current node" object to be provided. Reference to object being searched will only be returned if node object supplied as "current node" is in trusted nodes list of target object. For example, if variable $node in script refers to NODE1, and FindNodeObject($node, "NODE2") called, NODE1 must be added to list of trusted nodes for NODE2. In most places (transformation script, event processing policy, etc.) predefined variable $node exists, which refers to node object on behalf of which script is being executed. It will be event source for event processing policy script, DCI owner for transformation script, and so on.

For environments where strict security checks are required, they can be enabled via server configuration. Enforcement of trusted nodes checking is controlled by server’s configuration variable Objects.Security.CheckTrustedObjects. By default it is set to 0 and check of trusted nodes is not enforced. To enable it, server’s configuration variable Objects.Security.CheckTrustedObjects must be set to 1. The server restart is required to make this change effective.

Getting Started

This section will help you write and run your first NXSL script. By the end, you’ll understand the basic structure of NXSL programs and how to execute them in NetXMS.

Hello World

Every programming journey starts with a simple program. Here’s the classic "Hello World" in NXSL:

println("Hello, World!");

That’s it! This single line prints text to the output. Let’s break it down:

  • println is a built-in function that prints text followed by a newline

  • The text inside quotes "Hello, World!" is a string

  • The semicolon ; ends the statement

Running Scripts in NetXMS

NXSL scripts run in several contexts within NetXMS:

Execute Script (for testing or to perform one-off operation)

Right-click on any node or object and select Execute script. This runs the script in the context of the selected object, with $object (and $node if the object is a Node) automatically set.

Script Library

Access via Configuration → Script Library. Used to store reusable scripts that can be imported in other places via import script_name.

Transformation Scripts (for DCIs)

Modify collected data before storing. Set in DCI properties under Transformation.

Event Processing Policy

React to events with custom logic in EPP rules. Includes filtering scripts to decide whether to process or skip events.

Object Tools

Create custom actions available from object context menus.

nxscript (command line)

Command-line tool bundled with NetXMS server for running NXSL scripts. Useful for testing and debugging.

nxscript [options] script [arg1 [... argN]]

Common options:

-c

Compile only (syntax check)

-d

Dump compiled script code

-e <name>

Entry point (function to call)

-r

Print script return value

-t

Enable instruction trace

-m

Show memory usage information

Script Structure

NXSL scripts can be as simple as a single expression or more structured with functions:

// Simple script - just statements
x = 5;
y = 10;
println("Sum: " .. (x + y));

For more complex scripts, you have two approaches:

Implicit main (code outside functions):

Code outside functions is automatically wrapped into an implicit $main() function:

println("Script started");
result = calculate(5, 10);
println("Result: " .. result);
return 0;

function calculate(a, b)
{
    return a * b;
}

Explicit main function:

You can define an explicit main() function with named parameters for scripts that accept arguments:

function main(nodeName, threshold)
{
    println("Checking node:", nodeName);
    println("Threshold:", threshold);

    if (threshold == null)
        threshold = 90;  // Default value

    // ... script logic ...
    return 0;
}

With explicit main(), script parameters passed via command line or from NetXMS are mapped to function arguments in order.

If you define an explicit main() function, any code outside functions is ignored. Move all logic inside main() when using this approach.

Function definitions can be placed anywhere in the script - code outside functions executes sequentially:

println("111");
function myfunc() { println("333"); }
println("222");
myfunc();

Output:

111
222
333

Return Values

Scripts return values to their caller (NetXMS, transformation pipeline, etc.). How a script returns a value depends on whether it ends with an expression or a statement.

Expression scripts (no semicolon):

A script can be a single expression without a semicolon. The expression’s value is implicitly returned:

$1 > 100

Returns true or false. Useful for filter scripts in Event Processing Policy.

$node.status == Status::NORMAL and $node.isAgent

Returns boolean result of the compound condition.

Statement scripts (with semicolon):

When using semicolons, you must use explicit return or result will be discarded.

Result of this one will be null:

$1 > 100;

This one will return bool value as expected:

return $1 > 100;

Practical example:

Filter script for EPP (expression style - preferred for simple conditions):

$event.severity >= Severity::MAJOR

Transformation script (statement style - when logic is needed):

if ($1 == null)
    return null;
return $1 / 1024;  // Convert bytes to KB

Comments

Document your code with comments:

// Single-line comment

/*
   Multi-line comment
   spanning several lines
*/

x = 5; // Inline comment

Basic Input and Output

Output:

  • println(value, …​) - Print one or more values (separated by spaces) followed by a newline

  • print(value, …​) - Print one or more values (separated by spaces) without newline

  • trace(level, message) - Debug output (level 1-9), written to server debug console and log file when current debug level is equal to or above the specified level

println("Sum:", x, "+", y, "=", x + y);  // Prints: Sum: 5 + 10 = 15
trace(3, "Processing node " .. $node.name);  // Shows when debug level >= 3

Script Parameters:

Scripts receive parameters through special variables $1, $2, etc. All arguments are also available as an array in the global variable $ARGS:

// If script called with parameters "hello" and "world"
println($1);  // Prints: hello
println($2);  // Prints: world

// Using $ARGS array (1-indexed)
println($ARGS[1]);  // Prints: hello
println($ARGS[2]);  // Prints: world

// Iterate over all arguments
for (i = 1; i <= $ARGS.size; i++)
    println("Arg", i, "=", $ARGS[i]);

Your First Practical Script

Let’s write a script that does something useful - converting a UNIX timestamp to human-readable format:

// Transform UNIX timestamp to readable date
// Use as transformation script for timestamp DCIs

if ($1 == null)
    return null;

return strftime("%Y-%m-%d %H:%M:%S", $1);

This script:

  1. Checks if input ($1) is null

  2. Uses strftime to format the timestamp

  3. Returns the formatted string

Error Handling Basics

Always consider what happens when things go wrong:

value = GetDCIValue($node, 123);
if (value == null)
{
    trace(1, "Failed to get DCI value");
    return null;
}
println("Value: " .. value);

Key practices:

  • Check for null after operations that might fail

  • Use trace() for debugging information

  • Return appropriate values for error conditions

Safe navigation operator:

For simpler null handling when accessing object members, use the safe navigation operator ?.:

node = FindObject("my-server");
println(node?.name);  // Prints nothing if node is null (no error)

// Chain method calls safely
result = $node.createSNMPTransport()?.getValue("1.3.6.1.2.1.1.1.0");

This avoids nested null checks while preventing runtime errors on null objects.

Next Steps

Now that you can write and run basic scripts, explore:

Working with NetXMS

NetXMS organizes monitored infrastructure as a hierarchy of objects. In NXSL, you interact with these objects through predefined variables and lookup functions.

Context Variables

Scripts run in a context that provides predefined variables:

Variable Description

$node

Current node object (Node)

$object

Current object of any type (NetObj)

$event

Current event being processed (Event)

$alarm

Current alarm (Alarm)

$dci

Current DCI object (DCI)

Example - accessing node properties:

println("Node: " .. $node.name);
println("IP: " .. $node.ipAddress);
println("Status: " .. $node.status);

Finding Objects by Name or ID

Use FindObject() to locate any object:

// Find by name
router = FindObject("Core-Router-01");
if (router != null)
{
    println("Found: " .. router.name);
    println("Type: " .. classof(router));
}

// Find by ID
node = FindObject(12345);

Getting All Nodes

Use GetAllNodes() to iterate over all nodes:

for (n : GetAllNodes())
{
    println(n.name .. " - " .. n.ipAddress);
}

Navigating Object Relationships

Objects have parent-child relationships:

// Get node's parents (containers, subnets, etc.)
for (parent : $node.parents)
{
    println("Parent: " .. parent.name .. " (type " .. parent.type .. ")");
}

// Get container's children
container = FindObject("Production Servers");
for (child : container.children)
{
    println("Child: " .. child.name);
}

Working with Interfaces

Access a node’s network interfaces:

// Iterate all interfaces
for (iface : $node.interfaces)
{
    println(iface.name .. " - " .. iface.macAddr);

    // Check interface status
    if (iface.operState == 1)  // Up
        println("  Status: UP");
}

// Get specific interface by index
iface = $node.getInterface(1);
if (iface != null)
    println("Interface 1: " .. iface.name);

Reading DCI Values

Data Collection Items (DCIs) are the core of NetXMS monitoring. NXSL lets you read and manipulate DCI values.

Get current or historical DCI values:

// Get current value by DCI ID
value = GetDCIValue($node, 123);
if (value != null)
    println("Current value: " .. value);

// Find DCI by description, then get value
dciId = FindDCIByDescription($node, "CPU Usage");
if (dciId > 0)
{
    value = GetDCIValue($node, dciId);
    println("CPU: " .. value .. "%");
}

Transformation Scripts

Transform collected data before storage. The input value is $1:

// Convert bytes to megabytes
return $1 / 1048576;
// Extract numeric value from string like "Temperature: 45C"
match = $1 =~ "(\d+)";
if (match)
    return match[1];
return null;

Filter Scripts

Decide whether to accept a value (return true) or reject it (false):

// Only accept values within range
if ($1 >= 0 && $1 <= 100)
    return true;
return false;

Working with Table DCIs

Table DCIs contain multiple rows and columns:

table = GetDCIValueByDescription($node, "Process List");
if (table != null)
{
    println("Columns: " .. table.columnCount);
    println("Rows: " .. table.rowCount);

    // Print first column name
    println("Column 0: " .. table.getColumnName(0));

    // Get cell value (row 0, column 0)
    println("Value: " .. table.get(0, 0));
}

Event Context

In event processing scripts, $event provides event details:

println("Event: " .. $event.name);
println("Source: " .. $event.sourceNode);
println("Message: " .. $event.message);
println("Severity: " .. $event.severity);

// Access event parameters
println("Parameter 1: " .. $event.parameters[1]);

Modifying Events

Add custom data to events:

// Add custom parameter
SetEventParameter($event, "location", $node.getCustomAttribute("location"));

// The parameter is now available as %<location> in notifications

Working with Alarms

Access current alarms:

// In alarm context
println("Alarm: " .. $alarm.message);
println("State: " .. $alarm.state);
println("Ack: " .. $alarm.isAcknowledged);

// Get alarm comments
for (comment : $alarm.comments)
{
    println("Comment: " .. comment.text);
}

Check Node Capabilities

// Check if node supports SNMP
if ($node.capabilities & NC_IS_SNMP)
    println("SNMP enabled");

// Check if node has NetXMS agent
if ($node.capabilities & NC_IS_NATIVE_AGENT)
    println("Agent installed");

Custom Attributes

Read and write custom attributes on objects:

// Read custom attribute
location = $node.getCustomAttribute("location");
if (location != null)
    println("Location: " .. location);

// Set custom attribute
$node.setCustomAttribute("last_check", strftime("%Y-%m-%d %H:%M:%S", time()));

// List all custom attributes
attrs = $node.customAttributes;
for (key : attrs.keys)
{
    println(key .. " = " .. attrs[key]);
}

SNMP Operations

Perform SNMP queries on nodes:

// Create SNMP transport
transport = $node.createSNMPTransport();
if (transport == null)
{
    trace(1, "Failed to create SNMP transport");
    return null;
}

// Get single value
sysDescr = transport.getValue("1.3.6.1.2.1.1.1.0");
println("System: " .. sysDescr);

// Walk a subtree
results = transport.walk("1.3.6.1.2.1.2.2.1.2");  // ifDescr
for (r : results)
{
    println(r.name .. " = " .. r.value);
}

Recursive Object Traversal

Walk the object tree:

function walkTree(obj, level)
{
    for (i = 0; i < level; i++)
        print("  ");
    println(obj.name .. " [" .. classof(obj) .. "]");

    for (child : obj.children)
    {
        walkTree(child, level + 1);
    }
}

// Start from root
root = FindObject("Entire Network");
walkTree(root, 0);

Best Practices

Performance:

  • Use FindDCIByDescription once and cache the ID

  • Avoid GetAllNodes() in transformation scripts (runs frequently)

  • Use trace() sparingly in production

Error Handling:

  • Always check for null after FindObject, GetDCIValue, etc.

  • Use the safe navigation operator ?. for concise null handling: node?.name

  • Use meaningful trace levels (1=errors, 5=debug, 9=verbose)

Security:

  • Remember trusted node validation (see Script Security)

  • Pass $node as context when required

Maintainability:

  • Use descriptive variable names

  • Add comments for complex logic

  • Keep transformation scripts simple

Language Syntax

Built-in Types

The following sections describe the standard types that are built into the interpreter.

NXSL is loosely typed programming language. The system will automatically determine each variable type, assign a certain type to a variable and convert a variable type from one to another, if necessary. For example, a result for 3 + "4" will be 7, because the system will automatically convert "4" string into an integer. In case if the system is not able to automatically convert a line into an appropriate integer, the operation will result in a runtime error.

NXSL supports the following variable types:

  • integer (32 bit),

  • unsigned integer (32 bit),

  • integer (64 bit), unsigned integer (64 bit),

  • floating-point number,

  • string,

  • boolean,

  • array,

  • hash map,

  • object.

In addition to that, NXSL also supports a special variable type – NULL. This value represents a variable with no value. NULL is the only possible value of type NULL. An attempt to perform any type of arithmetical or string operations with NULL variable will result in system runtime error.

It is possible to manually convert variable to a certain type, using a special function, named depending on the variable type. For example, string(4). That way it is also possible to convert NULL type variables. Therefore, to avoid runtime errors while processing NULL type variables, it is advised to use manual conversion.

NXSL does not require setting variable type beforehand. The only exception to this is arrays. In case if an array is required, operator array defines its subsequent variables as arrays. Accessing variable which was not previously assigned will return NULL value.

Although NXSL has object type variables, it is not an object-oriented language. It is not possible to define classes or create objects at script level – only in extensions written in C++. Object type variables are used to return information about complex NetXMS objects, like nodes or events, in a convenient way. Please note that assigning object type variables actually holds reference to an object, so assigning object value to another variable does not duplicate actual object, but just copy reference to it.

To get a human-readable representation of a variable or expression type for debugging, use the typeof() function, and to get a class name for object type variables, use classof() function.

String literals

A string literal is where you specify the contents of a string in a program. There are few different string literal types:

  • "string" - string literal where some characters preceded by a backslash have special meaning. If you need to insert double quote character you should prepend it with backslash.

  • 'string' - string literal with backslash being an ordinary character without special meaning. You cannot insert single quote character into such string literal.

  • """ Multi

    line

    string""" - string literal that can span multiple lines with backslash being an ordinary character.

The following character combinations are supported in "string" literals:

  • \b - produces Backspace character

  • \t - produces Horizontal tab character

  • \n - produces Newline character

  • \r - produces Carriage return character

  • \xhh - produces a character with code hh (where hh is two-digit hex number)

  • \uhhhh - produces a character with code hhhh (where hhhh is four-digit hex number). E.g. \u2026 produces Greek small letter Mu (μ)

  • \\ - produces Backslash character (\)

Truth Value Testing

Any variable can be tested for truth value, for use in an if or while condition or as operand of the Boolean operations below. The following values are considered false:

  • false

  • NULL

  • zero of any numeric type, for example, 0, 0.0, 0j.

All other values are considered true — so objects of various types and arrays are always true.

Operations and built-in functions that have a Boolean result return boolean type. However, there’s an exception to this due to optimizations related to short-circuit evaluation of or and and operators. For or, if first operand not boolean type, but it’s value is considered true, that operand will be returned as result. For and, if first operand is considered false, that operand will be returned as result. This will not cause issues in subsequent logical operations, as returned value will be correctly considered as true or false; But when printing the result, it will not be converted to Boolean, so conversion using boolean() function might be needed.

For example:

a = [1,2,3];
b = true;
c = a or b;
println(c);  // will print "[1, 2, 3]" because first operand was returned by or operation
if (c) println("TRUE");  // will print "TRUE" as the array contained in c is considered as true
a = 0;
b = true;
c = a and b;
println(c); // will print "0" because first operand was returned by and operation
println(boolean(c));  // will print "false"

Variables

Variables in NXSL behave the same way as variables in most popular programming languages (C, C++, etc.) do, but in NXSL you don’t have to declare variables before you use them.

Scope of a variable can be either global (visible in any function in the script) or local (visible only in the function within which it was defined). Any variable is by default limited to the local function scope.

Global variables

By default, variables are local to the function where they are first assigned. This means variables defined in the main script are not visible to other functions:

x = 1;
myFunction();

function myFunction()
{
    println("x * 2 = " .. x * 2);
}

This script will cause run time error Error 5 in line 6: Invalid operation with NULL value, because variable x is local to the implicit main function and is not visible in myFunction.

To make a variable accessible across all functions, declare it with the global keyword:

global x = 1;
myFunction();

function myFunction()
{
    println("x * 2 = " .. x * 2);
}

This script produces the expected result and prints x * 2 = 2.

Local variables

By default, variables are local to the function where they are first assigned. Starting with version 6.0, you can explicitly declare a variable as local using the local keyword. This is useful for clarity and to ensure a variable is local even if a global variable with the same name exists:

global x = 100;

function myFunction()
{
    local x = 5;  // Creates a new local variable, does not affect global x
    println("local x = " .. x);  // Prints: local x = 5
}

myFunction();
println("global x = " .. x);  // Prints: global x = 100

The local keyword can also be used without initialization:

function process()
{
    local result;  // Explicitly declare local variable
    if (condition)
        result = "yes";
    else
        result = "no";
    return result;
}

Function Declaration

A function is a named code block that is generally intended to process specified input values into an output value, although this is not always the case. For example, the trace() function takes variables and static text and prints the values into server log. Like many languages, NXSL provides for user-defined functions. These may be located anywhere in the main program or loaded in from other scripts via the import keywords.

To define a function, you can use the following form:

function NAME ( ARGUMENTS ) BLOCK

where NAME is any valid identifier, ARGUMENTS is optional list of argument names, and BLOCK is code block.

To call a function you would use the following form:

NAME ( LIST )

where NAME is identifier used in function definition, and LIST is an optional list of expressions passed as function arguments.

To give a quick example of a simple subroutine:

function message()
{
    println("Hello!");
}

Function Arguments

NXSL provides four ways to access function arguments. In most cases, you should use standard named parameters (method 1).

Declare parameter names in the function signature. This is the clearest and most commonly used approach:

function add(numberA, numberB)
{
    result = numberA + numberB;
    println("The result was: " .. result);
}

add(5, 3);  // Prints: The result was: 8

If a parameter is not provided at function call, its value will be NULL:

function greet(name, title)
{
    if (title == null)
        title = "User";
    println("Hello, " .. title .. " " .. name);
}

greet("Alice");           // Prints: Hello, User Alice
greet("Bob", "Dr.");      // Prints: Hello, Dr. Bob
2. Call-site named parameters

Parameters can be named at the call site using param: value syntax. The function declaration has empty parentheses, and parameters are accessed with the $ prefix:

function process()
{
    println("Name: " .. $name);
    println("Age: " .. $age);
}

process(age: 30, name: "Alice");
// Prints:
// Name: Alice
// Age: 30

This approach allows calling with parameters in any order but is less commonly used.

3. Positional parameter variables

Arguments are automatically available as $1, $2, $3, etc., regardless of how the function is declared:

function add()
{
    result = $1 + $2;
    println("The result was: " .. result);
}

add(5, 3);  // Prints: The result was: 8

This is useful for quick scripts but makes code harder to read. Standard named parameters (method 1) are preferred.

4. The $ARGS array

All arguments passed to a script are available in the global $ARGS array. The first argument is $ARGS[1]:

function main()
{
    println("Script received " .. $ARGS.size .. " arguments");
    for (i = 1; i <= $ARGS.size; i++)
        println("Argument " .. i .. ": " .. $ARGS[i]);
}

This is primarily used when the number of arguments is variable or unknown.

Mixing argument styles

You can combine positional and named arguments in the same function call. Named arguments count toward positional parameter indices:

function myFunc(arg1)
{
    println("arg1: " .. arg1);
    println("$2: " .. $2);
    println("$arg3: " .. $arg3);
}

myFunc("first", arg3: "third", "second");
// Prints:
// arg1: first
// $2: third       (named parameter arg3 occupies position 2)
// $arg3: third

myFunc("first", "second", arg3: "third");
// Prints:
// arg1: first
// $2: second      (positional parameter in position 2)
// $arg3: third

While this flexibility exists, mixing argument styles can make code harder to understand. For clarity, stick to standard named parameters (method 1) in most cases.

Return Values from a Function

You can return a value from a function using the return keyword:

function pct(value, total)
{
    return value / total * 100.0;
}

When called, return immediately terminates the current function and returns the value to the caller. If you don’t specify a value in return statement or function ends implicitly by reaching end of function’s block, then the return value is NULL.

Script entry point

NXSL handles script entry in two ways:

  • Explicit main() function

  • Implicit $main() function

Explicit main() function:

If an explicitly defined main() function exists, it will be called. This approach is recommended for scripts that accept parameters, as it allows you to declare named parameters:

function main(nodeName, threshold)
{
    println("Processing:", nodeName);
    if (threshold == null)
        threshold = 90;
    // Script logic here
    return 0;
}

Script arguments are passed to main() parameters in order. Arguments are also available via $1, $2, etc. and the $ARGS array within the function.

Implicit $main() function:

If an explicit main() doesn’t exist, the interpreter creates an implicit $main() function from all code that is not part of any other function:

// This code becomes the implicit $main()
println("Script started");
result = calculate($1);
return result;

function calculate(value)
{
    return value * 2;
}
If both an explicit main() function and top-level code exist, the top-level code is silently discarded. Only the explicit main() function will execute:
println("This will NOT execute");  // Discarded when main() exists

function main()
{
    println("Only this executes");
}

Calling library script functions

You can call functions from scripts that are stored in Script Library. One way is to use the import keyword accompanied by the name of the script:

import my_math_library;
println( add(1, 2) );

The other way is shown in this example:

println( my_math_library::add(1, 2) );

Optional function calls

Added in version 6.0

To prevent script errors when calling a function that may not exist, use the optional keyword. If the function is present, it is called, and the expression evaluates to its return value. If the function does not exist, the call is safely ignored, and the expression evaluates to NULL without halting the script.

// If f() exists, v gets its return value.
// If f() does not exist, v becomes NULL.
v = optional f();

The same logic applies when calling a function from a specific library.

// If my_library and function f() in it exists, v gets its return value.
// Otherwise, v becomes NULL.
v = optional my_library::f();

Strings

Strings are not objects, it’s a separate variable type. However, strings have methods and attributes described below

String attributes

isEmpty: bool

Returns "true" if string is empty or "false" otherwise.

s = "";
println(s.isEmpty); // prints "true"
length: int

Returns number of characters in the string.

s = "1234567890";
println(s.length); // prints '10'

String methods

compareTo(string): int

Compares two strings lexicographically (alphabetical order). Returns -1 if the argument is a string lexicographically greater than this string, 1 if the argument is a string lexicographically less than this string or 0 if the argument is a string lexicographically equal to this string.

The is a difference to == comparison operator if strings contain numbers because values are converted to numberic type prior to comparison.

println("a".compareTo("c")); // prints "-1"
println("c".compareTo("a")); // prints "1"
println("a".compareTo("aaa")); // prints "-1"
println("aaa".compareTo("a")); // prints "1"

println("100".compareTo("100.0")); // prints "-1"
println("100" == "100.0"); // prints true
compareToIgnoreCase(string): int

Same as compareTo, but ignoring the case.

println("aaa".compareToIgnoreCase("AAA")); // prints "0"
contains(string): bool

Returns true if this string contains the argument string or false otherwise.

println("aaa".contains("a")); // prints "true"
endsWith(string): bool

Returns true if this string ends with the argument string or false otherwise.

println("abc".endsWith("d")); // prints "false"
println("Just a sentence".endsWith("a sentence")); // prints "true"
equalsIgnoreCase(string): bool

Returns true if argument string is equal to this string ignoring the case or false otherwise.

println("abc".equalsIgnoreCase("ABC")); // prints "true"
indexOf(string): int

Returns index of first occurence of argument string in this string or -1 if the argument is not a substring of the string.

println("ABC-DEF-GHI".indexOf("-")); // prints "3"
println("ABC-DEF-GHI".indexOf("ABC")); // prints "0"
println("ABC-DEF-GHI".indexOf("JKL")); // prints "-1"
lastIndexOf(string): int

Returns index of last occurence of argument string in this string or -1 if the argument is not a substring of the string.

println("ABC-DEF-GHI".lastIndexOf("-")); // prints "7"
println("ABC-DEF-GHI".lastIndexOf("ABC")); // prints "0"
println("ABC-DEF-GHI".lastIndexOf("JKL")); // prints "-1"
left(numberOfCharacters, paddingCharacter): String

Returns left numberOfCharacters of this string. If string length is less then numberOfCharacters, result will be padded on the right. paddingCharacter is optional, if not specified, space character will be used for padding.

println("ABCDEFGHI".left(2)); // prints "AB"
println("123".left(5)); // prints "123  "
println("123".left(5, "_")); // prints "123__"
replace(whatToReplace, replaceBy): String

Returns string where all occurencies of whatToReplace are replaced with replaceBy.

println("A B C A D K L".replace("A", "<A>")); // prints "<A> B C <A> D K L"
right(numberOfCharacters, paddingCharacter): String

Returns right numberOfCharacters of this string. If string length is less then numberOfCharacters, result will be padded on the left. paddingCharacter is optional, if not specified, space character will be used for padding.

println("ABCDEFGHI".right(2)); // prints "HI"
println("123".right(5)); // prints "  123"
println("123".right(5, "_")); // prints "__123"
split(separator, trimWhitespace): Array

Split string into array of strings at given separator.

Added in version 5.1.4: trimWhitespace parameter

trimWhitespace parameter is optional and is false by default. If set to true, space characters will be removed on both sides of strings produced by splitting.

println("ABC--DEF--GHI".split("--")); // prints "[ABC, DEF, GHI]"

s = "Alice, Bob,  Carol";
for (a : s.split(",")) println("|"..a.."|");
// Will print:
// |Alice |
// | Bob|
// |  Carol|

s = "Alice , Bob,  Carol";
for (a : s.split(",", true)) println("|"..a.."|");
// Will print:
// |Alice|
// |Bob|
// |Carol|
startsWith(string): bool

Returns true if this string starts with the argument string or false otherwise.

println("abc".startsWith("d")); // prints "false"
println("Just a sentence".startsWith("Just a")); // prints "true"
substring(position, numberOfCharacters): String

Returns substring of this string starting from position and containing numberOfCharacters.

println("ABCDEFGHIJK".substring(0,3)); // prints "ABC"
println("ABCDEFGHIJK".substring(6,3)); // prints "GHI"
println("ABCDEFGHIJK".substring(6,10)); // prints "GHIJK"
toLowerCase(): String

Converts this string to lowercase.

println("ABC def".toLowerCase()); // prints "abc def"
toUpperCase(): String

Converts this string to uppercase.

println("ABC def".toUpperCase()); // prints "ABC DEF"
trim(): String

Returns this string with whitespace from both sides removed.

println("|" .. "  ABC  ".trim() .. "|") // prints "|ABC|"
trimLeft(): String

Returns this string with whitespace from left side removed.

println("|" .. "  ABC  ".trimLeft() .. "|") // prints "|ABC   |"
trimRight(): String

Returns this string with whitespace from right side removed.

println("|" .. "  ABC  ".trimRight() .. "|") // prints "|   ABC|"

Arrays

An array in NXSL is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. Nested arrays are supported, so elements of an array can be themselves arrays.

A key is 32-bit signed integer. When an array is created, its size is not specified and its map can have empty spots in it. For example, an array can have a element with a 0 key and an element with 4 key and no keys in-between. Attempting to access an array key which has not been defined is the same as accessing any other undefined variable: the result will be NULL.

Arrays are not objects, it’s a separate variable type. However, arrays have methods and attributes described below.

Array elements can be accessed using [index] operator. For example, to access element with index 3 of array a you should use

a[3];

To get subarray from the array use [a:b] operator. This operator returns subarray of an array from the element with index a inclusive till the element with index b exclusive. If a is omitted then subarray will be taken from the start of the array and if b is omitted then subarray will be taken till the end of the array.

Example:

a = [1, 2, 3, 4];
a2 = a[1:3]; // a2 will be [2, 3]
a3 = a[1:]; // a3 will be [2, 3, 4]

Array Initialization

Arrays can be created using the [] construct. This is the recommended method for array initialization.

An empty array can be created by assigning [] to a variable:

a = [];

Arrays can also be initialized with values:

a = [1, 2, 3, 4];

println(a[0]); // will print 1, since 1 is the 0th element
println(a); // will print "[1, 2, 3, 4]"

You can then assign values to the array. Please note arrays in NXSL are sparse, so indices can contain gaps:

a = [];
a[1] = 1;
a[2] = 2;
a[260] = 260;
println(a[1]); // will print 1
println(a); // will print "[1, 2, 260]"

Array initialization can also be used directly in expressions, like this:

function f()
{
    return [2, "text", [1, 2, 3]];
}

In this example function f returns array of 3 elements - number, text, and another array of 3 numeric elements.

Deprecated in version 5.0. The array keyword for declaring arrays is deprecated. New scripts should use [] syntax instead.

// Deprecated - do not use in new code
array a;

// Recommended - use this instead
a = [];

Array attributes

maxIndex: int

Returns highest index in the array.

a = [1, 2, 3];
println(a.maxIndex); // prints '2'
println(a[a.maxIndex]); // prints '3'
minIndex: int

Returns lowest index in the array.

a = [1, 2, 3];
println(a.minIndex); // prints '0'
size: int

Returns number of elements in the array.

a = [1, 2, 3];
println(a.size); // prints '3'

Array methods

append(newElement): int

Appends new element to the array. Returns highest index in the array - that’s index of the appended element.

a = ["a","b","c"];
a.append("d");
println(a); // prints '[a, b, c, d]'
appendAll(anotherArray): int

Appends elements of anotherArray to the array. Returns highest index in the array.

a = [1,2];
b = [3,4];
a.appendAll(b);
println(a); // prints '[1, 2, 3, 4]'
indexOf(value): int

Returns the index of first occurrence of the specified value or -1 if value is not found in the array.

a = ["Normal", "Warning", "Minor", "Major", "Critical"];
println(a.indexOf("Major")); // Prints "3"
join(separator): String

Returns concatenated string of all array elements separated by the specified separator.

Parameters

separator

String

Separator between array elements

a = [1, 2, 3, 4];
println(a.join(";")); // will print "1;2;3;4"
println(a.join("; ")); // will print "1; 2; 3; 4"
insert(index, newElement): void

Inserts new element to the array at index. Indexes of existing elements that had index greater or equal to index are incremented.

array a;
a[0] = "aaa";
a[10] = "ccc";
a.insert(5, "bbb");
println(a[0]);  // prints "aaa"
println(a[5]);  // prints "bbb"
println(a[11]);  // prints "ccc" - because of the insert operation this element's index is now 11.
insertAll(index, anotherArray): void

Inserts elements of anotherArray to the array at index. Indexes of existing elements that have index greater or equal to index are incremented.

a = [1,2];
b = [3,4];
a.insertAll(1,b);
println(a); // prints '[1, 3, 4, 2]'
pop(): any

Removes and returns element with highest index from the array. Using push(value) and pop() methods it’s possible to use array as a stack. Or, using insert(0,value) and pop(), array will work as FIFO queue.

a = [];
a.push("one");
a.push("two");
println(a.pop());
println(a.pop());
push(newElement): int

Same as append().

remove(index): void

Removes element at specified index. Indexes of elements that have index greater or equal to index are decremented.

a = [1,2,3];
a.remove(0);
println(a);

Spread operator

The spread operator (…​) expands array elements in place. Use it when all elements from an array need to be included in a new array or applied one-by-one as function arguments.

function sum(i, j, k)
{
  return i + j + k;
}

data = [10, 20, 30];
println(sum(...data)); // expands to sum(10, 20, 30), prints 60

a = ["one", "two"];
b = ["new", ...a];
println(b); // prints "[new, one, two]"

Array conversion

String representation of array can be obtained by using string(array) function. The string representation consists of all array’s elements, enclosed in square brackets (“[]”). Adjacent elements are separated by the characters “, ” (a comma followed by a space).

Printed array is automatically converted to string.

a = [1, 2, 3, 4, 5, 6, 7];
println(a); // will print "[1, 2, 3, 4, 5, 6, 7]"
println(a .. " is an array"); // will print "[1, 2, 3, 4, 5, 6, 7] is an array"
println(["one", "two"]); // will print "[one, two]"
println([2, "text", [1, 2, 3]]); // will print "[2, text, [1, 2, 3]]"

Hash maps

Hash map allows to store data values in key:value pairs. A key is string. Numeric type can also be supplied as key, but it will be internally converted to string. Hash map cannot have two items with the same key. The values can be of any data type, including null, objects, arrays or hash maps.

Hash maps are not objects, it’s a separate variable type. However, hash maps have methods and attributes described below.

Array elements can be accessed using [key] operator. For example, to access element with key key of hash map h you should use

h["key"];

Hash Map Initialization

This statement will create an empty hash map and assign reference to in to variable h:

h = %{};

It’s also possible to create hash map already populated with values, e.g.:

h = %{"key":123, "another_key":456};

Hash Map Attributes

keys: Array

Returns array with keys of items in the hash map.

h = %{100:"value1", 101:"value2"};
println(h.keys); // prints '[100,101]'
size: int

Returns number of items in the hash map.

h = %{"a":null, "b":null, "c":null};
println(h.size); // prints '3'
values: Array

Returns array with values of items in the hash map.

h = %{"key1":123, "key2":456};
println(h.keys); // prints '[123,456]'

Hash Map Methods

contains(key): bool

Returns true, if hash map contains specified key or false otherwise.

h = %{"key1":123, "key2":456};
println(h.contains("key2")); // prints 'true'
remove(key): void

Removes item with specified key.

h = %{"key1":123, "key2":456};
h.remove("key1");
println(h); // prints '{key2=456}'

Hash Map Conversion

Hash Map can be converted to string. string(hash-map) function is used to get string representation of hash map. The string representation lists all key-value pairs enclosed in curly brackets (“{}”). Value is separate from the key with equals sigh ("="). Items are separated by the characters “, ” (a comma followed by a space).

Printed array is automatically converted to string.

h = %{"key1":123, "key2":456};
println("This is a hash map: " .. string(h));
println("Or we can just print it this way: " .. h);

Operators

An operator is something that you feed with one or more values, which yields another value.

Arithmetic Operators

Example Name Result

-a

Negation

Opposite of a

a + b

Addition

Sum of a and b

a - b

Subtraction

Difference between a and b

a * b

Multiplication

Product of a and b

a / b

Division

Quotient of a and b

a % b

Modulus

Remainder of a divided by b

The division operator (/) returns a float value unless the two operands are integers (or strings that get converted to integers) and the numbers are evenly divisible, in which case an integer value will be returned.

Calling modulus on float operands will yield runtime error.

Assignment Operator

The assignment operator is =, which means that the left operand gets set to the value of the expression on the rights (that is, "gets set to").

Bitwise Operators

Example Name Result

~ a

Not

Bits that are set in a are unset, and vice versa.

a & b

And

Bits that are set in both operand are set.

a | b

Or

Bits that are set in either operand are set.

a ^ b

Xor

Bits that are set in only one operand are set.

a << b

Shift left

Shift the bits of a for b steps to the left (each step equals "multiply by two").

a >> b

Shift right

Shift the bits of a for b steps to the right (each step equals "divide by two").

Comparison Operators

Comparison operators allow you to compare two values.

Example Name Result

a == b

Equal

TRUE if a is equal to b.

a != b

Not equal

TRUE if a is not equal to b.

a < b

Less than

TRUE if a is strictly less than b.

a > b

Greater than

TRUE if a is strictly greater than b.

a <= b

Less than or equal to

TRUE if a is less than or equal to b.

a >= b

Greater than or equal to

TRUE if a is greater than or equal to b.

a ~= b

Match

Array containing full match of b and capture groups, if any. If nothing was matched, false (boolean) is returned. Capture groups are also assigned to special variables $1, $2, $3, etc. See see Regular expressions for additional information.

a match b

Match

Same as a ~= b

a imatch b

Match (case insensitive)

Same as a ~= b or a match b, but matching is case insensitive.

a like b

Like

Compare string value to a pattern using wildcard characters. Two wildcard characters are supported: * - represents zero, one or multiple characters. ? - represents any single character. Wildcard characters can be used in combinations.

a ilike b

Like (case insensitive)

Same as a like b, but comparison is case insensitive.

Example:

println("aaa bbb ccc" ~= "b+") // prints "[bbb]"
println("Username: John" ~= "Username: (\w+)"); // prints "[Username: John, John]"

println("abc" like "?bc*"); // prints "true"

Note that strings which actually contain number are converted to numeric type prior to comparison. So, for example:

s1 = "1";
s2 = "1.0";
i = 1;
println(s1 == s2); // prints "true"
println(s1 == i); // prints "true"

Incrementing/Decrementing Operators

NXSL supports C-style pre- and post-increment and decrement operators.

Example Name Result

++a

Pre-increment

Increments a by one, then returns a.

a++

Post-increment

Returns a, then increments a by one.

--a

Pre-decrement

Decrements a by one, then returns a.

a--

Post-decrement

Returns a, then decrements a by one.

Logical Operators

Example Name Result

! a

Not

TRUE if a is not TRUE.

not a

Not

Same as above. TRUE if a is not TRUE.

a && b

And

TRUE if both a and b is TRUE.

a and b

And

Same as above. TRUE if both a and b is TRUE.

a || b

Or

TRUE if either a or b is TRUE.

a or b

Or

Same as above. TRUE if either a or b is TRUE.

String Operators

Example Name Result

..

Concatenation operator

Returns the concatenation of its right and left arguments.

..=

Concatenating assignment operator

Appends the argument on the right side to the argument on the left side.

[a:b]

Substring operator

Returns substring of a string from the character with index a inclusive till the character with index b exclusive. Example: "1234"[1:3] will be "23". If a is omitted then substring will be taken from the start of the string and if b is omitted then substring will be taken till the end of the string.

Member Access Operators

Example Name Result

a.b

Member access

Access attribute or method b of object a. Runtime error if a is null.

a?.b

Safe navigation

Access attribute or method b of object a. Returns null if a is null (no error).

The safe navigation operator ?. is useful for chaining method calls when intermediate results might be null:

node = FindObject("my-server");
println(node.name);   // Runtime error if node is null
println(node?.name);  // Safe: prints nothing if node is null

// Useful in conditions to avoid nested null checks
if ($node.createSNMPTransport()?.getValue("1.3.6.1.2.1.1.1.0") == 10)
{
    // Process result
}

// Without safe navigation, you would need:
t = $node.createSNMPTransport();
if (t != null)
{
    if (t.getValue("1.3.6.1.2.1.1.1.0") == 10)
    {
        // Process result
    }
}

Control structures

Any NXSL script is built out of a series of statements. A statement can be an assignment, a function call, a loop, a conditional statement or even a statement that does nothing (an empty statement). Statements usually end with a semicolon. In addition, statements can be grouped into a statement-group by encapsulating a group of statements with curly braces. A statement-group is a statement by itself as well. The various statement types are supported:

  • if

  • else

  • while

  • do-while

  • for

  • break

  • continue

  • switch

  • with

  • return

  • exit

if

The if construct is one of the most important features of many languages. It allows for conditional execution of code fragments. NXSL features an if structure that is similar to that of C:

if (expr)
    statement

else

Often you’d want to execute a statement if a certain condition is met, and a different statement if the condition is not met. This is what else is for. else extends an if statement to execute a statement in case the expression in the if statement evaluates to FALSE. The else statement is only executed if the if expression evaluated to FALSE.

while

while loops are the simplest type of loop in NXSL. They behave just like their C counterparts. The basic form of a while statement is:

while (expr)
    statement

The meaning of a while statement is simple. It tells NXSL to execute the nested statement(s) repeatedly, as long as the while expression evaluates to TRUE. The value of the expression is checked each time at the beginning of the loop, so even if this value changes during the execution of the nested statement(s), execution will not stop until the end of the iteration.

do-while

do-while loops are very similar to while loops, except the truth expression is checked at the end of each iteration instead of in the beginning. The main difference from regular while loops is that the first iteration of a do-while loop is guaranteed to run (the truth expression is only checked at the end of the iteration), whereas it may not necessarily run with a regular while loop (the truth expression is checked at the beginning of each iteration, if it evaluates to FALSE right from the beginning, the loop execution would end immediately).

for

for loops are the most complex loops in NXSL. They behave in two different ways: like their C counterparts or in Java way. The syntax of a for loop is:

for (expr1; expr2; expr3)
    statement

for (varName : array)
    statement

The first expression (expr1) is evaluated (executed) once unconditionally at the beginning of the loop.

In the beginning of each iteration, expr2 is evaluated. If it evaluates to TRUE, the loop continues and the nested statement(s) are executed. If it evaluates to FALSE, the execution of the loop ends.

At the end of each iteration, expr3 is evaluated (executed).

In the second example for cycle will call statement for each element in array. Element will be available as varName.

break

break ends execution of the current for, while, do-while or switch structure.

continue

continue is used within looping structures to skip the rest of the current loop iteration and continue execution at the condition evaluation and then the beginning of the next iteration.

switch

The switch statement is similar to a series of if statements on the same expression. In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. This is exactly what the switch statement is for.

Example:

switch (input)
{
  case "1":
    trace(0,"Input is 1");
    break;
  case "2":
    trace(0,"Input is 2");
    break;
  default:
    trace(0, "Input is unknown");
}

The switch statement also allows to check ranges:

switch (input)
{
  case 1:
    trace(0,"Input is 1");
    break;
  case 2:
    trace(0,"Input is 2");
    break;
  case 3...7:
    trace(0,"Input is from 3 till 7");
    break;
  default:
    trace(0, "Input is unknown");
}

with

With statement is made to make the code cleaner and much more readable and to expose variable section to global scope for "Object query" Dashboard element. This statement consists of 2 parts: variable declaration (optional) and expression.

Structure:

with
  var = {code},
  ...
  var = {code}
expression

Example for "Object query" Dashboard element. This example will filter out only nodes that are unreachable and will create 2 variables as data providers for columns: time node is down since and oldest alarm time.

with
  _down = { return SecondsToUptime(time() - downSince); },
 _oldestAlarm = {
  oldestAlarmTime = 99999999999;
  for (a : $node.alarms) {
   oldestAlarmTime = min(oldestAlarmTime, a.creationTime);
  }
  return strftime("%Y-%m-%d %H:%M", oldestAlarmTime);
 }
type == NODE and state & NodeState::Unreachable
//In Object query object attributes are available just using name.
//Like state ($node.state in other scripts)

return

If called from within a function, the return statement immediately ends execution of the current function, and returns its argument as the value of the function call. Calling return from main() function (either explicitly or implicitly defined) is equivalent of calling exit.

exit

The exit statement immediately ends execution of the entire script, and returns its argument as script execution result.

Expressions

The simplest yet most accurate way to define an expression is "anything that has a value".

The most basic forms of expressions are constants and variables. When you type a = 5, you’re assigning 5 into a. 5, obviously, has the value 5, or in other words 5 is an expression with the value of 5 (in this case, 5 is an integer constant).

Slightly more complex examples for expressions are functions. Functions are expressions with the value of their return value.

NXSL supports the following value types: integer values, floating point values (float), string values and arrays. Each of these value types can be assigned into variables or returned from functions.

Another good example of expression orientation is pre- and post-increment and decrement. You might be familiar with the notation of variable++ and variable--. These are increment and decrement operators. In NXSL, like in C, there are two types of increment - pre-increment and post-increment. Both pre-increment and post-increment essentially increment the variable, and the effect on the variable is identical. The difference is with the value of the increment expression. Pre-increment, which is written ++variable, evaluates to the incremented value. Post-increment, which is written variable++ evaluates to the original value of variable, before it was incremented.

A very common type of expressions are comparison expressions. These expressions evaluate to either FALSE or TRUE. NXSL supports > (bigger than), >= (bigger than or equal to), = (equal), != (not equal), < (less than) and <= (less than or equal to). These expressions are most commonly used inside conditional execution, such as if statements.

The last example of expressions is combined operator-assignment expressions. You already know that if you want to increment a by 1, you can simply write a++ or ++a. But what if you want to add more than one to it, for instance 3? In NXSL, adding 3 to the current value of a can be written a += 3. This means exactly "take the value of a, add 3 to it, and assign it back into a ". In addition to being shorter and clearer, this also results in faster execution. The value of a += 3, like the value of a regular assignment, is the assigned value. Notice that it is NOT 3, but the combined value of a plus 3 (this is the value that’s assigned into a). Any two-place operator can be used in this operator-assignment mode.

Short-circuit evaluation

Short-circuit evaluation denotes the semantics of some Boolean operators in which the second argument is only executed or evaluated if the first argument does not suffice to determine the value of the expression: when the first argument of the AND function evaluates to false, the overall value must be false; and when the first argument of the OR function evaluates to true, the overall value must be true. NXSL uses short-circuit evaluation for && and || boolean operators. This feature permits two useful programming constructs. Firstly, if the first sub-expression checks whether an expensive computation is needed and the check evaluates to false, one can eliminate expensive computation in the second argument. Secondly, it permits a construct where the first expression guarantees a condition without which the second expression may cause a run-time error. Both are illustrated in the following example:

if ((x != null) && ((trim(x) == "abc") || (long_running_test(x)))
   do_something();

Without short-circuit evaluation, trim(x) would cause run-time error if x is NULL. Also, long running function will only be called if condition (trim(x) == "abc") will be false.

Try…​Catch

If run-time error happens during NXSL code execution, the execution will normally stop and error message will be generated.

The try statement allows to define a block of code to be tested for errors while it is being executed. Should run-time error occur within that block, execution of code after the block will continue.

The catch statement allows to define a block of code to be executed, if an error occurs in the try block.

The try and catch keywords come in pairs:

try
{
  // Block to code to try
}
catch
{
  // Block of code to handle errors
}

The following variables with information about the error are available within the catch block:

$errorcode

Error code

$errorline

Line number

$errormodule

If error happened in a function of script imported using import keyword - name of that script. Empty otherwise.

$errormsg

Full error message including error code, line number, error text and, if available, module name.

$errortext

Error text

Regular expressions

Since version 3.0, regular expression engine is changed to PCRE (Perl compatible). Syntax can be checked with pcregrep, perl itself or on regex101.com (select PCRE flavour).

Comments

NXSL supports two kinds of comments: single-line comments and block (multi-line) comments.

  • Single-line comments start with // and continue to the end of the current line.

  • Block comments start with /* and end with */. Block comments may span multiple lines.

  • Block comments in NXSL can be nested; an inner /* …​ */ pair is treated as part of the enclosing comment.

Comments are treated as whitespace by the parser and may appear wherever whitespace is allowed (between tokens, at line start, at end of line, inside code blocks, etc.). Comment markers that appear inside string literals are not recognized as comment delimiters.

Examples:

// Single-line comment
x = 1; // comment after code

/* Multi-line comment
   spanning several lines */
y = 2;

/* Nested block comments are allowed:
   outer open
   /* inner comment */
   outer continues
*/
z = 3;

Metadata

NXSL scripts may start with one or more metadata declarations. Metadata declarations must appear only at the very beginning of the script (before any other code or non-whitespace characters). Each declaration is a single line with the following syntax:

@meta(key1=value1, key2=value2, ...)

Multiple @meta declarations are allowed; they are processed independently.

Metadata keys and their meanings are domain-specific.

Function Reference

Objects

Functions for finding and navigating NetXMS objects.

CalculateDowntime

CalculateDowntime(object, schedule, startTime, endTime): Array

Calculates downtime periods for a given network object based on a maintenance schedule within the specified time range.

Parameters

object

NetObj or Integer

Network object or object ID

schedule

String

Maintenance schedule name

startTime

Integer

Start of the period (as UNIX timestamp)

endTime

Integer

End of the period (as UNIX timestamp)

Return

Array of DowntimeInfo objects describing downtime windows, or NULL on failure.

// Calculate downtime for the last 24 hours
downtimes = CalculateDowntime($node, "business-hours", time() - 86400, time());
if (downtimes != null) {
    foreach (d : downtimes) {
        println("Downtime from " .. d->startTime .. " to " .. d->endTime);
    }
}

FindAccessPointByMACAddress

FindAccessPointByMACAddress(macaddress, currentNode): AccessPoint

Look up AccessPoint object by MAC address of it or BSSID of one of radio interfaces.

If trusted node validation is enforced, currentNode should point to execution context object (instance of NetObj, $node in most cases). If trusted nodes are disabled (default server configuration), currentNode can be omitted or set to null.

Parameters

macaddress

String

MAC address.

currentNode

NetObj

Lookup context or null if trusted nodes validation is disabled. Optional parameter.

Return

Instance of AccessPoint object or null if not found or not accessible.

ap = FindAccessPointByMACAddress("AA:34:33:44:14:55");
if (ap != NULL) println(ap.name); // Prints access point name if it is found

FindNodeByAgentId

FindNodeByAgentId(agentid, currentNode): Node

Look up Node object by agent ID.

If trusted node validation is enforced, currentNode should point to execution context object (instance of NetObj, $node in most cases). If trusted nodes are disabled (default server configuration), currentNode can be omitted or set to null.

Parameters

agentid

String

Agent ID.

currentNode

NetObj

Lookup context or null if trusted nodes validation is disabled. Optional parameter.

Return

Instance of Node object or null if not found or not accessible.

node = FindNodeByAgentId("7e54f964-8942-504f-90eb-70e5d6abee92", $node);
if (node != NULL) println(node.name); // Prints node name if node with given agent ID is found

FindNodeByIPAddress

FindNodeByIPAddress(ipaddress, currentNode): Node

Look up Node object by primary IP address or IP address of one of the interfaces.

If trusted node validation is enforced, currentNode should point to execution context object (instance of NetObj, $node in most cases). If trusted nodes are disabled (default server configuration), currentNode can be omitted or set to null.

Parameters

ipaddress

String

IP address.

currentNode

NetObj

Lookup context or null if trusted nodes validation is disabled. Optional parameter.

Return

Instance of Node object or null if not found or not accessible.

node = FindNodeByIPAddress("192.168.1.1", $node);
if (node != NULL) println(node.name); // Prints node name if node with given IP address is found

FindNodeByMACAddress

FindNodeByMACAddress(macaddress, currentNode): Node

Look up Node object by MAC address of one of the interfaces.

If trusted node validation is enforced, currentNode should point to execution context object (instance of NetObj, $node in most cases). If trusted nodes are disabled (default server configuration), currentNode can be omitted or set to null.

Parameters

macaddress

String

MAC address.

currentNode

NetObj

Lookup context or null if trusted nodes validation is disabled. Optional parameter.

Return

Instance of Node object or null if not found or not accessible.

node = FindNodeByMACAddress("AA:34:35:D8:12:45");
if (node != NULL) println(node.name); // Prints node name if node with given MAC address is found

FindNodeBySysName

FindNodeBySysName(sysname, currentNode): Node

Look up Node object by SNMP sysName.

If trusted node validation is enforced, currentNode should point to execution context object (instance of NetObj, $node in most cases). If trusted nodes are disabled (default server configuration), currentNode can be omitted or set to null.

Parameters

sysname

String

SNMP sysName.

currentNode

NetObj

Lookup context or null if trusted nodes validation is disabled. Optional parameter.

Return

Instance of Node object or null if not found or not accessible.

node = FindNodeBySysName("switch-main");
if (node != NULL) println(node.name); // Prints node name if node with given sysName is found

FindNodeObject

FindNodeObject(currentNode, key): Node

Look up Node object by either name or object id, will return null if object not found or not accessible. This function search for nodes only.

If trusted node validation is enforced, currentNode should point to execution context object (instance of NetObj, $node in most cases). If trusted nodes are disabled (default server configuration), currentNode can be set to null.

Parameters

currentNode

Lookup context or null if trusted nodes validation is disabled.

key

Object name of id.

Return

Instance of Node object or null if not found or not accessible.

>>> FindNodeObject($node, "server.netxms.org")
object
>>> FindNodeObject(null, 12)
object
>>> FindNodeObject($node, "bad_node_name")
NULL

FindObject

FindObject(key, currentNode): NetObj

Look up any object inherited from NetObj (Node, Interface, Cluster, etc.) by either name or object id.

If trusted node validation is enforced, currentNode should point to execution context object (instance of NetObj, $node in most cases). If trusted nodes are disabled (default server configuration), currentNode can be omitted or set to null.

Parameters

key

String

Object name or id.

currentNode

NetObj

Lookup context or null if trusted nodes validation is disabled. Optional parameter.

Return

Instance of object inherited from NetObj or null if not found or not accessible. Type of the object can be verified using function classof.

node = FindObject("Infrastructure Services"); //Will find node with name "Infrastructure Services"
println(node.name); //Will print "Infrastructure Services"
println(node.id); //Will print "2"

FindObjectByGUID

FindObjectByGUID(guid, currentNode): NetObj

Look up any object inherited from NetObj (Node, Interface, Cluster, etc.) by GUID.

If trusted node validation is enforced, currentNode should point to execution context object (instance of NetObj, $node in most cases). If trusted nodes are disabled (default server configuration), currentNode can be omitted or set to null.

Parameters

guid

String

Object GUID.

currentNode

NetObj

Lookup context or null if trusted nodes validation is disabled. Optional parameter.

Return

Instance of object inherited from NetObj or null if not found or not accessible. Type of the object can be verified using function classof.

node = FindObjectByGUID("d602a7f1-0049-421b-a134-2fcf35712608", $node);
if (node != NULL) println(node.name); // Prints node name if node with given GUID is found

GetAllNodes

GetAllNodes(): Array

Get list of all Node objects in the system as array.

Return

Array of node objects.

>>> for (n : GetAllNodes()) {
>>>   println(n.id . " - " . n.name);
>>> }

6766 - demo-netxms
6901 - Control Unit 1
6902 - Control Unit 2

GetServerNode

GetServerNode(): Node

Get node object of the management server.

Return

Node instance.

>>> GetServerNode()
Node@0x7facac2889e0

GetServerNodeId

GetServerNodeId(): int

Get ID of management server’s node.

Return

Object ID of the current server node.

>>> GetServerNodeId()
161

Data Collection

Functions for working with DCIs and collected data.

CreateDCI

CreateDCI(node, origin, name, description, dataType, pollingInterval, retentionTime): DCI

Create new data collection item on node, return DCI object instance of null if failed.

Parameters

node

Node object instance (e.g. $node), where DCI should be created.

origin

Data origin. Possible values: "agent", "snmp", "internal", "push", "websvc", "winperf", "script", "ssh", "mqtt", "driver", "cpsnmp". Alternatively, you can use Data origin constants.

name

name of the metric (e.g. "Agent.Version")

description

human readable description.

dataType

Type of the collected data. Possible values: "int32", "uint32", "int64", "uint64", "counter32", "counter64", "float", "string". Alternatively, you can use DCI data type constants.

pollingInterval

polling interval in seconds or null for server-default value.

retentionTime

retention time in days, 0 for "Do not save collected data to database" or null for server-default value.

Return

Instance of newly created DCI of null if failed.

>>> d = CreateDCI($node, DataSource::AGENT, "Agent.Version", "Agent Version", DCI::STRING, 0, 0);
>>> println(d.id);
145

DetectAnomalies

DetectAnomalies(node, dciId, startTime, endTime, threshold) ⇒ ScoredDciValue

Detect anomalies for DCI within given period

Parameters

node

<<class-node

Node object

dciId

Integer

DCI id

startTime

Integer

Perios start time

endTime

Integer

End time is optional (default is current time)

threshold

Number

Threshold is optional (default is 0.75)

Return

Returns null on error and ScoredDciValue on success

scoredValue = DetectAnomalies($node, 312119, 1714653725, GetCurrentTime(), 0.50); //array with scored values

FindAllDCIs

FindAllDCIs(node, nameFilter, descriptionFilter, userTagFilter, relatedObjectFilter): Array

Find all DCI on the node matching nameFilter, descriptionFilter, userTagFilter, and relatedObjectFilter. Filters can contain glob symbols ? and *. If a filter is null, it’s ignored.

Parameters

node

Node object instance (e.g. $node)

nameFilter

GLOB for matching DCI name or null if name should be ignored.

descriptionFilter

GLOB for matching DCI description or null if description should be ignored. Optional parameter.

userTagFilter

GLOB for matching DCI user tag or null if user tag should be ignored. Optional parameter.

relatedObjectFilter

Related object filter: NetObj instance or object ID, or null to ignore. Optional parameter.

Added in version 5.2: userTagFilter parameter

Added in version 5.3: relatedObjectFilter parameter

Return

Array of DCI.

>>> list = FindAllDCIs($node, "Server*", "*MAIN*");
>>> foreach (row : list) {
>>> 	println(row.id .. ": " .. row.description .. " (" .. row.name .. ")");
>>> }
91: Server thread pool MAIN: usage (Server.ThreadPool.Usage(MAIN))
92: Server thread pool MAIN: normalized load average (1 minute) (Server.ThreadPool.LoadAverage(MAIN,1))
93: Server thread pool MAIN: current load (Server.ThreadPool.Load(MAIN))

>>> list = FindAllDCIs($node, "Server*");
>>> foreach (row : list) {
>>> 	println(row.id .. ": " .. row.description .. " (" .. row.name .. ")");
>>> }
100: NetXMS server: database writer's request queue (other queries) (Server.AverageDBWriterQueueSize.Other)
101: NetXMS server: database writer's request queue (Server.AverageDBWriterQueueSize)
103: NetXMS server: data collector's request queue (Server.AverageDataCollectorQueueSize)
…

>>> list = FindAllDCIs($node, null, "*load average*");
>>> foreach (row : list) {
>>> 	println(row.id .. ": " .. row.description .. " (" .. row.name .. ")");
>>> }
119: CPU: load average (15 minutes) (System.CPU.LoadAvg15)
123: CPU: load average (5 minutes) (System.CPU.LoadAvg5)
83: Server thread pool AGENT: normalized load average (1 minute) (Server.ThreadPool.LoadAverage(AGENT,1))
…

>>> for (interface : $node.interfaces) {
>>>   list = FindAllDCIs($node, null, null, null, interface);
>>>   if (list.size > 0) {
>>>     println(interface.name);
>>>     foreach (row : list) {
>>>       println("  " .. row.id .. ": " .. row.description .. " (" .. row.name .. ")");
>>>     }
>>>   }
>>> }
virbr0
  2536: Outbound traffic on virbr0 (Net.Interface.BytesOut64(6))
  2534: Inbound traffic on virbr0 (Net.Interface.BytesIn64(6))

FindDCIByDescription

FindDCIByDescription(node, description): int

Find ID of the DCI on node by description (exact match). FindAllDCIs can be used for pattern search.

Parameters

node

Node object instance (e.g. $node)

description

Description of the DCI

Return

Integer ID of the DCI or 0 if not found.

>>> d = FindDCIByDescription($node, "Agent Version");
>>> print(d);
144

FindDCIByName

FindDCIByName(node, dciParameter): int

Find ID of the DCI on node by parameter name (exact match). FindAllDCIs can be used for pattern search.

Parameters

node

Node object instance (e.g. $node)

dciParameter

Parameter name of the DCI

Return

Integer ID of the DCI or 0 if not found.

>>> d = FindDCIByName($node, "Agent.Version");
>>> print(d);
144

FindDCIByTag

FindDCIByTag(node, dciUserTag): int

Find ID of the DCI on node by user tag (exact match). FindDCIByTagPattern or FindAllDCIs can be used for pattern search.

Added in version 5.2

Parameters

node

Node object instance (e.g. $node)

dciUserTag

Value of DCI user tag

Return

Integer ID of the DCI or 0 if not found.

FindDCIByTagPattern

FindDCIByTagPattern(node, dciUserTagPattern): int

Find ID of the DCI on node by tag using pattern matching. Glob symbols ? and \* can be used. Function returns only one match. FindAllDCIs can be used to get multiple matches.

Added in version 5.2

Parameters

node

Node object instance (e.g. $node)

dciUserTagPattern

DCI user tag pattern

Return

Integer ID of the DCI or 0 if not found.

GetAvgDCIValue

GetAvgDCIValue(object, dciId, periodStart, periodEnd): float

Get the average value of the DCI for the given period. The DCI value type must be numeric.

Parameters

object

Instance of Node, Cluster, or MobileDevice object (e.g. $node).

dciId

ID of the DCI to retrive.

periodStart

Unix timestamp of the period start.

periodEnd

Unix timestamp of the period end.

Return

Average value or null on failure.

>>> obj = FindObject("Server1");
>>> dciID = FindDCIByName(obj, "CPU.Usage")
>>> val = GetAvgDCIValue(obj, dciId, 0, time()); // time range from January 1, 1970 untill now
>>> println("Average CPU Usage: ".. val .. "%");
Average CPU Usage: 17%

GetDCIObject

GetDCIObject(node,id): DCI

Get DCI object by id

Parameters

node

Node

Node object instance

id

Integer

DCI id

Return

DCI object or null if not found

GetDCIObject($node, 2)	    // object
GetDCIObject($node, bad_id)	// `null`

GetDCIRawValue

GetDCIRawValue(node,id): any

Returns last raw value of DCI

Parameters

node

Node

Node object instance (e.g. )

id

Integer

DCI ID

Return

Last raw value (before transformation) for given DCI or null if DCI with given ID does not exist or has no collected values. Type depends on the configured DCI type.

GetDCIRawValue($node, FindDCIByName($node, "Status")) // 0

GetDCIValue

GetDCIValue(node, dciId): String | Table

Get last collected value of the DCI. Return null on error, Table instance for table DCI or String otherwise.

Parameters

node

Node

node object instance (e.g. $node)

dciId

Integer

DCI ID

Return

Table for table DCIs, String, or null if failed or no data is available.

>>> GetDCIValue($node, FindDCIByName($node, "Status"))
0
>>> GetDCIValue($node, FindDCIByName($node, "Non-Existing"))
null

GetDCIValueByDescription

GetDCIValueByDescription(node, description): String | Table

Get last value of DCI with given description on given node.

Parameters

node

Node

Node object instance (e.g. $node)

description

String

DCI description.

Return

Last value for given DCI (String for normal DCIs and Table object for table DCIs) or null if DCI with given description does not exist or has no collected values.

GetDCIValueByDescription($node, "Status")	// 0

GetDCIValueByName

GetDCIValueByName(node, name): String | Table

Get last value of DCI with given name on given node.

Parameters

node

Node

Node object instance (e.g. $node)

name

String

DCI name (parameter’s name for agent or internal source, and OID for SNMP source).

Return

Last value for given DCI (string for normal DCIs and Table object for table DCIs) or null if DCI with given name does not exist or has no collected values.

GetDCIValueByName($node, "Agent.Version")	// "5.0.0"

GetDCIValueByTag

GetDCIValueByTag(node, userTag): String | Table

Get last value of DCI with given user tag on given node.

Added in version 5.2

Parameters

node

Node

Node object instance (e.g. $node)

userTag

String

DCI user tag (exact match).

Return

Last value for given DCI (string for normal DCIs and Table object for table DCIs) or null if DCI with given tag does not exist or has no collected values.

GetDCIValueByName($node, "Agent.Version")	// "5.0.0"

GetDCIValueByTagPattern

GetDCIValueByTagPattern(node, userTagPattern): String | Table

Get last value of DCI with given user tag pattern on given node.

Added in version 5.2

Parameters

node

Node

Node object instance (e.g. $node)

userTagPattern

String

DCI user tag pattern. Glob symbols ? and * can be used.

Return

Last value for given DCI (string for normal DCIs and Table object for table DCIs) or null if DCI was not found by given tag pattern or has no collected values.

GetDCIValues

GetDCIValues(node, id, startTime, endTime, rawValues): Array

Get all values for period of DCI with given ID on given node.

Parameters

node

Node

node object instance

id

Integer

DCI ID

startTime

Integer

Start of the period (as UNIX timestamp).

endTime

Integer

End of the period (as UNIX timestamp). Optional, current time will be used if this parameter is not specified

rawValues

Boolean

False - return transformed values. True - return RAW values. Optional, False by default.

Added in version 4.4.1: rawValues parameter

Return Array of value ordered from latest to earliest for given DCI or null if

DCI with given ID does not exist or has no collected values. This function cannot be used for table DCIs.

GetDCIValues($node, FindDCIByName($node, "Status"), time() - 3600, time()); // Values for last hour

GetDCIValuesEx

GetDCIValuesEx(node, dciId, startTime, endTime, rawValues): Array

Get all values for period of DCI with given ID on given node, returning them as DataPoint objects containing both timestamp and value.

Parameters

node

DataCollectionTarget

Data collection target object instance

dciId

Integer

DCI ID

startTime

Integer

Start of the period (as UNIX timestamp)

endTime

Integer

End of the period (as UNIX timestamp). Optional, current time will be used if not specified

rawValues

Boolean

FALSE - return transformed values. TRUE - return raw values. Optional, FALSE by default

Return

Array of DataPoint objects ordered from latest to earliest for given DCI, or NULL if DCI with given ID does not exist or has no collected values. Each DataPoint contains both the timestamp and the value. This function cannot be used for table DCIs.

// Get data points for the last hour
dataPoints = GetDCIValuesEx($node, FindDCIByName($node, "Status"), time() - 3600, time());
foreach (dp : dataPoints) {
    println("Timestamp: " .. dp->timestamp .. ", Value: " .. dp->value);
}

GetMaxDCIValue

GetMaxDCIValue(node, dciId, from, to): String

Get the maximum value of the DCI for the given period. The DCI value must be of numeric type.

Parameters

node

Node

node object instance (e.g. )

id

Integer

DCI ID

from

Integer

Start of the period (as UNIX timestamp).

to

Integer

End of the period (as UNIX timestamp).

Return

Maximum value or null on failure.

value = GetMaxDCIValue(FindObject("MYWORKPC"), 18, 0, time()); //Max value from the beginning till now\
println(value); //Will print maximum value

GetMinDCIValue

GetMinDCIValue(node, dciId, from, to)): String

Get the minimum value of the DCI for the given period. The DCI value must be of numeric type.

Parameters

node

Node

node object instance (e.g. )

id

Integer

DCI ID

from

Integer

Start of the period (as UNIX timestamp).

to

Integer

End of the period (as UNIX timestamp).

Return

Minimum value or null on failure.

value = GetMinDCIValue(FindObject("MYWORKPC"), 18, 0, time()); //Minimal value from the beginning till now
println(value); //Will print minimal value

GetSumDCIValue

GetSumDCIValue(node, dciId, from, to): String

Get the sum value of the DCI for the given period. The DCI value must be of numeric type.

Parameters

node

Node

node object instance (e.g. )

id

Integer

DCI ID

from

Integer

Start of the period (as UNIX timestamp).

to

Integer

End of the period (as UNIX timestamp).

Return

Sum value or null on failure.

value = GetSumDCIValue(FindObject("MYWORKPC"), 18, 0, time()); //sum value from the beginning till now
println(value); //Prints value

PushDCIData

PushDCIData(node, dciId, value): void

Push new DCI value from script.

Parameters

node

Node

node object instance

dciId

Integer

DCI id for which new value will be pushed (DCI source must be set to "Push").

value

Integer or String

New value for DCI.

Return

No return value

PushDCIData($node, 46, 13); //Will push value "13" to DCI with id 46

Events and Alarms

Functions for event posting and alarm management.

Events

LoadEvent

LoadEvent(eventId): Event | null

Will load event from the database and return Event object or NULL if event not found.

Parameters

eventId

Id of the event to be loaded from database

Return

Event loaded from database or NULL if event not found.

>>>event = LoadEvent(315);
>>>event.id;
315

PostEvent

PostEvent(node, event, tag, …​): bool

Post event on behalf of given node.

Parameters

node

Node

Node object to send event on behalf of.

event

Integer or String

Event code or name.

tag

String

User tag associated with event. Optional, can be leaved out or set to null.

…​

String

0 or more event-specific parameters.

Return

TRUE if event was posted successfully or FALSE if not.

PostEvent($node, 100000);
PostEvent($node, 100000, "my tag", "param1", "param2");
PostEvent($node, "MY_EVENT_NAME", null, "param1");

PostEventEx

PostEventEx(node, event, parameters, tags, originTimestamp, origin): bool

Post event on behalf of given node.

Parameters

node

Node

Node object to send event on behalf of.

event

Integer or String

Event code or name.

parameters

Array or Hash map

Event parameters. Hash map allows to use named parameters - hash map keys will become parameter names. Optional, can be set to null.

tags

Array of Strings

User tags associated with event. Optional, can be set to null.

originTimestamp

Integer

Time as seconds since epoch (1 January 1970 00:00:00 UTC). Optional, can be set to null.

origin

Integer

One of the possible values. Optional, can be set to null.

Return

TRUE if event was posted successfully or FALSE if not.

// event parameters as array
r = PostEventEx($node, "MY_EVENT", ["text parameter", 123]);

// event parameters as hash map
r = PostEventEx($node, "MY_EVENT", %{"someParam":"value", "anotherParam":456});

// null is used to omit originTimestamp
params = %{};
params["someParam"] = "some value";
params["anotherParam"] = 42;
tags = [];
tags.append("tag1");
tags.append("tag2");
r = PostEventEx($node, "MY_EVENT", params, tags, null, EventOrigin::NXSL);

Alarms

FindAlarmById

FindAlarmById(id): Alarm

Finds alarm object by id

Parameters

id

Integer

Alarm id

Return

Alarm object or null if no such alarm exist.

alarm = FindAlarmById(72388); // Will find alarm with id 72388
println(alarm.id); // Will print "72388"
println(alarm.message); // Will print alarm message. For example: "Node down"

FindAlarmByKey

FindAlarmByKey(key): Alarm

Find alarm by key

Parameters

key

String

Alarm key

Return

Will return object of class alarm

alarm = FindAlarmByKey("NODE_DOWN_0x000023A2"); //Will find alarm with key "NODE_DOWN_0x000023A2"
println(alarm.key); //Will print key "NODE_DOWN_0x000023A2"
println(alarm.message); //Will print alarm message, for example "Node down"

FindAlarmByKeyRegex

FindAlarmByKeyRegex(key): Alarm

Find alarm by key using regular expression

Parameters

key

String

Key regular expression

Return

Alarm object found by key

alarm = FindAlarmByKeyRegex("NODE_DOWN_.*"); //Will find alarm with regexp key "NODE_DOWN_.*"
println(alarm.key); //Will print key "NODE_DOWN_0x00001628"
println(alarm.message); //Will print alarm message, for example "Node down"

String Operations

Functions for string manipulation and formatting.

Strings

chr

chr(code): String

Return a character from it’s UNICODE code.

Parameters

code

Integer

A character’s UNICODE code.

Return

A string consisting of single character.

chr(0x50)	 //Will return "P"

d2x

d2x(number, padding=0): String

Convert decimal devValue to hex string with optional left-padding with zeroes.

Parameters

number

Input value.

padding

Optional argument specifying target string length.

Return

Hex string.

>>> d2x(1234)
4D2
>>> d2x(1234, 8)
000004D2

FormatNumber

FormatNumber(number, width, precision): String

Formats a numeric value.

Parameters

number

Any

The numeric value to format.

width

Integer

Minimum number of characters. If the number of characters in the output value is less than the specified width, blanks are added to the left or the right of the values — depending on whether the width is negative (for left alignment) or positive (for right alignment) — until the minimum width is reached. The width specification never causes a value to be truncated.

precision

Integer

The number of decimal places. Floating point value will be rounded accordingly.

Return

Formatted numeric value.

FormatNumber(3.7, 7, 2)		//	"   3.70"
FormatNumber(3.7, -7, 2)		//	"3.70   "
FormatNumber(5.7278, 1, 2)	//	"5.73"
FormatNumber(5.7278, 1, 0)	//	"6"

LevenshteinDistance

LevenshteinDistance(string1, string2, ignoreCase): int

Calculates the Levenshtein distance between two strings, which is the minimum number of single-character edits (insertions, deletions, substitutions) needed to transform one string into another.

Parameters

string1

String

First string to compare

string2

String

Second string to compare

ignoreCase

Boolean

Optional. If TRUE, performs case-insensitive comparison. Defaults to FALSE

Return

Integer representing the edit distance between the two strings.

// Calculate distance between two strings
distance = LevenshteinDistance("kitten", "sitting");
println(distance);  // prints 3

// Case-insensitive comparison
distance = LevenshteinDistance("Hello", "hello", true);
println(distance);  // prints 0

ord

ord(character): int

Convert a character into it’s ASCII/Unicode value.

Only processes one character.

+ .Parameters

character

String

Character

+ .Return An ASCII/Unicode value

println(ord("a")); //Will pritn 97
println(ord("abc")); //Will pritn 97

SimilarityScore

SimilarityScore(string1, string2, ignoreCase): float

Calculates a similarity score between two strings using Levenshtein distance.

Parameters

string1

String

First string to compare

string2

String

Second string to compare

ignoreCase

Boolean

Optional. If TRUE, performs case-insensitive comparison. Defaults to FALSE

Return

Float value between 0.0 (completely different) and 1.0 (identical strings). Calculated as: 1.0 - (distance / max(len1, len2)).

// Calculate similarity between two strings
score = SimilarityScore("hello", "hallo");
println(score);  // prints 0.8

// Identical strings
score = SimilarityScore("test", "test");
println(score);  // prints 1.0

// Case-insensitive comparison
score = SimilarityScore("Hello", "hello", true);
println(score);  // prints 1.0

x2d

x2d(hexValue): int

Convert hexadecimal string to decimal value.

Parameters

hexValue

Input value.

Return

Converted value.

>>> x2d("4D2")
1234

Time and Date

Functions for working with dates and times.

GetCurrentTime

GetCurrentTime(): int

Get current time in seconds

Return

Current time in seconds

>>> GetCurrentTime()
1714653725

GetCurrentTimeMs

GetCurrentTimeMs(): int64

Get current time in milliseconds

Return

Current time in milliseconds

>>> GetCurrentTimeMs()
1674586722493

GetMonotonicClockTime

GetMonotonicClockTime(): int

Get number of milliseconds counted by monotonic clock since some unspecified point in the past (system boot time on most systems).

Return

Current time from monotonic clock in milliseconds.

println(GetMonotonicClockTime()); // Will print "626624750"

time

time(): int

Gets the system time.

Return

System time as number of seconds elapsed since midnight (00:00:00), January 1, 1970, coordinated universal time, according to the system clock (also known as UNIX time).

print(time()); //will print 1588953745

Math

Mathematical functions under the Math:: namespace.

Math::Abs

Math::Abs(x): number

Returns the absolute value of a number.

Parameters

x

number

Input value.

Return

Absolute value.

println(Math::Abs(12.3)); // Will print "12.300000"
println(Math::Abs(-0.307)); // Will print "0.307000"
println(Math::Abs(-42)); // Will print "42"

Math::Acos()

Math::Acos(x): float

Calculates arc cosine value of a number.

Parameters

x

number

Real number x, with −1 ≤ x ≤ 1

Return

The angle in radians whose cosine is x

println(Math::Acos(-1)); // Will print "3.141593"
println(Math::Acos(0.5)); // Will print "1.047198"

Math::Asin

Math::Asin(x): float

Calculates arc sine of x.

Parameters

x

number

Real number x, with −1 ≤ x ≤ 1

Return

The angle in radians whose sine is x

println(Math::Asin(1)); // Will print "1.570796"
println(Math::Asin(0.5)); // Will print "0.523599"

Math::Atan

Math::Atan(x): float

Calculates arc tangent of x.

Parameters

x

number

Real number x, with −1 ≤ x ≤ 1

Return

The angle in radians whose arc tangent is x

println(Math::Atan(1)); // Will print "0.785398"
println(Math::Atan(0.5)); // Will print "0.463648"

Math::Atan2

Math::Atan2(x, y): float

Calculates 2-argument arc tangent.

Parameters

x

number

Real number x, with −1 ≤ x ≤ 1

y

number

Real number y, with −1 ≤ y ≤ 1

Return

The angle in radians

println(Math::Atan2(1, 0.5)); //Will print "1.107149"
println(Math::Atan2(0.5, 1)); //Will print "0.463648"

Math::Atanh

Math::Atanh(x): float

Calculates hyperbolic arctan of x.

Parameters

x

number

Angle in radians

Return

Result of hyperbolic arctan for this angle

println(Math::Atanh(0.5)); // Will print "0.549306"

Math::Average

Math::Average(x, y, …​): number

Calculate average value from given numbers or array(s) of numbers.

Parameters

x, y, …​

number, Array

Comma separated numbers or array(s) of numbers

Return

Average value.

println(Math::Average([2, 2, 4, 4, 14])); // Will print "5.200000"
println(Math::Average(1,2,[3,4])); // Will print "2.500000"

Math::Ceil

Math::Ceil(x): int

Round up value.

Parameters

x

number

Input value

Return

Value round up to nearest integer.

println(Math::Ceil(2.3)); // Will print "3"
println(Math::Ceil(3.8)); // Will print "4"
println(Math::Ceil(-2.3)); // Will print "-2"
println(Math::Ceil(-3.8)); // Will print "-3"

Math::Cos

Math::Cos(x): float

Calculates cosine from given angle in radians.

Parameters

x

number

Angle in radians

Return

Result of cosine for this angle

print(Math::Cos(0.5)); // Will print "0.877583"

Math::Cosh

Math::Cosh(x): float

Calculates hyperbolic cosine x.

Parameters

x

number

Angle in radians

Return

Result of hyperbolic cosine for this angle

print(Math::Cosh(0.5)); // Will print "0.877583"

Math::Exp

Math::Exp(x): float

Computes e**x, the base-e exponential.

Parameters

x

number

Input number

Return

Result of the exponential function

println(Math::Exp(2)); // Will print "7.389056"

Math::Floor

Math::Floor(x): int

Round down value.

Parameters

x

number

Input value

Return

Value round down to nearest integer.

println(Math::Floor(2.3)); // Will print 2
println(Math::Floor(3.8)); // Will print 3
println(Math::Floor(-2.3)); // Will print -3
println(Math::Floor(-3.8)); // Will print -4

Math::Log

Math::Log(x): float

Calculates natural logarithm.

Parameters

x

number

Number to calculate natural logarithm of

Return

Natural logarithm of x.

println(Math::Log(2)); // Will print "0.693147"

Math::Log10

Math::Log10(x): float

Calculates logarithm of given value to base 10.

Parameters

x

number

Number to calculate logarithm of

Return

Logarithm of x to base 10.

println(Math::Log10(2)); // Will print "0.301030"

Math::Max

Math::Max(x, y, …​): number

Returns maximal value from given numbers or array(s) of numbers.

Parameters

x, y, …​

number, Array

Comma separated numbers or array(s) of numbers

Return

Maximal value.

println(Math::Max(2, 3, 4, 8)); // Will print "8"
println(Math::Max(1, 2, [1, 2, 3])); // Will print "3"

Math::MeanAbsoluteDeviation

Math::MeanAbsoluteDeviation(x, y, …​): number

Calculates mean absolute deviation for given series.

Parameters

x, y, …​

number, Array

Comma separated numbers or array(s) of numbers

Return

Absolute deviation for given series.

println(Math::MeanAbsoluteDeviation([2, 4, 4, 4, 5, 5, 7, 11])) // Will print "1.875000"
println(Math::MeanAbsoluteDeviation(2, 4, 4, 4, [5, 5, 7, 11])) // Will print "1.875000"

Math::Min

Math::Min(x, y, …​): number

Returns minimal value from given numbers or array(s) of numbers.

Parameters

x, y, …​

number, Array

Comma separated numbers or array(s) of numbers

Return

Minimal value.

println(Math::Min(2, 3, 4, 8)); // Will print "2"

Math::Pow

Math::Pow(x, y): number

Calculates x raised to the power of y.

Parameters

x

number

Base

y

number

Power

Return

x raised to the power of y.

println(Math::Pow(2.5, 3.1)); // Will print "17.124347"

Math::Pow10

Math::Pow(x): number

Calculates 10 raised to the power of x.

Parameters

x

int

Power

Return

x raised to the power of 10.

println(Math::Pow10(2)); // Will print "100.000000"

Math::Random

Math::Random(minValue, maxValue): int

Generate pseudo random number in given range. Uses cryptographically secure pseudo random generator (CSPRNG).

Parameters

minValue

int

Start of range (inclusive)

minValue

int

End of range (inclusive)

Return

Random value in range minValue..maxValue.

println(Math::Random(0, 100)); // Will print random value in 0..100 range

Math::Round

Math::Round(x, precision): number

Round floating point value to the nearest integer value or floating point value with given precision.

Parameters

x

number

Input value.

precision

int

Optional number of decimal places to be left. If omitted or set to 0, x will be rounded to integer value.

Return

The integral value that is closest to x if precision is omitted or set to 0, or floating point value rounded to have given number of decimal places.

println(Math::Round(2.3)); // Will print "2"
println(Math::Round(3.8)); // Will print "4"
println(Math::Round(-2.3)); // Will print "-2"
println(Math::Round(-3.8)); // Will print "-4"
println(Math::Round(2.378, 2)); // Will print "2.38"
println(Math::Round(2.378, 1)); // Will print "2.4"

Math::Sin

Math::Sin(x): float

Calculates sine from given angle in radians.

Parameters

x

number

Angle in radians

Return

Result of sine for this angle

print(Math::Sin(0.5)); // Will print "0.479426"

Math::Sinh

Math::Sinh(x): float

Calculates hyperbolic sine x.

Parameters

x

number

Angle in radians

Return

Result of hyperbolic sine for this angle

print(Math::Sinh(0.5)); // Will print "0.521095"

Math::Sqrt

Math::Sqrt(x): float

Calculates square root of x.

Parameters

x

number

Input value

Return

Square root value.

println(Math::Sqrt(4.5)); // Will print "2.121320"

Math::StandardDeviation

Math::StandardDeviation(x, y, …​): number

Calculates standard deviation for given series.

Parameters

x, y, …​

number, Array

Comma separated numbers or array(s) of numbers

Return

Standard deviation of given series.

println(Math::StandardDeviation([2, 4, 4, 4, 5, 5, 7, 11])) // Will print "2.537223"
println(Math::StandardDeviation(2, 4, 4, 4, [5, 5, 7, 11])) // Will print "2.537223"

Math::Sum

Math::Sum(x, y, …​) ⇒ Number

Returns sum of given numbers or array(s) of numbers.

Parameters

x, y, …​

number, Array

Comma separated numbers or array(s) of numbers

Return

Sum of values.

println(Math::Sum(2, 2)); // Will print "4"
println(Math::Sum(1, [2, 3])); // Will print "6"

Math::Tan

Math::Tan(x): float

Calculates tangent of x.

Parameters

x

number

Angle in radians

Return

Result of tangent for this angle

print(Math::Tan(0.5)); // Will print "0.546302"

Math::Tanh

Math::Tanh(x): float

Calculates hyperbolic tangent of x.

Parameters

x

number

Angle in radians

Return

Result of hyperbolic tangent for this angle

print(Math::Tanh(0.5)); // Will print "0.462117"

Math::Weierstrass

Math::Weierstrass(a, b, x): float

Calculate Weierstrass function for given x, a, and b. More can be found there: https://en.wikipedia.org/wiki/Weierstrass_function. Can be used for test data generation.

Parameters

a

float

Coefficient, 0<a<1

b

int

Coefficient, odd integer

x

int

Point to calculate function in

Return

Value in point x for Weierstrass function with given coefficients

print(Math::Weierstrass(0.5, 7, 10)); // Will print "1.999218"

Cryptography / Hashes

Cryptographic functions under the Crypto:: namespace.

Crypto::MD5

Crypto::MD5(string): String

The MD5 message-digest algorithm implementation

Parameters

string

String

String to get hash

Return

MD5 hash

println(Crypto::MD5("Some text")); //Will print "9DB5682A4D778CA2CB79580BDB67083F"

Crypto::SHA1

Crypto::SHA1(string): String

sha1 function implementation

Parameters

string

String

String to get result of Secure Hash Algorithm 1

Return

Result of sha1

println(Crypto::SHA1("String")); //Will pritn "3DF63B7ACB0522DA685DAD5FE84B81FDD7B25264"

Crypto::SHA256

Crypto::SHA256(string): String

sha256 function implementation

Parameters

string

String

String to get result of Secure Hash Algorithm 256

Return

Result of sha256

println(Crypto::SHA256("String")); //Will pritn "B2EF230E7F4F315A28CDCC863028DA31F7110F3209FEB76E76FED0F37B3D8580"

Base64 Package

Base64 encoding/decoding functions under the Base64:: namespace.

Base64::Decode

Base64::Decode(string, encoding=null): String

Decode base64 encoded string. Accepts string to encode and optional character encoding. Valid character encodings are "UTF-8", "UCS-2", "UCS-4", "SYSTEM". Default is UTF-8.

Parameters

string

String

String to decode

encoding

String

String encoding. Optional parameter.

Return

Decoded string

print(Base64::Decode("U29tZSB0ZXh0")); //Will print "Some text"

Base64::Encode

Base64::Encode(string, encoding=null): String

Encode string as base64. Accepts string to encode and optional character encoding. Valid character encodings are "UTF-8", "UCS-2", "UCS-4", "SYSTEM". Default is UTF-8.

Parameters

string

String

String to encode

encoding

String

String encoding. Optional parameter.

Return

Encoded string

print(Base64::Encode("Some text")); //Will print "U29tZSB0ZXh0"

Network

Network operations under the Net:: namespace.

Net::GetLocalHostName

Net::GetLocalHostName(fullyQualified=null): String

Get local host name. If optional argument is true, fully qualified name will be returned.

Parameters

fullyQualified

Boolean

Optional. True if fully qualified name should be returned.

Return

Host name

println(Net::ResolveAddress("127.0.0.1")); //Will print "localhost"

Net::ResolveAddress

Net::ResolveAddress(address): String

Resolve IP address to host name

Parameters

address

String

IP address to resolve host name

Return

Host name

println(Net::ResolveAddress("127.0.0.1")); //Will print "localhost"

Net::ResolveHostname

Net::ResolveHostname(hostname): String

Resolve hostname to IP address

Parameters

hostname

String

Hostname

Return

IP address as a String

println(Net::ResolveHostname("localhost")); //Will print "127.0.0.1"

File operations

File system operations under the IO:: namespace.

Available only if NXSL.EnableFileIOFunctions configuration parameter is turned on.

IO::CopyFile

IO::CopyFile(sourceFileName, destinationFileName): bool

Makes a copy of source file or folder to destination file or folder and returns TRUE if action was successful.

Parameters

sourceFileName

String

Source file/folder name

destinationFileName

String

Destination file/folder name

Return

TRUE if copy was successful and FALSE if not.

IO::CopyFile("/tmp/source", "/tmp/destination") // Will copy "/tmp/source" file content to "/tmp/destination" file.

IO::CreateDirectory

IO::CreateDirectory(newDirectory): bool

Makes a copy of source file to destination file and returns TRUE if action was successful. Will create destination file if file does not exist.

Parameters

newDirectory

String

Directory to be created

Return

TRUE if creation was successful and FALSE if not.

IO::CreateDirectory("/tmp/newDir") // Will create new directory with name "newDir" under folder "tmp"

IO::DeleteFile

IO::DeleteFile(file): bool

Deletes file.

Parameters

file

String

File to delete

Return

TRUE if delete was successful and FALSE if not.

IO::DeleteFile("/tmp/file") // Will delete "/tmp/file" file.

IO::FileAccess

IO::FileAccess(fileName, mode): bool

Check file access.

Parameters

fileName

String

File to check access on

mode

Integer

Mode to check

Windows access mode

00

Existence only

02

Write-only

04

Read-only

06

Read and write

Unix like system access mode

0

Existence only

1

Execute permission

2

Write permission

4

Read permission

Return

TRUE if user has given access to provided file and FALSE if not.

return IO::FileAccess("/tmp/file", 5) // Will return true if user has read and execute access to file

IO::OpenFile

IO::OpenFile(fileName, fileMode) ⇒ FILE

Open file. Returns FILE object or null.

Parameters

fileName

String

File name to open.

openingMode

String

Mode file should be opened in. More can be found there.

Return

File class or NULL if error occurred.

f = IO::OpenFile("/tmp/a.txt", "r");
while (!f.eof) println(f.readLine()); // Will print contents of the file

IO::RemoveDirectory

IO::RemoveDirectory(directory): bool

Removes directory.

Parameters

directory

String

Directory to delete

Return

TRUE if delete was successful and FALSE if not.

IO::RemoveDirectory("/tmp/dir") // Will delete "/tmp/dir" directory.

IO::RenameFile

IO::RenameFile(currentFile, newFileName): bool

Renames file.

Parameters

currentFile

String

File to rename

newFileName

String

New file name

Return

TRUE if renamed was successful and FALSE if not.

IO::RenameFile("/tmp/oldFileName", "/tmp/mewFileName") // File with name "oldFileName" will be renamed to "mewFileName"

Miscelanious

General-purpose utility functions.

_exit

_exit(exitCode=0): void

Stop script execution and return exitCode.

Parameters

exitCode

Integer

Optional exit code for the script. Defaults to 0.

assert

assert(expression): void

Check if given value is TRUE

Parameters

expression

Boolean

Expression or value to evaluate

node = FindObject("aaa");
assert(node != null); //Will go through, if object with name "aaa" found and will exit script if not

classof

classof(instance): String

Return class name of the instance.

Parameters

instance

Instance of any class.

Return

Class name.

>>> classof($node)
Node

CountryAlphaCode

CountryAlphaCode(code): String

Lookup country alpha code by numeric or alpha3 code.

Parameters

code

Numeric (3 digits) or 3-letter country code.

Return

Two letter country code or null if country not found.

>>> CountryAlphaCode('020')
AN
>>> CountryAlphaCode('AND')
AN
>>> CountryAlphaCode('124')
CA

CountryName

CountryName(code): String

Get country name from code

Parameters

code

String

Country code

Return

Country name

print(CountryName("BE")); // Will print "Belgium"

CancelScheduledTasksByKey

CancelScheduledTasksByKey(key): int

Will delete scheduled tasks by key

Parameters

key

String

Schedule key

Return

Number of deleted scheduled task count with provided key

print(CancelScheduledTasksByKey("Key")); //Number of tasks

CountScheduledTasksByKey

CountScheduledTasksByKey(key): int

Will count scheduled tasks by key

Parameters

key

String

Schedule key

Return

Scheduled task count with provided key

print(CountScheduledTasksByKey("Key")); //Number of tasks

CreateUserAgentNotification

CreateUserAgentNotification(object, message, startTime, endTime): int

Creates user agent notification

Parameters

object

Node or root object to send notification

message

Message to be sent to clients

startTime

Start time of notification delivery

endTime

End time of notification delivery

Return

New user agent notification id

>>> CreateUserAgentNotification($node, "One time notification text", 0, 0);
14

>>> CreateUserAgentNotification($node, "Interval user agent notification text", time(), time()+86400);
15

CurrencyAlphaCode

CurrencyAlphaCode(code): String

Get currency alpha code from numeric code

Parameters

code

String

Numeric code as a string

Return

Currency alpha code from numeric code

print(CurrencyAlphaCode("978")); // Will print "EUR"

CurrencyExponent

CurrencyExponent(code): int

Get currency exponent

Parameters

code

String

Currency numeric or character code as a String

Return

Currency exponent

println(CurrencyExponent("EUR")); // Will print 2
println(CurrencyExponent("978")); //Will print 2

CurrencyName

CurrencyName(code): String

Get currency name from code

Parameters

code

String

Currency numeric or character code as a String

Return

Currency name

println(CurrencyName("EUR")); //Will print "Euro"
println(CurrencyName("978")); //Will print "Euro"

FormatMetricPrefix

FormatMetricPrefix(number, binary, precision): String

Convert numeric value to human-readable form with metric prefix.

Parameters

number

Number

Number to format.

binary

Boolean

Optional argument. Set to true to use binary multipliers (Ki, Mi, etc.). Default value is false.

precision

Unsigned Integer

Optional argument with rounding precision. Acceptable values are from 0 to 20. Default value is 2.

Return

String containing the value converted to human-readable form with metric prefix.

>>> FormatMetricPrefix(5000)
5.00 k
>>> FormatMetricPrefix(5000, true)
4.88 Ki
>>> FormatMetricPrefix(-1234567.89, false, 0)
-1 M
>>> FormatMetricPrefix(-1234567.89,, 10)
-1.2345678900 M

FindVendorByMACAddress

FindVendorByMACAddress(text): String

Find NIC vendor information by mac address

Parameters

text

String

MAC address

Return

NIC vendor name or null

>>> FindVendorByMACAddress("00:00:5e:00:53:af")
ICANN, IANA Department

GetAvailablePackages

GetAvailablePackages(platformFilter, typeFilter): Array

Retrieves all available deployment packages, optionally filtered by platform and/or package type.

Parameters

platformFilter

String

Optional platform name filter (e.g., "Windows", "Linux"). Pass NULL to skip filtering

typeFilter

String

Optional package type filter. Pass NULL to skip filtering

Return

Array of DeploymentPackage objects containing package metadata.

// Get all packages
packages = GetAvailablePackages(null, null);

// Get only Linux packages
linuxPackages = GetAvailablePackages("Linux", null);

foreach (pkg : packages) {
    println("Package: " .. pkg->name .. " v" .. pkg->version .. " (" .. pkg->platform .. ")");
}

GetConfigurationVariable

GetConfigurationVariable(key, defaultValue=null): String

Read server configuration parameter by key.

Parameters

key

Configuration parameter name to lookup.

defaultValue

Optional argument with default value if key is not found.

Return

Value of the server configuration parameter. If key is not found, null is returned or defaultValue is specified.

>>> GetConfigurationVariable("NumberOfStatusPollers")
10
>>> GetConfigurationVariable("BadVariable")
NULL
>>> GetConfigurationVariable("BadVariable", 22)
22

GetMappingTableKeys

GetMappingTableKeys(table): Array

Get array with all keys from mapping table.

Parameters

table

Table name or ID

Return

Array of keys or null if mapping table is not found.

Provided that there is a mapping table named "table1", which has keys 10, 20 and 30 with corresponding values "value1", "value2" and "value3":

println(GetMappingTableKeys("table1")); // prints "[10, 20, 30]"

GetServerQueueNames

GetServerQueueNames(): Array

Get array with server queue names.

Return

Array with strings.

foreach(l : GetServerQueueNames())
{
  println(l);
}

GetSyslogRuleCheckCount

GetSyslogRuleCheckCount(name, object): int

Get syslog rule check count for all objects or for exact object.

Parameters

name

String

Rule name

object

NetObj or Integer

Object of class NetObj or object id. Optional parameter

Return

Syslog rule check count or -1 if syslog daemon not initialized

println(GetSyslogRuleCheckCount("RuleName", $object)); // Will print rule check count for rule with name "RuleName"

GetSyslogRuleMatchCount

GetSyslogRuleMatchCount(name, object): int

Get syslog rule match count or all objects or for exact object.

Parameters

name

String

Rule name

object

NetObj or Integer

Object of class NetObj or object id. Optional parameter

Return

Syslog rule match count or -1 if syslog daemon not initialized

println(GetSyslogRuleMatchCount("RuleName", $object)); // Will print rule match count for rule with name "RuleName"

GetThreadPoolNames

GetThreadPoolNames(): Array

Get array with thread pool names.

Return

Array with strings.

print(GetThreadPoolNames()[0]); //will print "MAIN"

IsMarkdownComment

IsMarkdownComment(comment): bool

Return true if string passed as argument starts with Markdown indicator.

Parameters

comment

String parameter from $object.setComments method

//  To remove Markdown indicator from string the following code can be used:
s = s.substring(3);

// And to get object comment always as text:
comment = IsMarkdownComment($object.comments) ? $object.comments.substring(3) : $object.comments;

JsonParse

JsonParse(string, [integerAsFloat]): JsonObject

Parse input string to JsonObject

Parameters

string

JSON as a string.

integerAsFloat

Optional boolean parameter. If set to true, all integers in JSON will be interpreted as floating point numbers. Default is false. Available starting from version 5.2.4.

Return

JsonObject if root object is Json object and JsonArray if root object is Json array or null if failed to parse

Global Variables Set on Error

When JSON parsing fails, the following global variables are set:

$jsonErrorMessage

Error message describing the parsing failure.

$jsonErrorLine

Line number where the parsing error occurred.

$jsonErrorColumn

Column number where the parsing error occurred.

Basic usage
// Parse a simple JSON object
json = JsonParse('{"name": "John", "age": 30}');
if (json) {
    println("Name: " .. json->name);
    println("Age: " .. json->age);
}
Using integerAsFloat parameter
// Parse JSON with integers as floating point
json = JsonParse('{"value": 42}', true);
if (json) {
    println("Value type: " .. typeof(json->value)); // Will be "real"
}

// Parse JSON with integers as integers (default behavior)
json = JsonParse('{"value": 42}', false);
if (json) {
    println("Value type: " .. typeof(json->value)); // Will be "int64"
}
Error handling using global variables
// Attempt to parse invalid JSON
json = JsonParse('{"name": "John", "age":}'); // Missing value after colon
if (!json) {
    println("JSON parsing failed:");
    println("  Error: " .. $jsonErrorMessage);
    println("  Line: " .. $jsonErrorLine);
    println("  Column: " .. $jsonErrorColumn);
}

map

map(table, key, default=null): String

Lookup value from mapping table.

Parameters

table

Table name or ID.

key

String key to lookup.

default

Optional default value.

Return

When key or table is not found, return null or default value if provided.

Provided that there is a mapping table named "table1", which has keys 10, 20 and 30 with corresponding values "value1", "value2" and "value3":

println(map("table1", 20)); // prints "value2"
println(typeof(map("table1", 40))); // prints "null"
println(map("table1", 40, "NOT FOUND")); // prints "NOT FOUND"

mapList

mapList(table, list, separator, default): String

Lookup multiple keys (separated by user-defined separator) from mapping table. Result string is joined using the same separator.

Parameters

table

name or ID of the mapping table.

list

string of keys separated by separator.

separator

separator used to split list and to produce output.

Return

Provided that there is a mapping table named "table1", which has keys 10, 20 and 30 with corresponding values "value1", "value2" and "value3":

println(mapList("table1", "10,20,30", ",")); // prints "value1,value2,value3"
println(mapList("t", "10,20,30,40", ",", "NOT FOUND"));  // prints "value1,value2,value3,NOT FOUND"

print

print(object): void

Prints any text or text representation of object

Parameters

object

object

Any object

a = ["a", 1, 1.5];
print("Array: ");
print(a); // Will print "Array: [a, 1, 1.500000]"

println

println(object): void

Prints any text or text representation of object and adds new line symbol after it

Parameters

object

object

Any object

a = ["a", 1, 1.5];
println("Array: ");
println(a);
//Array:
//[a, 1, 1.500000]

QueryAIAssistant

QueryAIAssistant(prompt, context): String

Sends a prompt to the AI assistant and returns the response.

Parameters

prompt

String

Prompt to send to the AI assistant

context

NetObj

Optional context object to provide additional information to the AI

Return

String containing the AI assistant’s response, or NULL on failure.

// Query AI without context
response = QueryAIAssistant("Analyze this network situation");
println(response);

// Query AI with node context
response = QueryAIAssistant("What might be causing high CPU usage?", $node);
println(response);

range

range(start, end) ⇒ Range range(start, end, step) ⇒ Range range(end) ⇒ Range:: Creates a Range object for iteration.

+ .Parameters

start

Numeric

Start value (inclusive). If only one argument is provided, start defaults to 0 and the argument becomes end

end

Numeric

End value (exclusive)

step

Numeric

Step value. Optional, defaults to 1

+ .Return

Range object that is iterable and can be used in for-each loops.

+

// Create range from 0 to 9
for (i : range(10)) {
    println(i);  // prints 0, 1, 2, ..., 9
}

// Create range from 5 to 9
for (i : range(5, 10)) {
    println(i);  // prints 5, 6, 7, 8, 9
}

// Create range from 0 to 10 with step 2
for (i : range(0, 10, 2)) {
    println(i);  // prints 0, 2, 4, 6, 8
}

ReadPersistentStorage

ReadPersistentStorage(key): String

Read value from global persistent key-value storage.

Parameters

key

String record key to lookup.

Return

Value referenced by key or null if key not exist.

>>> ReadPersistentStorage("key1")
value1
>>> ReadPersistentStorage("key2")
null
>>> WritePersistentStorage("key2", "value2")
>>> ReadPersistentStorage("key2")
value2

RegisterAITask

RegisterAITask(taskDescription, prompt): int

Registers a new AI task for asynchronous processing.

Parameters

taskDescription

String

Description of the AI task

prompt

String

Prompt to send to the AI assistant

Return

Integer task ID which can be used to track the task’s execution and retrieve results.

// Register an AI task for later processing
taskId = RegisterAITask("Analyze alarm patterns", "Review recent alarms and identify patterns");
println("Registered AI task with ID: " .. taskId);

SecondsToUptime

SecondsToUptime(seconds): String

Format system uptime in seconds as string in format "n days, hh:mm".

Parameters

seconds

Integer

Number of seconds.

Return

System uptime in format "n days, hh:mm".

println(SecondsToUptime(600)); // Will print "0 days, 00:10"

SendMail

SendMail(recipients, subject, text, ishtml): void

Sends e-mail to specified recipients.

Parameters

recipients

String

List of e-mail addresses. Multiple recipients should be separated by ";".

subject

String

E-mail subject.

text

String

E-mail text (body).

ishtml

Boolean

Indicates whether the text is in HTML. If omitted then false is assumed.

Return

No return value

SendMail("[email protected]", "My subject", "My text", false);

SendNotification

SendNotification(channelName, recipients, subject, text): void

Sends notification to specified recipients.

Parameters

channelName

String

Name of notification channel.

recipients

String

List of recipients. Multiple recipients should be separated by ";".

subject

String

Subject. Not all notification channel may support this field, in this case empty string "" should be provided.

text

String

Message text.

Return

No return value

SendNotification("Telegram", "Alice; Bob", "", "My message text");

sleep

sleep(milliseconds): void

Suspend script execution for given number of milliseconds.

Parameters

milliseconds

Integer

Number of milliseconds to suspend script execution for.

Return

No return value

sleep(1000);   // sleep for 1 second

trace

trace(debugLevel, message): void

Writes message to NetXMS main log if current debug level is equal or higher than debugLevel.

Parameters

debugLevel

Target debug level.

message

String to be written.

Return
>>> trace(0, "Test");

typeof

typeof(instance) ⇒ string

Return type of the instance.

Parameters

instance

Instance of the object or primitive.

Return

Name of the type.

>>> typeof(1)
int32
>>> typeof(1L)
int64
>>> typeof([1, 2, 3])
array
>>> typeof(new Table())
object
>>> typeof(null)
null

PollerTrace

PollerTrace(message): void

Sends poller trace message to client (if poll initiated by client) and log it. Used only in hook scripts.

Parameters

message

String

Message text

WritePersistentStorage

WritePersistentStorage(key, value): void

Create or update value in global persistent key-value store.

Parameters

key

String key.

value

String value to be saved.

Return
>>> WritePersistentStorage("key1", "value1")
>>> ReadPersistentStorage("key1")
value1

Class Reference

Base Classes

These are the foundational classes from which other classes inherit.

Object

Class Object is the root of the class hierarchy. Every class has Object as a superclass.

Instance attributes

__class ⇒ Class

Object of Class class

Instance methods

__get(name) ⇒ Value

Get any attribute value by it’s name

Parameters

name

String

Name of the attribute

Return

Attribute value

__invoke(name, …​) ⇒ Value

Execute any method, by it’s name

Parameters

name

String

Name of the method

…​

Value

Any values that are required for method execution

Return

Method return value if method returns something

NetObj

Base class for all NetXMS objects. Extends Object.

Instance attributes

Object custom attributes can be accessed in the same way as instance attribute. If name of the custom attribute overlaps with the instance attribute, method NetObj::getCustomAttribute() should be used instead.
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects (inherited from NetObj). Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UINX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (inherited from NetObj, most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

Instance methods

bind(childObject): void

Bind childObject to the current object as a child.

Parameters

object

NetObj

Object to bind as a child to the current object.

bindTo(parentObject): void

Bind current object to parentObject as a child.

Parameters

object

NetObj

Object to bind as a parent to the current object.

calculateDowntime(tag, periodStart, periodEnd): Array

Calculate node downtime

Parameters

tag

String

downtime tag

periodStart

Integer

Unix timestamp of the period start

periodEnd

Integer

Unix timestamp of the period end

Return

Array of DowntimeInfo objects.

clearGeoLocation(): void

Clears GeoLocation data from the node

createUserAgentNotification(message, startTime, endTime, showOnStartup): int

Send user agent notification

Parameters

message

String

message to be sent

startTime

String

start time of message delivery

endTime

String

end time of message delivery

showOnStartup

String

TRUE to show message on startup (optional, defaults to false)

Return

Message id

delete(): void

Deletes current object.

deleteCustomAttribute(name): void

Delete custom attribute.

Parameters

name

String

Name of the attribute to delete.

enterMaintenance(): void

Enable maintenance mode for the object.

expandString(string): String

Expand string by replacing macros with their values.

Parameters

string

String

String to expand

Return

Formated string

>>> $node.expandString("%n")
My node name
getCustomAttribute(name): String

Returns value of the custom attribute with the provided name.

Parameters

name

String

Name of the attribute to get value from.

Alternatively, attributes can be accessed as instance attribues (with ., attribute should exist) or by using attribute@object notion (which will return null instead of runtime error if attribue is missing).

getResponsibleUsers(tag) ⇒ array

Returns list of responsible users with specific tag. Full list is acceessible via .responsibleUsers

List of allowed tags are controlled by server parameter "Objects.ResponsibleUsers.AllowedTags".

Parameters

level

String

Tag

Return

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

This function return empty list if no users or groups are found for the tag.

isChild(object): bool

If provided object is child of this object

Parameters

object

NetObj

Object to check

Return

TRUE if provided object is child of this object

isDirectChild(object): bool

If provided object is direct child of this object

Parameters

object

NetObj

Object to check

Return

TRUE if provided object is direct child of this object

isDirectParent(object): bool

If provided object is direct parent of this object

Parameters

object

NetObj

Object to check

Return

TRUE if provided object is direct parent of this object

isParent(object): bool

If provided object is parent of this object

Parameters

object

NetObj

Object to check

Return

TRUE if provided object is parent of this object

leaveMaintenance(): void

Disable maintenance mode for the object.

manage(): void

Sets object to managed state. Has no affect if object already managed.

readMaintenanceJournal(startTime, endTime): Array

Read maintenance entries

Parameters

startTime

Integer

Period start

endTime

Integer

Period end

Return

Array with MaintenanceJournalRecord objects

rename(name): void

Rename object.

Parameters

name

String

New object name

setAlias(name): void

Set object alias name

Parameters

name

String

New alias name

setCategory(idOrName): void

Set object category id or name (used to get object display image)

Parameters

idOrName

String

ID or name of category

setComments(comment, [isMarkdown]): void

Set object comments

Parameters

comment

String

Comment to be set

isMarkdown

Boolean

Optional second argument ( v 5.1.2 ). If it is logical "true", Markdown indicator will be added if not present already; if it is logical "false" (but not NULL), Markdown indicator will be removed if present; if it is NULL or omitted, comment will be set as is (retaining existing behavior).

setCustomAttribute(key, value, inherit=false): void

Update or create custom attribute with the given key and value.

Parameters

key

String

Attribute key

value

String

Attribute value

inherit

Boolean

Optional parameter. If not set - inheritance will not be changed. true to inherit, false not to inherit.

setGeoLocation(newLocation): void

Sets node geographical location.

Parameters

newLocation

GeoLocation

setMapImage(image): void

Sets object image, that will be used to display object on network map

Parameters

image

String

GUID or name of image from image library

setNameOnMap(name): void

Sets object’s name, that will be used to display object on network map

Parameters

name

String

New object’s name on map

setStatusCalculation(type, …​): void

Sets status calculation method.

Parameters

type

Integer

Status calculation type. One of Status callculation types

…​

Integer(s)

If single threshold or multiple thresholds type is selected, then threshold or thresholds in percentage should be provided as next parameters.

setStatusPropagation(type, …​): void

Sets status propagation method.

Parameters

type

Integer

Status propagation type. One of Status propagation types

…​

Integer(s)

For fixed value type - value (Object status codes) should be provided. For relative - offset should be provided. For severity - severity mapping should be provided (4 numbers Object status codes).

unbind(object): void

Unbind provided object from the current object.

Parameters

object

NetObj

Object to unbind from the current object.

unbindFrom(object): void

Unbind current object from the provided object.

Parameters

object

NetObj

Object to unbind from the current object.

unmanage(): void

Set object into unmanaged state. Has no effect if object is already in unmanaged state.

writeMaintenanceJournal(description): void

Add entry to maintenance journal

Parameters

description

String

Message to be added

Constants

Object Types
Code Description

0

Generic

1

Subnet

2

Node

3

Interface

4

Network

5

Container

6

Zone

7

Service Root

8

Template

9

Template Group

10

Template Root

11

Network Service

12

VPN Connector

13

Condition

14

Cluster

15

Business Service Prototype

16

Asset

17

Asset Group

18

Asset Root

19

Network Map Root

20

Network Map Group

21

Network Map

22

Dashboard Root

23

Dashboard

27

Business Service Root

28

Business Service

29

Collector

31

Mobile Device

32

Rack

33

Access Point

34

Wireless Domain

35

Chassis

36

Dashboard Group

37

Sensor

Status callculation types
Code Description

0

Default

1

Most critical

2

Single threshold

3

Multiple thresholds

Status propagation types
Code Description

0

Default

1

Unchanged

2

Fixed

3

Relative

4

Translated

Status propagation types
Code Description

0

Default

1

Unchanged

2

Fixed

3

Relative

4

Translated

DataCollectionTarget

Abstract class that represents any object that can collect data. Extends NetObj.

Instance attributes

templates: Array

Returns array of templates (Template) applied on this object. Return value also affected by trusted nodes settings.

// Log names and ids of all accessible templates for current node
templates = $node.templates;
foreach(t : templates)
{
	trace(1, "Template object: name='" .. t.name .. "' id=" .. t.id);
}

Instance methods

applyTemplate(template): void

Apply template to node

Parameters

template

Template

Template object to apply

enableConfigurationPolling(flag): void

Enable or disable configuration polling for a node

Parameters

flag

Boolean

If configuration polling should be enabled.

enableDataCollection(flag): void

Enable or disable data collection polling for a node.

Parameters

flag

Boolean

If data collection polls should be enabled.

enableStatusPolling(flag): void

Enable or disable status polling for a node.

Parameters

flag

Boolean

If status polls should be enabled.

readInternalParameter(name): String

Reads object internal metric (metric with source "Internal").

Parameters

name

String

Metric name.

readInternalTable(name): String

Reads object internal table metric (metric with source "Internal").

Parameters

name

String

Metric name.

removeTemplate(template): void

Remove template from node

Parameters

template

Template

Template object to remove

Network Objects

Classes representing network infrastructure: nodes, interfaces, subnets, zones, and wireless components.

Node

Represents NetXMS node object. Extends DataCollectionTarget.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

Inherited from DataCollectionTarget
templates: Array

Returns array of templates (Template) applied on this object. Return value also affected by trusted nodes settings.

agentCertificateMappingData: String

Agent certificate mapping data (set in object properties).

agentCertificateMappingMethod: String

Agent certificate mapping method (set in object properties).

agentCertificateSubject: String

Subject of certificate issued for agent tunnel on this node.

agentId: String

NetXMS agent unique ID (string representation of GUID). Will return all zeroes GUID if agent is not detected on node or does not have unique ID.

agentProxy ⇒ Node

Object that is set as agent proxy in object properties or NULL.

agentVersion: String

NetXMS agent version as string.

bootTime: int64

UNIX time (number of seconds since epoch) of the moment when node was started or 0 if unknown.

bridgeBaseAddress: String

Base address of the switch formatted as 12 character string without separators. Value is only valid for bridges and switches. Special value 000000000000 indicates that address is unknown.

capabilities: int

Detected node capabilities ("Have Agent", "Support SNMP", etc.) Bitwise AND of Node capability flags constants.

cipDeviceType: int

EtherNet/IP device type

cipDeviceTypeAsText: String

EtherNet/IP device type as text

cipExtendedStatus: int

EtherNet/IP device extended status

cipExtendedStatusAsText: String

EtherNet/IP device extended status as text

cipState: int

EtherNet/IP device state

cipStateAsText: String

EtherNet/IP device state as text

cipStatus: int

EtherNet/IP device status

cipStatusAsText: String

EtherNet/IP device status as text

cipVendorCode: int

EtherNet/IP vendor code in numeric form.

cluster ⇒ Cluster

Cluster this node is in.

components ⇒ Component

Entity MIB components of class Component.

dependentNodes: Array

Will return array with NodeDependency class objects. This array contains all objects that have current node as a proxy or data collection sources.

downSince: int64

UNIX timestamp when node went down.

driver: String

Named of selected device-specific SNMP driver.

expectedCapabilities: int

Expected capabilities mask for the node. Bitwise AND of Node capability flags constants.

effectiveAgentProxy ⇒ Node

Object that is effective agent proxy or NULL.

effectiveIcmpProxy ⇒ Node

Object that is effective ICMP proxy or NULL.

effectiveSnmpProxy ⇒ Node

Object that is effective SNMP proxy or NULL.

flags: int

Bit mask of Node flags.

hardwareComponents: Array

Returns an array of available hardware of class HardwareComponent.

hardwareId: String

Nodes' unique hardware id

hasAgentIfXCounters: bool

TRUE if agent supports 64-bit interface counters.

hasEntityMIB: bool

TRUE if supports ENTITY-MIB.

hasServiceManager: bool

TRUE if node has service manager accessible via NetXMS agent.

hasIfXTable: bool

TRUE if supports ifXTable via SNMP (64-bit counters for interface statistics).

hasUserAgent: bool

TRUE if has user agent

hasVLANs: bool

TRUE if VLAN information available.

hasWinPDH: bool

TRUE if node supports Windows PDH parameters.

hypervisorInfo: String

Additional information about hypervisor for this node.

hypervisorType: String

Hypervisor type as string (usually hypervisor vendor or product name, like VMWare or XEN).

icmpAverageRTT: int

ICMP average response time for primary address. Will return null if no information.

icmpLastRTT: int

ICMP last response time for primary address. Will return null if no information.

icmpMaxRTT: int

ICMP maximal response time for primary address. Will return null if no information.

icmpMinRTT: int

ICMP minimal response time for primary address. Will return null if no information.

icmpPacketLoss: int

ICMP packet loss for primary address. Will return null if no information.

icmpProxy ⇒ Node

Object that is set as ICMP proxy in object properties or NULL.

interfaces: Array

Array with Interface objects, that are under this node. First object placed at index 0.

is802_1x: bool

TRUE if node supports 802.1x. Equivalent of isPAE.

isAgent: bool

TRUE if NetXMS agent detected on node

isBridge: bool

TRUE if node is a bridge

isCDP: bool

TRUE if node supports CDP (Cisco Discovery Protocol)

isDecommissioned: bool

TRUE if node is decommissioned.

isEtherNetIP: bool

TRUE if node supports EtherNet/IP (Industrial Protocol)

isExternalGateway: bool

TRUE if node is an external gateway (remotely managed node). Alias: isRemotelyManaged.

isInMaintenanceMode: bool

TRUE if node is in maintenance mode

isLLDP: bool

TRUE if node supports LLDP (Link Layer Discovery Protocol)

isLocalManagement: bool

TRUE if node is a local management server (NetXMS server)

isLocalMgmt: bool

TRUE if node is a local management server (NetXMS server)

isModbusTCP: bool

TRUE if node supports Modbus TCP

isNativeAgent: bool

TRUE if node is a native agent.

isNDP: bool

TRUE if node supports OSPF/NDP. Equivalent of isOSPF.

isOSPF: bool

TRUE if node supports OSPF/NDP. Equivalent of isNDP.

isPAE: bool

TRUE if node supports 802.1x. Equivalent of is802_1x.

isPrinter: bool

TRUE if node is a printer

isProfiNet: bool

TRUE if node supports PROFINET (Process Field Network)

isRouter: bool

TRUE if node is a router (has IP forwarding enabled)

isSMCLP: bool

TRUE if node supports SMCLP (Server Management Command Line Protocol)

isSNMP: bool

TRUE if SNMP agent detected on node

isSONMP: bool

TRUE if node supports SONMP/NDP (Synoptics/Nortel Discovery Protocol)

isSSH: bool

TRUE if SSH is connection available

isSSHCommandChannelAvailable: bool

TRUE if SSH command channel can be established to this node.

isSSHInteractiveChannelAvailable: bool

TRUE if SSH interactive (shell) channel can be established to this node.

isSTP: bool

TRUE if node supports STP (Spanning Tree Protocol)

isVirtual: bool

TRUE if node is virtual

isVRRP: bool

TURE if VRRP supported.

isWirelessAP: bool

TURE if node is wireless access point

isWirelessController: bool

TURE if node is wireless controller

lastAgentCommTime: int

Unix timestamp of last time when communication with agent was

modbusProxy ⇒ Node

MODBUS proxy object

modbusProxyId: int

MODBUS proxy object id

modbusTCPPort: int

MODBUS TCP port

modbusUnitId: int

MODBUS unit id

networkPathCheckResult ⇒ NetworkPathCheckResult

Node network path

nodeSubType: String

Node sub type

nodeType: int

Node type Node types

ospfAreas ⇒ OSPFArea

Returns OSPFArea class object

ospfNeighbors: Array

Array with OSPFArea class objects

ospfRouterId: String

OSPF router ID

physicalContainer ⇒ Object

Physical container object: Rack NetObj or Chassis Chassis

physicalContainerId: int

Physical container object id (Rack or Chassis)

platformName: String

Platform name reported by NetXMS agent

pollCountForStatusChange: int

Number of polls required before registering a status change.

primaryHostName: String

Primary host name

productCode: String

Hardware system property - product code

productName: String

Hardware system property - product name

productVersion: String

Hardware system property - product version

rack ⇒ NetObj

Will return Rack object as NetObj if node is added in rack

rackHeight: int

Object height in rack

rackId: int

Will return Rack id if node is added in rack

rackPosition: int

Object position in rack

runtimeFlags: int

Bit mask of Node runtime flags, uint32.

serialNumber: String

Serial number from hardware system property

snmpOID: String

SNMP object identifier (result of 1.3.6.1.2.1.1.2.0 request)

snmpProxy ⇒ Node

Object that is set as SNMP proxy in object properties or NULL.

snmpProxyId: int

SNMP proxy object id.

snmpSysContact: String

SNMP system contact (result of 1.3.6.1.2.1.1.4.0 request)

snmpSysLocation: String

SNMP system location (result of 1.3.6.1.2.1.1.6.0 request)

snmpSysName: String

SNMP system name (result of 1.3.6.1.2.1.1.5.0 request)

snmpVersion: int

Configured SNMP version:

  • 0: SNMP version 1

  • 1: SNMP version 2c

  • 2: SNMP version 3

softwarePackages: Array

Returns array of SoftwarePackage class objects

sysDescription: String

System description (value of System.Uname for nodes with agents or 1.3.6.1.2.1.1.1.0 for SNMP nodes)

tunnel ⇒ Tunnel

Tunnel object f this node or NULL if there is no tunnel active and bound to this node.

vendor: String

Hardware vendor information

vlans: Array

Array with object VLAN objects (null if there are no VLANs)

wirelessDomain ⇒ WirelessDomain

Wireless domain of this node

wirelessDomainId: int

Wireless domain id of this node

wirelessStations: Array

Array with object WirelessStation objects (null if there are no Wireless Stations)

zone ⇒ Zone

Zone object (null if zoning is disabled)

zoneProxyAssignments: int

Number of objects where this node is selected as either primary or backup zone proxy (0 if zoning is disabled or this node is not a zone proxy).

zoneProxyStatus: bool

Status of this node as zone proxy (true if active).

zoneUIN: int

This node zone UIN

Instance methods

Inherited methods from NetObj
bind(childObject): void

Bind childObject to the current object as a child.

bindTo(parentObject): void

Bind current object to parentObject as a child.

calculateDowntime(tag, periodStart, periodEnd): Array

Calculate node downtime. Returns array of DowntimeInfo objects.

clearGeoLocation(): void

Clears GeoLocation data from the node.

createUserAgentNotification(message, startTime, endTime, showOnStartup): int

Send user agent notification. Returns message id.

delete(): void

Deletes current object.

deleteCustomAttribute(name): void

Delete custom attribute.

enterMaintenance(): void

Enable maintenance mode for the object.

expandString(string): String

Expand string by replacing macros with their values.

getCustomAttribute(name): String

Returns value of the custom attribute with the provided name.

getResponsibleUsers(tag) ⇒ array

Returns list of responsible users with specific tag.

isChild(object): bool

Returns TRUE if provided object is child of this object.

isDirectChild(object): bool

Returns TRUE if provided object is direct child of this object.

isDirectParent(object): bool

Returns TRUE if provided object is direct parent of this object.

isParent(object): bool

Returns TRUE if provided object is parent of this object.

leaveMaintenance(): void

Disable maintenance mode for the object.

manage(): void

Sets object to managed state.

readMaintenanceJournal(startTime, endTime): Array

Read maintenance entries. Returns array of MaintenanceJournalRecord objects.

rename(name): void

Rename object.

setAlias(name): void

Set object alias name.

setCategory(idOrName): void

Set object category id or name.

setComments(comment, [isMarkdown]): void

Set object comments.

setCustomAttribute(key, value, inherit=false): void

Update or create custom attribute.

setGeoLocation(newLocation): void

Sets node geographical location.

setMapImage(image): void

Sets object image for network map display.

setNameOnMap(name): void

Sets object’s name for network map display.

setStatusCalculation(type, …​): void

Sets status calculation method.

setStatusPropagation(type, …​): void

Sets status propagation method.

unbind(object): void

Unbind provided object from the current object.

unbindFrom(object): void

Unbind current object from the provided object.

unmanage(): void

Set object into unmanaged state.

writeMaintenanceJournal(description): void

Add entry to maintenance journal.

Inherited methods from DataCollectionTarget
applyTemplate(template): void

Apply template to node.

enableConfigurationPolling(flag): void

Enable or disable configuration polling.

enableDataCollection(flag): void

Enable or disable data collection polling.

enableStatusPolling(flag): void

Enable or disable status polling.

readInternalParameter(name): String

Reads object internal metric (metric with source "Internal").

readInternalTable(name): String

Reads object internal table metric (metric with source "Internal").

removeTemplate(template): void

Remove template from node.

callWebService(webSvcName, requestType, …​) ⇒ WebServiceResponse

Finds web service by name, makes request and returns the WebServiceResponse object.

Parameters

webSvcName

String

Web service name.

requestType

String

Request type. One of: GET, DELETE, PATCH, POST, PUT

data

String or JsonObject

Depending on request type data might be required and provided as a string or JSON object. GET and DELETE requests do not allow data, PATCH, POST, PUT require data.

contentType

String

Optional parameter, for PATCH, POST and PUT requests only. Type of provided data that will be set to "Content-Type" header of request. Default type is "application/json".

acceptCached

Boolean

Optional named parameter. If True, response stored in agent’s cache will be used. Default: false.

…​

Strings

Optional additional parameter(s) that will be used in web service definition to expand %1, %2…​ macro.

Return

Instance of WebServiceResponse with request result.

// Valid example when request fails because there is no connection to agent
result = $node.callWebService("Web service name", "GET", "additional/ult/path");
println(result.success); // "false"
println(result.errorMessage); // "No connection with agent"
println(result.agentErrorCode); // "0"
println(result.httpResponseCode); // "0"
println(result.document); // ""

// Successful post request
result = $node.callWebService("Web service name", "POST", "{ \"id\":10 }", "application/json", "additional/ult/path");
println(result.success); // "true"
println(result.errorMessage); // ""
println(result.agentErrorCode); // "0"
println(result.httpResponseCode); // "200"
println(result.document); // ""

// Get requests
result = $node.callWebService("Web service name", "GET", "additional", "parameters");
result = $node.callWebService("Web service name", "GET", acceptCached: true, "additional", "parameters);
createSNMPTransport(port, community, context, failIfUnreachable) ⇒ SNMPTransport

Create SNMP transport object of class SNMPTransport with communication settings defined on the node. It is possible to specify a community string but only community strings listed in Network Credentials will be accepted. Creation of SNMP transport is a preparatory operation enabling subsequent sending of SNMP requests to node. However, creation of SNMP transport does not guarantee that the node is accessible.

Parameters

port

Integer

Optional parameter with port.

community

String

Optional parameter with community string.

context

String

Optional parameter with context.

failIfUnreachable

String

Optional parameter, is provided and is true, check that SNMP is reachable on the node before creating SNMP transport.

Added in version 4.4.1: failIfUnreachable parameter

Return

Instance of SNMPTransport or null if failed or node was not reacheable when failIfUnreachable was set to true.

enable8021xStatusPolling(flag): void

Enable or disable 802.1x port state checking during status polls.

Parameters

flag

Boolean

If 802.1x port state checking should be enabled.

enableAgent(flag): void

Enable or disable usage of NetXMS agent for all polls.

Parameters

flag

Boolean

If agent usage should be enabled.

enableDiscoveryPolling(flag): void

Enable or disable discovery polling.

Parameters

flag

Boolean

If discovery polling should be enabled.

enableEtherNetIP(flag): void

Enable or disable usage of EtherNet/IP for polls.

Parameters

flag

Boolean

If EtherNet/IP should be enabled.

enableIcmp(flag): void

Enable or disable usage of ICMP pings for status polls.

Parameters

flag

Boolean

If ICMP pings should be enabled.

enableModbusTcp(flag): void

Enable or disable usage of Modbus TCP for polls.

Parameters

flag

Boolean

If Modbus TCP should be enabled.

enablePrimaryIPPing(flag): void

Enable or disable usage of ICMP ping for primary IP.

Parameters

flag

Boolean

If primary IP ping should be enabled.

enableRoutingTablePolling(flag): void

Enable or disable routing table polling.

Parameters

flag

Boolean

If routing table polls should be enabled.

enableSnmp(flag): void

Enable or disable usage of SNMP for all polls.

Parameters

flag

Boolean

If SNMP communication should be enabled.

enableSmclpPropertyPolling(flag): void

Enable or disable reading of SM-CLP available properties metadata during configuration poll.

Parameters

flag

Boolean

If 802.1x port state checking should be enabled.

enableSsh(flag): void

Enable or disable usage of SSH

Parameters

flag

Boolean

If SSH communication should be enabled.

enableTopologyPolling(flag): void

Enable or disable topology polling.

Parameters

flag

Boolean

If topology polls should be enabled.

enableVnc(flag): void

Enable or disable VNC detection on the node during configuration poll.

Parameters

flag

Boolean

If VNC detection should be enabled.

enableWinPerfCountersCache(flag): void

Enable or disable reading of Windows performance counters metadata during configuration poll.

Parameters

flag

Boolean

If reading of Windows performance counters metadata should be enabled.

executeAgentCommand(command, …​): bool

Execute agent command (action) on node.

Parameters

command

String

Command to be executed.

…​

String

Optional arguments for command

Return

True if command execution is successful or false otherwise.

executeAgentCommandWithOutput(command, …​): String

Execute agent command (action) on node and return it’s output.

Parameters

command

String

Command to be executed.

…​

String

Optional arguments for command

Return

String with output of the command or null on failure.

executeSSHCommand(command) ⇒ array

Execute SSH command on node.

Parameters

command

String

Command to be executed.

Return

Array of strings with output of the command or null on failure.

getBlockedPorts(protocol): Array

Get array of blocked ports for the specified protocol.

Parameters

protocol

String

Protocol type - "tcp" or "udp"

Return

Array of integers representing blocked port numbers.

blockedTcpPorts = $node->getBlockedPorts("tcp");
foreach (port : blockedTcpPorts) {
    println("Blocked TCP port: " .. port);
}
getInstalledPackages(filter, useRegex): Array

Get array of installed packages on the node.

Parameters

filter

String

Optional package name filter

useRegex

Boolean

Optional. If TRUE, use regex matching for filter. Default is FALSE

Return

Array of installed packages on the node.

// Get all packages
packages = $node->getInstalledPackages();

// Get packages matching filter
packages = $node->getInstalledPackages("netxms", false);
getInterface(ifIdentifier) ⇒ Interface

Get interface object by index, MAC address or name. If name is number method will assume that it is index.

Parameters

ifIdentifier

Integer or String

Index, MAC address or name of interface.

Return

Interface object.

println($node.getInterface("00:14:22:04:25:37").name); // Will print "wlp4s0"
println($node.getInterface(3).name); // Will print "wlp4s0"
println($node.getInterface("wlp4s0").name); // Will print "wlp4s0"
getInterfaceByIndex(ifIndex) ⇒ Interface

Get interface object by index.

Parameters

ifIndex

Integer

Index of interface.

Return

Interface object.

println($node.getInterfaceByIndex(3).name); // Will print "wlp4s0"
getInterfaceByMACAddress(ifMACAddr) ⇒ Interface

Get interface object by MAC address.

Parameters

ifMACAddr

String

MAC address of interface.

Return

Interface object.

println($node.getInterfaceByMACAddress("00:14:22:04:25:37").name); // Will print "wlp4s0"
getInterfaceByName(IfName) ⇒ Interface

Get interface object by name.

Parameters

IfName

String

Name of interface.

Return

Interface object.

println($node.getInterfaceByName("wlp4s0").name); // Will print "wlp4s0"
getInterfaceName(ifIndex): String

Get interface name by index.

Parameters

ifIndex

Integer

Index of interface.

isPortBlocked(port, protocol): bool

Check if a specific port is blocked for the given protocol.

Parameters

port

Integer

Port number (1-65535)

protocol

String

Protocol - "tcp" or "udp"

Return

TRUE if the port is blocked, FALSE otherwise.

if ($node->isPortBlocked(22, "tcp")) {
    println("SSH port is blocked");
}
getWebService(webSvcName) ⇒ WebService

Get web service object by name.

Parameters

webSvcName

String

Name of interface.

Return

WebService object.

webSvc = $node.getWebService("webSvcName");
openSSHSession(user, password, keyId) ⇒ SSHSession

Open an interactive SSH session to this node.

Parameters

user

String

Optional SSH login username

password

String

Optional SSH password

keyId

Integer

Optional SSH key identifier

Return

SSHSession object on success, or NULL on failure.

session = $node->openSSHSession();
if (session != null && session->connected) {
    output = session->execute("ls -la");
    foreach (line : output) {
        println(line);
    }
    session->close();
}
readAgentList(name): Array

Request agent list directly from agent on given node. Returns array of strings or NULL if failed.

Parameters

name

String

List name.

readAgentParameter(name): String

Request metric directly from agent on given node. Returns NULL if failed.

Parameters

name

String

Metric name.

readAgentTable(name) ⇒ Table

Requests agent table directly from agent on given node. Returns Table or NULL if failed.

Parameters

name

String

Table name.

readDriverParameter(name): String

Request driver-specific metric from network device driver (e.g. Rital).

Parameters

name

String

List name.

readInternalParameter(name): String

Read internal parameter

Parameters

name

String

Parameter name

Return

Value of requested internal parameter

readInternalTable(name) ⇒ Table

Read internal table

Parameters

name

String

Table name

Return

Value of requested internal table of class Table

readWebServiceList(name): Array

Read list from node using web service

Parameters

name

String

Name is expected in form service:path or service(arguments):path

Return

Array with string with web service instances

readWebServiceParameter(name): String

Read from node web service parameter

Parameters

name

String

Name is expected in form service:path or service(arguments):path

Return

String with result read from web service

setExpectedCapabilities(capabilities): void

Set the expected capabilities for this node.

Parameters

capabilities

Integer

Capability flags bitmask. Only allows capability bits for: native agent, SNMP, EtherNet/IP, Modbus TCP, and SSH.

setIfXTableUsageMode(mode): void

Set ifXTable usage mode 0 - use default, 1 - enable, 2 - disable

Parameters

mode

Integer

usage mode

setPollCountForStatusChange(count): void

Set the required number of polls before registering a status change.

Parameters

count

Integer

Number of polls (must be >= 0)

Constants

Node flags
Description Value

DCF_DISABLE_STATUS_POLL

0x00000001

DCF_DISABLE_CONF_POLL

0x00000002

DCF_DISABLE_DATA_COLLECT

0x00000004

DCF_LOCATION_CHANGE_EVENT

0x00000008

NF_EXTERNAL_GATEWAY

0x00010000

NF_DISABLE_DISCOVERY_POLL

0x00020000

NF_DISABLE_TOPOLOGY_POLL

0x00040000

NF_DISABLE_SNMP

0x00080000

NF_DISABLE_NXCP

0x00100000

NF_DISABLE_ICMP

0x00200000

NF_FORCE_ENCRYPTION

0x00400000

NF_DISABLE_ROUTE_POLL

0x00800000

NF_AGENT_OVER_TUNNEL_ONLY

0x01000000

NF_SNMP_SETTINGS_LOCKED

0x02000000

NF_PING_PRIMARY_IP

0x04000000

NF_DISABLE_ETHERNET_IP

0x08000000

NF_DISABLE_PERF_COUNT

0x10000000

Node runtime flags
Description Value

DCDF_QUEUED_FOR_STATUS_POLL

0x00000001

DCDF_QUEUED_FOR_CONFIGURATION_POLL

0x00000002

DCDF_QUEUED_FOR_INSTANCE_POLL

0x00000004

DCDF_DELETE_IN_PROGRESS

0x00000008

DCDF_FORCE_STATUS_POLL

0x00000010

DCDF_FORCE_CONFIGURATION_POLL

0x00000020

DCDF_CONFIGURATION_POLL_PASSED

0x00000040

DCDF_CONFIGURATION_POLL_PENDING

0x00000080

NDF_QUEUED_FOR_TOPOLOGY_POLL

0x00010000

NDF_QUEUED_FOR_DISCOVERY_POLL

0x00020000

NDF_QUEUED_FOR_ROUTE_POLL

0x00040000

NDF_RECHECK_CAPABILITIES

0x00080000

NDF_NEW_TUNNEL_BIND

0x00100000

Node capability flags
Value Description

0x00000001

Node supports SNMP

0x00000002

NetXMS agent detected on the node

0x00000004

Node is network bridge

0x00000008

Node is IP router

0x00000010

Node is management server (NetXMS server itself)

0x00000020

Node is printer

0x00000040

Node supports OSPF

0x00000080

CheckPoint SNMP agent detected on port 260

0x00000100

CDP supported

0x00000200

NDP(SONMP) support detected on the node (Nortel/Synoptics/Bay Networks) topology discovery)

0x00000400

Node supports LLDP

0x00000800

Node supportes VRRP

0x00001000

VLAN information available on the node

0x00002000

802.1x support detected

0x00004000

Spanning Tree (IEEE 802.1d) enabled on node

0x00008000

Node supports ENTITY-MIB

0x00010000

Node supports ifXTable via SNMP (64-bit counters for interface statistics)

0x00020000

Agent supports 64-bit interface counters

0x00040000

Node supports Windows PDH parameters

0x00080000

Node is wireless network controller

0x00100000

Node supports SMCLP protocol

0x00200000

Running agent is upgraded to new policy type

0x00400000

User (support) agent is installed

Node types
Value Description

0

Unknown

1

Physical

2

Virtual

3

Controller

4

Container

Interface

Represent interface object. Extends NetObj.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

adminState: int

Administrative state of the interface.

bridgePortNumber: int

Bridge port number for this interface.

chassis ⇒ Chassis

Parent Chassis

description: String

Interface description

dot1xBackendAuthState: int

802.1x back-end authentication state

dot1xPaeAuthState: int

802.1x PAE authentication state

expectedState: int

Expected state of the interface.

flags: int

Interface flags (bit mask, uint32).

icmpAverageRTT: int

ICMP average response time for current interface. Will return null if no information.

icmpLastRTT: int

ICMP last response time for current interface. Will return null if no information.

icmpMaxRTT: int

ICMP maximal response time for current interface. Will return null if no information.

icmpMinRTT: int

ICMP minimal response time for current interface. Will return null if no information.

icmpPacketLoss: int

ICMP packet loss for current interface. Will return null if no information.

ifAlias: String

Interface alias

ifIndex: int

Interface index.

ifName: String

Interface name obtained from object.

ifType: int

Interface type

inboundUtilization: int

Inbound utilization

ipAddressList: Array

Array with InetAddress objects, that represent all addresses that has this interface has

isExcludedFromTopology: bool

TRUE if this interface excluded from network topology

isIncludedInIcmpPoll: bool

TRUE if this interface is included in ICMP statistics

isLoopback: bool

TRUE if this interface is a loopback

isManuallyCreated: bool

TRUE if this interface object was created manually by NetXMS administrator

isOSPF: bool

TRUE if this interface is OSPF

isPhysicalPort: bool

TRUE if this interface object represents physical port

macAddress: String

String representation of MAC address separated by ":".

module: int

Module

mtu: int

Interface MTU (0 if unknown).

node ⇒ Node

Parent node object

operState: int

Operational state.

ospfAreaId: String

OSPF area ID

ospfState: int

OSPF state

ospfStateText: String

OSPF state as a text

ospfType: int

OSPF type

ospfTypeText: String

OSPF type as s text

outboundUtilization: int

Outbound utilization

peerInterface ⇒ Interface

Peer interface object if known, otherwise null.

peerLastUpdateTime: int

Unix timestamp of the last peer update.

peerNode ⇒ Node

Peer node object if known, otherwise null.

pollCountForStatusChange: int

Number of polls required before registering a status change.

pic: int

Phisical location.

port: int

Port number.

speed: int64

Speed of the interface.

stpState: int

Spaning tree port state of the interface.

stpStateText: String

Spaning tree port state of the interface as a text.

vlans: Array

Array with this inteface vlan objects

zone ⇒ Zone

Zone object (null if zoning is disabled).

zoneUIN: int

Zone UIN of this interface.

Instance methods

Inherited methods from NetObj
bind(childObject): void

Bind childObject to the current object as a child.

bindTo(parentObject): void

Bind current object to parentObject as a child.

calculateDowntime(tag, periodStart, periodEnd): Array

Calculate node downtime. Returns array of DowntimeInfo objects.

clearGeoLocation(): void

Clears GeoLocation data from the node.

createUserAgentNotification(message, startTime, endTime, showOnStartup): int

Send user agent notification. Returns message id.

delete(): void

Deletes current object.

deleteCustomAttribute(name): void

Delete custom attribute.

enterMaintenance(): void

Enable maintenance mode for the object.

expandString(string): String

Expand string by replacing macros with their values.

getCustomAttribute(name): String

Returns value of the custom attribute with the provided name.

getResponsibleUsers(tag) ⇒ array

Returns list of responsible users with specific tag.

isChild(object): bool

Returns TRUE if provided object is child of this object.

isDirectChild(object): bool

Returns TRUE if provided object is direct child of this object.

isDirectParent(object): bool

Returns TRUE if provided object is direct parent of this object.

isParent(object): bool

Returns TRUE if provided object is parent of this object.

leaveMaintenance(): void

Disable maintenance mode for the object.

manage(): void

Sets object to managed state.

readMaintenanceJournal(startTime, endTime): Array

Read maintenance entries. Returns array of MaintenanceJournalRecord objects.

rename(name): void

Rename object.

setAlias(name): void

Set object alias name.

setCategory(idOrName): void

Set object category id or name.

setComments(comment, [isMarkdown]): void

Set object comments.

setCustomAttribute(key, value, inherit=false): void

Update or create custom attribute.

setGeoLocation(newLocation): void

Sets node geographical location.

setMapImage(image): void

Sets object image for network map display.

setNameOnMap(name): void

Sets object’s name for network map display.

setStatusCalculation(type, …​): void

Sets status calculation method.

setStatusPropagation(type, …​): void

Sets status propagation method.

unbind(object): void

Unbind provided object from the current object.

unbindFrom(object): void

Unbind current object from the provided object.

unmanage(): void

Set object into unmanaged state.

writeMaintenanceJournal(description): void

Add entry to maintenance journal.

clearPeer(enabled): void

Clears peer information for interface.

enableAgentStatusPolling(enabled): void

Enable\disable agent status polling for this interface

Parameters

enabled

Boolean

TRUE if interface should be status polled by NetXMS agent

enableICMPStatusPolling(enabled): void

Enable\disable ICMP status polling for this interface

Parameters

enabled

Boolean

TRUE if interface should be status polled by ICMP

enableSNMPStatusPolling(enabled): void

Enable\disable SNMP status polling for this interface

Parameters

enabled

Boolean

TRUE if interface should be status polled by SNMP

setExcludeFromTopology(excluded): void

Change isExcludedFromTopology flag.

Parameters

excluded

Boolean

TRUE if interface should be excluded.

setExpectedState(newState): void

Set expected state to newState.

Parameters

newState

Number

New state as defined by Interface expected states.

setIncludeInIcmpPoll(enabled): void

Enabele/Disable ICMP statistics collection for current interface.

Parameters

enabled

Boolean

If this interface should be included in ICMP statistics.

setPollCountForStatusChange(count): void

Set the required number of polls before registering a status change.

Parameters

count

Integer

Number of polls (must be >= 0)

Constants

Interface states
Code Description

0

Unknown

1

Up

2

Down

3

Testing

Interface expected states
Code Description

0

Up

1

Down

2

Ignore

Interface types
Code Type

1

IFTYPE_OTHER

2

IFTYPE_REGULAR1822

3

IFTYPE_HDH1822

4

IFTYPE_DDN_X25

5

IFTYPE_RFC877_X25

6

IFTYPE_ETHERNET_CSMACD

7

IFTYPE_ISO88023_CSMACD

8

IFTYPE_ISO88024_TOKENBUS

9

IFTYPE_ISO88025_TOKENRING

10

IFTYPE_ISO88026_MAN

11

IFTYPE_STARLAN

12

IFTYPE_PROTEON_10MBIT

13

IFTYPE_PROTEON_80MBIT

14

IFTYPE_HYPERCHANNEL

15

IFTYPE_FDDI

16

IFTYPE_LAPB

17

IFTYPE_SDLC

18

IFTYPE_DS1

19

IFTYPE_E1

20

IFTYPE_BASIC_ISDN

21

IFTYPE_PRIMARY_ISDN

22

IFTYPE_PROP_PTP_SERIAL

23

IFTYPE_PPP

24

IFTYPE_SOFTWARE_LOOPBACK

25

IFTYPE_EON

26

IFTYPE_ETHERNET_3MBIT

27

IFTYPE_NSIP

28

IFTYPE_SLIP

29

IFTYPE_ULTRA

30

IFTYPE_DS3

31

IFTYPE_SMDS

32

IFTYPE_FRAME_RELAY

33

IFTYPE_RS232

34

IFTYPE_PARA

35

IFTYPE_ARCNET

36

IFTYPE_ARCNET_PLUS

37

IFTYPE_ATM

38

IFTYPE_MIOX25

39

IFTYPE_SONET

40

IFTYPE_X25PLE

41

IFTYPE_ISO88022LLC

42

IFTYPE_LOCALTALK

43

IFTYPE_SMDS_DXI

44

IFTYPE_FRAME_RELAY_SERVICE

45

IFTYPE_V35

46

IFTYPE_HSSI

47

IFTYPE_HIPPI

48

IFTYPE_MODEM

49

IFTYPE_AAL5

50

IFTYPE_SONET_PATH

51

IFTYPE_SONET_VT

52

IFTYPE_SMDS_ICIP

53

IFTYPE_PROP_VIRTUAL

54

IFTYPE_PROP_MULTIPLEXOR

55

IFTYPE_IEEE80212

56

IFTYPE_FIBRECHANNEL

57

IFTYPE_HIPPIINTERFACE

58

IFTYPE_FRAME_RELAY_INTERCONNECT

59

IFTYPE_AFLANE8023

60

IFTYPE_AFLANE8025

61

IFTYPE_CCTEMUL

62

IFTYPE_FAST_ETHERNET

63

IFTYPE_ISDN

64

IFTYPE_V11

65

IFTYPE_V36

66

IFTYPE_G703_AT64K

67

IFTYPE_G703_AT2MB

68

IFTYPE_QLLC

69

IFTYPE_FASTETHERFX

70

IFTYPE_CHANNEL

71

IFTYPE_IEEE80211

72

IFTYPE_IBM370_PARCHAN

73

IFTYPE_ESCON

74

IFTYPE_DLSW

75

IFTYPE_ISDNS

76

IFTYPE_ISDNU

77

IFTYPE_LAPD

78

IFTYPE_IPSWITCH

79

IFTYPE_RSRB

80

IFTYPE_ATMLOGICAL

81

IFTYPE_DS0

82

IFTYPE_DS0_BUNDLE

83

IFTYPE_BSC

84

IFTYPE_ASYNC

85

IFTYPE_CNR

86

IFTYPE_ISO88025DTR

87

IFTYPE_EPLRS

88

IFTYPE_ARAP

89

IFTYPE_PROPCNLS

90

IFTYPE_HOSTPAD

91

IFTYPE_TERMPAD

92

IFTYPE_FRAME_RELAY_MPI

93

IFTYPE_X213

94

IFTYPE_ADSL

95

IFTYPE_RADSL

96

IFTYPE_SDSL

97

IFTYPE_VDSL

98

IFTYPE_ISO88025CRFPINT

99

IFTYPE_MYRINET

100

IFTYPE_VOICEEM

101

IFTYPE_VOICEFXO

102

IFTYPE_VOICEFXS

103

IFTYPE_VOICEENCAP

104

IFTYPE_VOICEOVERIP

105

IFTYPE_ATMDXI

106

IFTYPE_ATMFUNI

107

IFTYPE_ATMIMA

108

IFTYPE_PPPMULTILINKBUNDLE

109

IFTYPE_IPOVERCDLC

110

IFTYPE_IPOVERCLAW

111

IFTYPE_STACKTOSTACK

112

IFTYPE_VIRTUAL_IP_ADDRESS

113

IFTYPE_MPC

114

IFTYPE_IPOVERATM

115

IFTYPE_ISO88025FIBER

116

IFTYPE_TDLC

117

IFTYPE_GIGABIT_ETHERNET

118

IFTYPE_HDLC

119

IFTYPE_LAPF

120

IFTYPE_V37

121

IFTYPE_X25MLP

122

IFTYPE_X25_HUNT_GROUP

123

IFTYPE_TRANSPHDLC

124

IFTYPE_INTERLEAVE

125

IFTYPE_FAST

126

IFTYPE_IP

127

IFTYPE_DOCSCABLE_MACLAYER

128

IFTYPE_DOCSCABLE_DOWNSTREAM

129

IFTYPE_DOCSCABLE_UPSTREAM

130

IFTYPE_A12MPPSWITCH

131

IFTYPE_TUNNEL

132

IFTYPE_COFFEE

133

IFTYPE_CES

134

IFTYPE_ATM_SUBINTERFACE

135

IFTYPE_L2VLAN

136

IFTYPE_L3IPVLAN

137

IFTYPE_L3IPXVLAN

138

IFTYPE_DIGITAL_POWERLINE

139

IFTYPE_MEDIAMAIL_OVER_IP

140

IFTYPE_DTM

141

IFTYPE_DCN

142

IFTYPE_IPFORWARD

143

IFTYPE_MSDSL

144

IFTYPE_IEEE1394

145

IFTYPE_GSN

146

IFTYPE_DVBRCC_MACLAYER

147

IFTYPE_DVBRCC_DOWNSTREAM

148

IFTYPE_DVBRCC_UPSTREAM

149

IFTYPE_ATM_VIRTUAL

150

IFTYPE_MPLS_TUNNEL

151

IFTYPE_SRP

152

IFTYPE_VOICE_OVER_ATM

153

IFTYPE_VOICE_OVER_FRAME_RELAY

154

IFTYPE_IDSL

155

IFTYPE_COMPOSITE_LINK

156

IFTYPE_SS7_SIGLINK

157

IFTYPE_PROPWIRELESSP2P

158

IFTYPE_FRFORWARD

159

IFTYPE_RFC1483

160

IFTYPE_USB

161

IFTYPE_IEEE8023ADLAG

162

IFTYPE_BGP_POLICY_ACCOUNTING

163

IFTYPE_FRF16MFR_BUNDLE

164

IFTYPE_H323_GATEKEEPER

165

IFTYPE_H323_PROXY

166

IFTYPE_MPLS

167

IFTYPE_MFSIGLINK

168

IFTYPE_HDSL2

169

IFTYPE_SHDSL

170

IFTYPE_DS1FDL

171

IFTYPE_POS

172

IFTYPE_DVBASI_IN

173

IFTYPE_DVBASI_OUT

174

IFTYPE_PLC

175

IFTYPE_NFAS

176

IFTYPE_TR008

177

IFTYPE_GR303RDT

178

IFTYPE_GR303IDT

179

IFTYPE_ISUP

180

IFTYPE_PROPDOCSWIRELESSMACLAYER

181

IFTYPE_PROPDOCSWIRELESSDOWNSTREAM

182

IFTYPE_PROPDOCSWIRELESSUPSTREAM

183

IFTYPE_HIPERLAN2

184

IFTYPE_PROPBWAP2MP

185

IFTYPE_SONET_OVERHEAD_CHANNEL

186

IFTYPE_DW_OVERHEAD_CHANNEL

187

IFTYPE_AAL2

188

IFTYPE_RADIOMAC

189

IFTYPE_ATMRADIO

190

IFTYPE_IMT

191

IFTYPE_MVL

192

IFTYPE_REACHDSL

193

IFTYPE_FRDLCIENDPT

194

IFTYPE_ATMVCIENDPT

195

IFTYPE_OPTICAL_CHANNEL

196

IFTYPE_OPTICAL_TRANSPORT

197

IFTYPE_PROPATM

198

IFTYPE_VOICE_OVER_CABLE

199

IFTYPE_INFINIBAND

200

IFTYPE_TELINK

201

IFTYPE_Q2931

202

IFTYPE_VIRTUALTG

203

IFTYPE_SIPTG

204

IFTYPE_SIPSIG

205

IFTYPE_DOCSCABLEUPSTREAMCHANNEL

206

IFTYPE_ECONET

207

IFTYPE_PON155

208

IFTYPE_PON622

209

IFTYPE_BRIDGE

210

IFTYPE_LINEGROUP

211

IFTYPE_VOICEEMFGD

212

IFTYPE_VOICEFGDEANA

213

IFTYPE_VOICEDID

214

IFTYPE_MPEG_TRANSPORT

215

IFTYPE_SIXTOFOUR

216

IFTYPE_GTP

217

IFTYPE_PDNETHERLOOP1

218

IFTYPE_PDNETHERLOOP2

219

IFTYPE_OPTICAL_CHANNEL_GROUP

220

IFTYPE_HOMEPNA

221

IFTYPE_GFP

222

IFTYPE_CISCO_ISL_VLAN

223

IFTYPE_ACTELIS_METALOOP

224

IFTYPE_FCIPLINK

225

IFTYPE_RPR

226

IFTYPE_QAM

227

IFTYPE_LMP

228

IFTYPE_CBLVECTASTAR

229

IFTYPE_DOCSCABLEMCMTSDOWNSTREAM

230

IFTYPE_ADSL2

231

IFTYPE_MACSECCONTROLLEDIF

232

IFTYPE_MACSECUNCONTROLLEDIF

233

IFTYPE_AVICIOPTICALETHER

234

IFTYPE_ATM_BOND

235

IFTYPE_VOICEFGDOS

236

IFTYPE_MOCA_VERSION1

237

IFTYPE_IEEE80216WMAN

238

IFTYPE_ADSL2PLUS

239

IFTYPE_DVBRCSMACLAYER

240

IFTYPE_DVBTDM

241

IFTYPE_DVBRCSTDMA

242

IFTYPE_X86LAPS

243

IFTYPE_WWANPP

244

IFTYPE_WWANPP2

245

IFTYPE_VOICEEBS

246

IFTYPE_IFPWTYPE

247

IFTYPE_ILAN

248

IFTYPE_PIP

249

IFTYPE_ALUELP

250

IFTYPE_GPON

251

IFTYPE_VDSL2

252

IFTYPE_CAPWAP_DOT11_PROFILE

253

IFTYPE_CAPWAP_DOT11_BSS

254

IFTYPE_CAPWAP_WTP_VIRTUAL_RADIO

255

IFTYPE_BITS

256

IFTYPE_DOCSCABLEUPSTREAMRFPORT

257

IFTYPE_CABLEDOWNSTREAMRFPORT

258

IFTYPE_VMWARE_VIRTUAL_NIC

259

IFTYPE_IEEE802154

260

IFTYPE_OTNODU

261

IFTYPE_OTNOTU

262

IFTYPE_IFVFITYPE

263

IFTYPE_G9981

264

IFTYPE_G9982

265

IFTYPE_G9983

266

IFTYPE_ALUEPON

267

IFTYPE_ALUEPONONU

268

IFTYPE_ALUEPONPHYSICALUNI

269

IFTYPE_ALUEPONLOGICALLINK

270

IFTYPE_ALUGPONONU

271

IFTYPE_ALUGPONPHYSICALUNI

272

IFTYPE_VMWARE_NIC_TEAM

Interface spanning tree port states
Code Description

0

UNKNOWN

1

DISABLED

2

BLOCKING

3

LISTENING

4

LEARNING

5

FORWARDING

6

BROKEN

Subnet

Object represents subnet. Extends NetObj.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

ipNetMask: int

Subnet mask

isSyntheticMask: bool

TRUE is mask is synthetic

zone ⇒ Zone

Zone object (null if zoning is disabled)

zoneUIN: int

This subnet zone UIN

Zone

Represents network zone. Extends NetObj.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

proxyNodes: Array<Node>

Array of Node objects that are currently set as proxies for this zone.

proxyNodeIds: Array<Integer>

Array of integers representing identifiers of node objects that are currently set as proxies for this zone.

uin: int

Zone UIN (Unique Identification Number).

AccessPoint

Represents NetXMS access point object.

Instance attributes

apState: String

State from Access point state

controller ⇒ Node

Acess point controller of class Node.

controllerId: int

Acess point controller object id.

downSince: int

UNIX epoch timestamp down since.

index: int

Index

macAddress: String

Mac address

model: String

Model

peerInterface ⇒ Interface

Peer interface of class Interface

peerNode ⇒ Node

Peer interface of class Node

radioInterfaces ⇒ RadioInterface

Radio interface of class RadioInterface

serialNumber: String

Serial number

vendor: String

Vendor

wirelessDomain ⇒ WirelessDomain

Wireless domain of class WirelessDomain

wirelessDomainId: int

Wireless domain id

wirelessStations: String

Wireless station of class WirelessStation

Constants

Access point state
Description Value

AP_UP

0

AP_UNPROVISIONED

1

AP_DOWN

2

AP_UNKNOWN

3

WirelessDomain

Class represents wireless domain

Instance attributes

apCountDown: int

Number of access points in 'Down' state

apCountUnknown: int

Number of access points in 'Unknown' state

apCountUnprovisioned: int

Number of access points in 'Unprovisioned' state

apCountUp: int

Number of access points in 'Up' state

WirelessStation

Class represents wireless station

Instance attributes

accessPointId: int

Access point object id

bssid: String

Basic Service Set Identifier

ipAddress ⇒ InetAddress

IP address.

macAddress: String

MAC address

rfIndex: int

Radio interface index

rfName: String

Radio interface name

rssi: int

RSSI for this station

rxRate: int

Radio interface rate

signalStrength: int

Signal streight

ssid: String

Service Set Identifier

txRate: int

Tx rate

vlan: int

Vlan

VLAN

Represents VLAN object.

Instance attributes

id: int

VLAN id.

name: String

VLAN name.

interfaces: Array

Interfaces in that VLAN (array of objects of class Interface).

Circuit

Object represents circuit. Extends DataCollectionTarget.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

Inherited from DataCollectionTarget
templates: Array

Returns array of templates (Template) applied on this object. Return value also affected by trusted nodes settings.

autoBindScript: String

Source of the script for automatic binding

interfaces: Array

Array with node’s DiscoveredInterface

isAutoBindEnabled: bool

Indicate if automatic binding is enabled.

isAutoUnbindEnabled: bool

Indicate if automatic unbinding is enabled.

NetworkMap

Class represents Network Map. Extends NetObj.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

backgroundColor: int

Background color in css format Network map link color source.

backgroundImageId: int

Image library GUID.

backgroundLatitude: float

Background latitude as floating point number GeoLocation.

backgroundLongitude: float

Background longitude as floating point number GeoLocation.

backgroundZoom: int

Background zoom.

defaultLinkColor: int

Default link color Network map link color source.

defaultLinkRouting: int

Default link routing Network map link routing algorithm.

defaultLinkStyle: int

Default link style Network map link style.

defaultLinkWidth: int

Default link witdh NetworkMapLink.

discoveryRadius: int

Discovery radius User.

height: int

Height.

isUpdateFailed: bool

Update fail check.

layout: int

Layout.

mapType: int

Map type.

objectDisplayMode: int

Object display mode.

seedObjects: Array

Seed objects

width: int

Width.

Class represents Network Map link

Instance attributes

Instance methods

Tunnel

Object contains information about tunnel.

Instance attributes

address ⇒ InetAddress

InetAddress class object with address of the node that opened this tunnel

agentBuildTag: String

Agent build tag

agentId: String

Agent ID of the agent that opened the tunnel

agentVersion: String

Agent version of the node that opened the tunnel

certificateExpirationTime: int

UNIX timestamp with current certificate expiration day

guid: String

Tunnel GUID

hostname: String

Hostname of the node that opened the tunnel

hardwareId: String

Hardware ID of the node that opened the tunnel

id: int

Tunnel id

isAgentProxy: bool

TRUE if agent proxy is enabled on the agent that opened the tunnel

isBound: bool

TRUE if tunnel is bound

isSnmpProxy: bool

TRUE if SNMP proxy is enabled on the agent that opened the tunnel

isSnmpTrapProxy: bool

TRUE if SNMP trap proxy is enabled on the agent that opened the tunnel

isUserAgentInstalled: bool

TRUE if user agent is installed on the agent that opened the tunnel

macAddresses: Array

Array with MAC addresses as Strings

platformName: String

Platform name of the node that opened the tunnel

startTime: int

UNIX timestamp with tunnel start time

serialNumber: String

Serial number

systemInfo: String

System information of the node that opened the tunnel

systemName: String

System name of the node that opened the tunnel

zoneUIN: int

Node’s zone UIN if set in agent’s configuration file

Instance methods

bind(node): int

Bind the tunnel to a specified node.

Parameters

node

Node

Node object to bind the tunnel to

Return

Return code (0 on success).

Data Collection

Classes for data collection items, tables, and metric values.

DCI

Represents Data Collection Item (DCI).

Instance attributes

activeThresholdSeverity: int

Severity of the active threshold. If there are no active thresholds, defaults to 0 (NORMAL).

comments: String

DCI Comments

dataType: int

Data type of the DCI.

description: String

Description

errorCount: int

Number of consecutive data collection errors

flags: int

DCI flags

hasActiveThreshold: bool

TRUE if DCI has active threshold

id: int

Unique DCI identifier

instance: String

DCI instance (only for single value DCIs): %{instance}

instanceName: String

DCI instance name (only for single value DCIs): %{instance-name}

lastPollTime: int64

Time of last DCI poll (either successful or not) as number of seconds since epoch (1 Jan 1970 00:00:00 UTC)

lastCollectionTime: int64

Time of last successful DCI poll as number of seconds since epoch (1 Jan 1970 00:00:00 UTC).

Added in version 4.0

name: String

Parameter’s name

origin: int

Data origin of the DCI.

pollingInterval: int

Current polling interval

pollingSchedules: Array

Array of custom schedules in cron format

pollingScheduleType: int

Collection schedule:

  • 0 = Server default interval

  • 1 = Custom interval

  • 2 = Advanced schedule

relatedObject ⇒ NetObj

Related object or null if there is no object

status: int

Data status of the DCI.

systemTag: String

System tag. Contains information about DCI Interpretation.

template ⇒ Template

Template object if DCI came from Template or NULL.

templateId: int

Template id if DCI came from Template or 0.

templateItemId: int

DCI item id in template if DCI came from Template or 0.

thresholdDisableEndTime: int

UNIX time (number of seconds since epoch) till which threshold processing for this DCI is disabled. -1 if threshold processing is disabled infinitely. 0 if threshold processing is enabled.

transformedDataType: int

Tranformed data type.

type: int

DCI type:

  • 1 = single value

  • 2 = table

userTag: String

User tag.

Added in version 5.2

Instance methods

forcePoll(): void

Start DCI force poll.

Table

Represents table object (usually it’s value of table DCI).

Instance attributes

columnCount: int

Number of columns.

columns: Array<TableColumn>

Array of column definitions.

instanceColumns: Array<TableColumn>

Array of column definitions including only columns marked as instance columns.

instanceColumnIndexes: Array<Integer>

Array with indexes of columns marked as instance columns.

rowCount: int

Number of rows.

rows: Array<TableRow>

Array of rows with data.

title: String

Title of table.

Instance methods

addColumn(name, [type], [displayName], [isInstance]): int

Adds column to table

Parameters

name

String

Column name

type

Integer

Data type, optional parameter. Default is String

displayName

String

Column display name

isInstance

Boolean

True if column is instance column

Return

Column index

addRow(): int

Adds row to table

Return

Row index

deleteColumn(columnId): void

Delete column

Parameters

columnId

Integer

Column index

deleteRow(rowId): void

Delete row

Parameters

rowId

Integer

Row index

findRowByInstance(instance, instance2, …​) ⇒ TableRow

Finds row by instance

Parameters

instance

String

Instance string

instance2

String

Optional. If instance is composed of several columns, these can be supplied as additional parameters.

Return

Table row that corresponds to provided instance

findRowIndexByInstance(instance, instance2, …​): int

Finds row index by instance

Parameters

instance

String

Instance string

instance2

String

Optional. If instance is composed of several columns, these can be supplied as additional parameters.

Return

Table row index corresponds to provided instance

get(rowId, columnId): String

Get cell value by row and column id

Parameters

rowId

Integer

Row index

columnId

Integer

Column index

Return

Cell value as string

getColumnIndex(columnName): int

Get column index by column name

Parameters

columnName

String

Column name

Return

Column index or -1 if column not found

getColumnName(columnId): String

Get column name by column index

Parameters

columnName

Integer

Column name

Return

Column name or empty string if no column with given index

print(): void

Prints formatted table with header and contents

set(rowId, columnId, value): void

Set column value by row and column index

Parameters

rowId

Integer

Row index

columnId

Integer

Column index

value

String

New value

Return

Column index

trace(tag, level, prefix, headers, delimiter): void

Dump formatted table to log

Parameters

tag

String

Target debug level, default "nxsl.trace"

level

Integer

Target debug level, default "0"

prefix

String

Optional target prefix; will be added before each line in log file, default 'NULL'

headers

Bolean

Optional target header, default 'true'

delimiter

String

Optional record separator, default ','

Constructors

Table()

Creates new Table object.

TableRow

Represents table row definition object (used by Table class).

Instance attributes

index: int

Row index number

instance: String

Row instance name

values: Array<String>

Row values for all columns

Instance methods

get(columnId): String

Get cell value

Parameters

columnId

Integer

Column id

Return

Cell value

set(columnId, value): void

Set cell value

Parameters

columnId

Integer

Column id

value

Integer

New cell value

TableColumn

Represents table column definition object (used by Table class).

Instance attributes

dataType: int

Data type

displayName: String

Display name

isInstanceColumn: bool

TRUE if column is marked as instance column

name: String

Column name

DataPoint

Represents a single data point containing a timestamp and value pair. DataPoint objects are typically returned by functions that retrieve historical DCI values, such as GetDCIValuesEx().

Instance attributes

timestamp: int

Unix timestamp of the data point.

value: String

The value associated with the timestamp.

ScoredDciValue

Scored dci value from anomaly prediction

Instance attributes

score: float

Score

timestamp: int

Timestam as UNIX time

value: float

DCI Value

LinkDataSource

Data source item for Network Map link

Instance attributes

dci: DCI

Data source DCI item

dciId: int

Data source DCI item id

format: String

Data display format

location: int

Location of the link data source.

Possible values:

  • 0 = CENTER

  • 1 = OBJECT1

  • 2 = OBJECT2.

object: DataCollectionTarget

DCI source object

objectId: int

DCI source object id

Events and Alarms

Classes for event processing and alarm management.

Event

Represents NetXMS event object.

Instance attributes

code: int

Event code

customMessage: String

Custom message set in event processing policy by calling setMessage. Deprecated and will be removed in a future version.

dci: DCI

DCI object of class DCI that is source for this event or NULL if generated not by threshold

dciId: int

DCI id that is source for this event or 0 if generated not by threshold

id: int

Unique event identifier.

lastAlarmId: int

ID of the last alarm associated with this event, or 0 if none.

lastAlarmKey: String

Key for last generated alarm for this event or null

lastAlarmMessage: String

Message of the last alarm associated with this event, or null if none.

message: String

Event message. Get/set attribute.

name: String

Event name.

origin: int

Origin of the event

  • 0 - SYSTEM

  • 1 - AGENT

  • 2 - CLIENT

  • 3 - SYSLOG

  • 4 - SNMP

  • 5 - NXSL

  • 6 - REMOTE_SERVER

originTimestamp: int

The time when the event was generated in the origin.

parameters: Array

List of event parameters. Starting index is 1.

parameterNames: Array

List of named event parameters (e.g. "dciId"), which can be accessed by object.parameterName.

rootId: int64

Id of event that is root cause of this event or 0 if there is no such event.

severity: int

Event severity code. Get/set attribute.

source: NetObj

Source object (inherited from NetObj, exact type can be checked with classof function) for the event.

sourceId: int

ID of the source object for the event.

tags: Array

Event tags as an array of strings.

tagList: String

Event tags as a comma separated list.

timestamp: int

Unix timestamp of the event.

$1…$n

Shortcut for parameters[n] (e.g. "$event.parameters[3]" can be replaced with "$event.$3").

$…

Named event parameters can be accessed directly by the name (e.g $event.dciId). List of available named parameters can be accessed with parameterNames attribute. Get/set attribute.

Instance methods

addParameter(name, value): void

Set event parameter

Parameters

name

String

Parameter name. Optional parameter.

value

String

Parameter value.

addTag(tag): void

Set event tag, which can be later accessed via tags attribute.

Parameters

tag

String tag

correlateTo(eventId): void

Sets root cause id for the event

Parameters

eventId

Root cause event id

expandString(string): String

Expand string by replacing macros with their values.

Parameters

string

String to expand

Return

Formated string

>>> $event.expandString("%N")
SYS_THRESHOLD_REACHED
getParameter(name): void

Get parameter value by name or by index

Parameters

name

Parameter name or index

Return

Parameter value or null

hasTag(tag): bool

Return if event has specific tag.

Parameters

tag

String tag

removeTag(tag): void

Remove tag from event tag list

Parameters

tag

String tag

setMessage(message): void

Set event message to message.

Parameters

message

Message string

setNamedParameter(name, value): void

Set named parameter or change value of existing named parameter

Parameters

name

String name of parameter

value

String value of parameter

setParameter(index, value): void

Set value of parameter or change value of existing parameter. If index corresponds to existing parameter, the value will be set. If index is higher then existing number of parameters, new parameter(s) will be added (if needed, parameters with empty values will be added to reach the number of parameters indicated by index).

Parameters

index

Integer index of parameter

value

String value of parameter

setSeverity(severityCode): void

Change event severity to severityCode.

Parameters

severityCode

Numeric severity code

toJson(): String

Serialize object to JSON.

Return

String representation of the object in JSON format.

Alarm

Represents NetXMS alarm.

Instance attributes

ackBy: int

ID of user who acknowledged this alarm.

ackByUser ⇒ UserDBObject

User who acknowledged this alarm (class UserDBObject).

categories: Array

Array with alarm category names.

creationTime: int

Unix timestamp of the alarm creation time.

dciId: int

If alarm was created as a result of DCI threshold violation, this attribute will contain ID of the DCI.

eventCode: int

Event code of originating event.

eventId: int

ID of originating event.

eventName: String

Name of originating event.

eventTagList: float

List of event tags as a comma separated string

helpdeskReference: String

Helpdesk system reference (e.g. issue ID).

helpdeskState: int

Helpdesk state:

  • 0 = Ignored

  • 1 = Open

  • 2 = Closed

id: int

Unique identifier of the alarm.

impact: String

Alarm impact text

key: String

Alarm key.

lastChangeTime: int

Unix timestamp of the last update.

message: String

Alarm message.

originalSeverity: int

Original severity of the alarm.

parentId: int

Parent alarm id

repeatCount: int

Repeat count.

resolvedBy: int

ID of user who resolved this alarm.

resolvedByUser ⇒ UserDBObject

User who resolved this alarm (class UserDBObject)

rcaScriptName: String

Name of root cause analysis script

relatedEvents: Array

Array with related event IDs.

Added in version 6.0

ruleGuid: String

Guid of the rule that generated the event.

ruleDescription: String

Description of the rule that generated the event.

severity: int

Current alarm severity.

sourceObject: int

ID of the object where alarm is raised.

state: int

Alarm state:

  • 0 = Outstanding

  • 1 = Acknowledged

  • 2 = Resolved

  • 17 = Sticky acknowledged

Instance methods

acknowledge(): int

Acknowledge alarm. Return 0 on success or error code on failure.

addComment(commentText, syncWithHelpdesk): int

Add new alarm comment.

Parameters

commentText

String

Text of the new alarm comment.

syncWithHelpdesk

String

Optional. If synchronization with helpdesk should be done. TRUE by default.

Return

Id of the newly created alarm comment.

expandString(string): String

Expand string by replacing macros with their values.

Parameters

string

String to expand

Return

Formated string

getComments(): Array

Get array of alarm comments.

Return

Array of AlarmComment objects.

requestAiAssistantComment(): String

Request an AI assistant comment for this alarm.

Return

String containing the AI assistant’s response, or NULL if empty.

resolve(): int

Resolve alarm. Return 0 on success or error code on failure.

terminate(): int

Terminate alarm. Return 0 on success or error code on failure.

AlarmComment

Represents NetXMS alarm comment.

Instance attributes

id: int

Alarm comment ID.

changeTime: int

Unix timestamp of the alarm comment last modification time.

userId: int

ID of user who last modified this alarm comment.

user ⇒ UserDBObject

User who last modified this alarm comment (class UserDBObject).

text: String

Alarm comment text.

Infrastructure

Classes representing organizational and infrastructure objects: containers, templates, clusters, and physical components.

Container

Object represents container. Extends NetObj.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

autoBindScript: String

Source of the script for automatic binding.

isAutoBindEnabled: bool

Indicate if automatic binding is enabled.

isAutoUnbindEnabled: bool

Indicate if automatic unbinding is enabled.

Instance methods

Inherited methods from NetObj
bind(childObject): void

Bind childObject to the current object as a child.

bindTo(parentObject): void

Bind current object to parentObject as a child.

calculateDowntime(tag, periodStart, periodEnd): Array

Calculate node downtime. Returns array of DowntimeInfo objects.

clearGeoLocation(): void

Clears GeoLocation data from the node.

createUserAgentNotification(message, startTime, endTime, showOnStartup): int

Send user agent notification. Returns message id.

delete(): void

Deletes current object.

deleteCustomAttribute(name): void

Delete custom attribute.

enterMaintenance(): void

Enable maintenance mode for the object.

expandString(string): String

Expand string by replacing macros with their values.

getCustomAttribute(name): String

Returns value of the custom attribute with the provided name.

getResponsibleUsers(tag) ⇒ array

Returns list of responsible users with specific tag.

isChild(object): bool

Returns TRUE if provided object is child of this object.

isDirectChild(object): bool

Returns TRUE if provided object is direct child of this object.

isDirectParent(object): bool

Returns TRUE if provided object is direct parent of this object.

isParent(object): bool

Returns TRUE if provided object is parent of this object.

leaveMaintenance(): void

Disable maintenance mode for the object.

manage(): void

Sets object to managed state.

readMaintenanceJournal(startTime, endTime): Array

Read maintenance entries. Returns array of MaintenanceJournalRecord objects.

rename(name): void

Rename object.

setAlias(name): void

Set object alias name.

setCategory(idOrName): void

Set object category id or name.

setComments(comment, [isMarkdown]): void

Set object comments.

setCustomAttribute(key, value, inherit=false): void

Update or create custom attribute.

setGeoLocation(newLocation): void

Sets node geographical location.

setMapImage(image): void

Sets object image for network map display.

setNameOnMap(name): void

Sets object’s name for network map display.

setStatusCalculation(type, …​): void

Sets status calculation method.

setStatusPropagation(type, …​): void

Sets status propagation method.

unbind(object): void

Unbind provided object from the current object.

unbindFrom(object): void

Unbind current object from the provided object.

unmanage(): void

Set object into unmanaged state.

writeMaintenanceJournal(description): void

Add entry to maintenance journal.

createContainer(name) ⇒ Container

Create new container under current object

Parameters

name

String

New container’s name

Return

Newly created container of Container class.

createCollector(name) ⇒ Collector

Create new collector under current object

Parameters

name

String

New collector’s name

Return

Newly created collector of Collector class.

createNode(name, primaryHostName, zoneUIN) ⇒ Node

Create new node under current object.

Parameters

name

String

Node name if second options is set or primary host name or IP address.

primaryHostName

String

Optional. Primary host name or IP address.

zoneUIN

Integer

Optional. New node’s zone UIN.

Return

Newly created node of Node class or NULL if failed to create

createSensor(name, deviceClass, gateway, modbusUnitId) ⇒ Sensor

Create new sensor under current object.

Parameters

name

String

Sensor name

deviceClass

Integer

Sensor device class, one of the following values. Optional, SensorDeviceClass::Other if omitted.

gateway

NetObj

Gateway used for communication sensor. Optional.

modbusUnitId

Integer

MODBUS Unit ID. Optional.

Return

Newly created sensor of Sensor class or NULL if failed to create

setAutoBindMode(enableBind, enableUnbind): void

Set automatic bind mode for the container.

Parameters

enableBind

Boolean

Script should be used for automatic binding.

enableUnbind

Boolean

Script should be used for automatic unbinding.

setAutoBindScript(script): void

Update automatic binding script source.

Parameters

script

String

Script source.

Template

Object represents template. Extends NetObj.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

autoApplyScript: String

Source of the script for automatic binding.

isAutoApplyEnabled: bool

Indicate if automatic binding is enabled.

isAutoRemoveEnabled: bool

Indicate if automatic unbinding is enabled.

version: int

Template version

Instance methods

applyTo(object): void

Apply teplate on object

Parameters

object

Object

Object this template to be applied on

removeFrom(object): void

emplate form object

Parameters

object

Object

Object this template to be removed form

setAutoApplyMode(enableBind, enableUnbind): void

Set automatic bind mode for the container.

Parameters

enableBind

Boolean

Script should be used for automatic binding.

enableUnbind

Boolean

Script should be used for automatic unbinding.

setAutoApplyScript(script): void

Update automatic binding script source.

Parameters

script

String

Script content.

Cluster

Object represents cluster. Extends DataCollectionTarget.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

Inherited from DataCollectionTarget
templates: Array

Returns array of templates (Template) applied on this object. Return value also affected by trusted nodes settings.

nodes: Array

Will return all nodes of class Node, that are under this cluster

zone ⇒ Zone

Will return zone this cluster is under

zoneUIN: int

Will return zone UIN this cluster is under

Instance methods

Inherited methods from NetObj
bind(childObject): void

Bind childObject to the current object as a child.

bindTo(parentObject): void

Bind current object to parentObject as a child.

calculateDowntime(tag, periodStart, periodEnd): Array

Calculate node downtime. Returns array of DowntimeInfo objects.

clearGeoLocation(): void

Clears GeoLocation data from the node.

createUserAgentNotification(message, startTime, endTime, showOnStartup): int

Send user agent notification. Returns message id.

delete(): void

Deletes current object.

deleteCustomAttribute(name): void

Delete custom attribute.

enterMaintenance(): void

Enable maintenance mode for the object.

expandString(string): String

Expand string by replacing macros with their values.

getCustomAttribute(name): String

Returns value of the custom attribute with the provided name.

getResponsibleUsers(tag) ⇒ array

Returns list of responsible users with specific tag.

isChild(object): bool

Returns TRUE if provided object is child of this object.

isDirectChild(object): bool

Returns TRUE if provided object is direct child of this object.

isDirectParent(object): bool

Returns TRUE if provided object is direct parent of this object.

isParent(object): bool

Returns TRUE if provided object is parent of this object.

leaveMaintenance(): void

Disable maintenance mode for the object.

manage(): void

Sets object to managed state.

readMaintenanceJournal(startTime, endTime): Array

Read maintenance entries. Returns array of MaintenanceJournalRecord objects.

rename(name): void

Rename object.

setAlias(name): void

Set object alias name.

setCategory(idOrName): void

Set object category id or name.

setComments(comment, [isMarkdown]): void

Set object comments.

setCustomAttribute(key, value, inherit=false): void

Update or create custom attribute.

setGeoLocation(newLocation): void

Sets node geographical location.

setMapImage(image): void

Sets object image for network map display.

setNameOnMap(name): void

Sets object’s name for network map display.

setStatusCalculation(type, …​): void

Sets status calculation method.

setStatusPropagation(type, …​): void

Sets status propagation method.

unbind(object): void

Unbind provided object from the current object.

unbindFrom(object): void

Unbind current object from the provided object.

unmanage(): void

Set object into unmanaged state.

writeMaintenanceJournal(description): void

Add entry to maintenance journal.

Inherited methods from DataCollectionTarget
applyTemplate(template): void

Apply template to node.

enableConfigurationPolling(flag): void

Enable or disable configuration polling.

enableDataCollection(flag): void

Enable or disable data collection polling.

enableStatusPolling(flag): void

Enable or disable status polling.

readInternalParameter(name): String

Reads object internal metric (metric with source "Internal").

readInternalTable(name): String

Reads object internal table metric (metric with source "Internal").

removeTemplate(template): void

Remove template from node.

add(object): void

Add node to cluster

Parameters

object

Node

Object to be added to cluster

getResourceOwner(name) ⇒ Node

Get node which currently owns named resource.

Parameters

name

String

Name of the resource.

Return

Node object instance which currently owns resource of null if failed.

remove(object): void

Remove node from cluster

Parameters

object

Node

Object to be removed from cluster

Chassis

Object represents chassis. Extends DataCollectionTarget.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

Inherited from DataCollectionTarget
templates: Array

Returns array of templates (Template) applied on this object. Return value also affected by trusted nodes settings.

controller ⇒ Node

Chassis controller node

controllerId: int

Chassis controller’s node id

flags: int

Bit flags

rack ⇒ NetObj

Will return Rack object as NetObj if chassis is added in rack

rackId: int

Will return Rack id if chassis is added in rack

rackHeight: int

Object height in rack

rackPosition: int

Object position in rack

Constants

Access point state
Description Value

Bind under controller

0x00000001

Collector

Object represents collector. Extends NetObj.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

autoBindScript: String

Source of the script for automatic binding.

isAutoBindEnabled: bool

Indicate if automatic binding is enabled.

isAutoUnbindEnabled: bool

Indicate if automatic unbinding is enabled.

Instance methods

Inherited methods from NetObj
bind(childObject): void

Bind childObject to the current object as a child.

bindTo(parentObject): void

Bind current object to parentObject as a child.

calculateDowntime(tag, periodStart, periodEnd): Array

Calculate node downtime. Returns array of DowntimeInfo objects.

clearGeoLocation(): void

Clears GeoLocation data from the node.

createUserAgentNotification(message, startTime, endTime, showOnStartup): int

Send user agent notification. Returns message id.

delete(): void

Deletes current object.

deleteCustomAttribute(name): void

Delete custom attribute.

enterMaintenance(): void

Enable maintenance mode for the object.

expandString(string): String

Expand string by replacing macros with their values.

getCustomAttribute(name): String

Returns value of the custom attribute with the provided name.

getResponsibleUsers(tag) ⇒ array

Returns list of responsible users with specific tag.

isChild(object): bool

Returns TRUE if provided object is child of this object.

isDirectChild(object): bool

Returns TRUE if provided object is direct child of this object.

isDirectParent(object): bool

Returns TRUE if provided object is direct parent of this object.

isParent(object): bool

Returns TRUE if provided object is parent of this object.

leaveMaintenance(): void

Disable maintenance mode for the object.

manage(): void

Sets object to managed state.

readMaintenanceJournal(startTime, endTime): Array

Read maintenance entries. Returns array of MaintenanceJournalRecord objects.

rename(name): void

Rename object.

setAlias(name): void

Set object alias name.

setCategory(idOrName): void

Set object category id or name.

setComments(comment, [isMarkdown]): void

Set object comments.

setCustomAttribute(key, value, inherit=false): void

Update or create custom attribute.

setGeoLocation(newLocation): void

Sets node geographical location.

setMapImage(image): void

Sets object image for network map display.

setNameOnMap(name): void

Sets object’s name for network map display.

setStatusCalculation(type, …​): void

Sets status calculation method.

setStatusPropagation(type, …​): void

Sets status propagation method.

unbind(object): void

Unbind provided object from the current object.

unbindFrom(object): void

Unbind current object from the provided object.

unmanage(): void

Set object into unmanaged state.

writeMaintenanceJournal(description): void

Add entry to maintenance journal.

createCollector(name) ⇒ Collector

Create new collector under current object

Parameters

name

String

New collector’s name

Return

Newly created collector of Collector class.

createContainer(name) ⇒ Container

Create new container under current object

Parameters

name

String

New container’s name

Return

Newly created container of Container class.

createNode(name, primaryHostName, zoneUIN) ⇒ Node

Create new node under current object.

Parameters

name

String

Node name if second options is set or primary host name or IP address.

primaryHostName

String

Optional. Primary host name or IP address.

zoneUIN

Integer

Optional. New node’s zone UIN.

Return

Newly created node of Node class or NULL if failed to create

createSensor(name, deviceClass, gateway, modbusUnitId) ⇒ Sensor

Create new sensor under current object.

Parameters

name

String

Sensor name

deviceClass

Integer

Sensor device class, one of the following values. Optional, SensorDeviceClass::Other if omitted.

gateway

NetObj

Gateway used for communication sensor. Optional.

modbusUnitId

Integer

MODBUS Unit ID. Optional.

Return

Newly created sensor of Sensor class or NULL if failed to create

setAutoBindMode(enableBind, enableUnbind): void

Set automatic bind mode for the container.

Parameters

enableBind

Boolean

Script should be used for automatic binding.

enableUnbind

Boolean

Script should be used for automatic unbinding.

setAutoBindScript(script): void

Update automatic binding script source.

Parameters

script

String

Script source.

Sensor

Object represents sensor. Extends DataCollectionTarget.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

Inherited from DataCollectionTarget
templates: Array

Returns array of templates (Template) applied on this object. Return value also affected by trusted nodes settings.

capabilities: int

Sensor capabilities - currently onle one capability: Modbus(1).

deviceAddress: String

Device addtess

deviceClass: int

Device class

gatewayNode ⇒ Node

Getway node

gatewayNodeId: int

Getway node id

isModbus ⇒ Boolen

If sensor is Modbus sensor

macAddress: String

MAC address

modbusUnitId: int

MAC address

model: String

Model

serialNumber: String

Serial number

vendor: String

Vendor

Constants

Sensor class
Description Value

Other

0

UPS

1

Water meetr

2

Electricity meeter

3

Temperature

4

Humidity

5

Temperature and humidity

6

CO2

7

Power supply

8

Current

9

Water leak

10

Smoke

11

MobileDevice

Class that represents mobile device object. Extends DataCollectionTarget.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

Inherited from DataCollectionTarget
templates: Array

Returns array of templates (Template) applied on this object. Return value also affected by trusted nodes settings.

altitude: int

Altitude

batteryLevel: int

Battery percentage

commProtocol: String

Communication Protocol

deviceId: String

Device id

direction: String

Direction

lastReportTime: int

UNIX timestamp when device last reported data

model: String

Device model

osName: String

OS name installed on device

osVersion: String

OS version

serialNumber: String

Serial number

speed: String

Speed

userId: String

User id

vendor: String

Vendor

Asset

Object represents asset. Extends NetObj.

Instance attributes

Inherited from NetObj
alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

Integer array that consists of 5 numbers - each number represents number of alarms for this and child objects for each of severity.

alias: String

Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP ifAlias).

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

Reference to asset properties class of asset linked to this object.

backupZoneProxy: Node

Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not assigned)

backupZoneProxyId: int

ID of currently selected backup zone proxy (0 if zoning is disabled or backup proxy is not assigned)

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

List of child objects. Use classof to differentiate.

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UNIX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

Primary IP address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

Maintenance mode indicator (true if object currently is in maintenace mode).

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

List of direct parents for this object (most likely either Container or Cluster).

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

currently selected primary zone proxy (null if zoning is disabled or primary proxy is not assigned)

primaryZoneProxyId: int

ID of currently selected primary zone proxy (0 if zoning is disabled or primary proxy is not assigned)

region: String

Postal address - region.

responsibleUsers: Array

Array with user objects that are added as responsible users for this object. Objects are User or UserGroup

state: int

Current object state. One of: Node state, Cluster state, Sensor state

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

lastUpdateTimestamp: int

Unix timestamp of last update

lastUpdateUserId: int

Iof the user for last update

linkedObject ⇒ NetObj

Linked object

linkedObjectId: int

ID of the linked object

properties ⇒ AssetProperties

Reference to asset properties class.

AssetProperties

Object contains all asset properties accessible by property name. So value of asset property with name vendor can be accessed in the following way:

$node.assetProperties.vendor

ServiceRoot

Class represents Service Root container

Instance methods

createCollector(name) ⇒ Collector

Create new collector under current object

Parameters

name

String

New collector’s name

Return

Newly created collector of Collector class.

createContainer(name) ⇒ Container

Create new container under current object

Parameters

name

String

New container’s name

Return

Newly created container of Container class.

createNode(name, primaryHostName, zoneUIN) ⇒ Node

Create new node under current object.

Parameters

name

String

Node name if second options is set or primary host name or IP address.

primaryHostName

String

Optional. Primary host name or IP address.

zoneUIN

Integer

Optional. New node’s zone UIN.

Return

Newly created node of Node class or NULL if failed to create

createSensor(name, deviceClass, gateway, modbusUnitId) ⇒ Sensor

Create new sensor under current object.

Parameters

name

String

Sensor name

deviceClass

Integer

Sensor device class, one of the following values. Optional, SensorDeviceClass::Other if omitted.

gateway

NetObj

Gateway used for communication sensor. Optional.

modbusUnitId

Integer

MODBUS Unit ID. Optional.

Return

Newly created sensor of Sensor class or NULL if failed to create

BusinessService

Object represents business service

Instance attributes

checks: Array

List of checks an array of BusinessServiceCheck class objects

instance: String

Instance of the check

prototypeId: int

ID of the prototype object

serviceState: int

Current state of the business service one of states

BusinessServiceCheck

Object represents business service check

Instance attributes

currentTicketId: int

ID of the ticket that is currently associated with this check or 0 if check is OK

description: String

Cehck description

failureReason: String

Reason why check have failed or null if check is not failed

id: int

ID of the check

relatedDCI: DCI

DCI object of class DCI that is checked or NULL if check is not DCI based

relatedDCIId: int

DCI id that is checked or 0 if it is not DCI based check

relatedObject: NetObj

Related object (inherited from NetObj, exact type can be checked with classof function) or NULL

relatedObjectId: int

ID of related objec or 0

state: int

Current state of the business service check one of states

type: int

Business service check one of types

Users and Security

Classes for user and group management.

UserDBObject

Base class for User and UserGroup with common fields

Instance attributes

description: String

Description

flags: int

Flags

guid: String

GUID

id: int

Id

isDeleted: bool

TRUE if user DB object is deleted

isDisabled: bool

TRUE if user DB object is disabled

isGroup: bool

TRUE if user DB object is group object: UserGroup

isModified: bool

TRUE if user DB object is modified

isLDAPUser: bool

TRUE if user DB object is synchronized from LDAP

ldapDN: String

Get user DB object LDAP domain name

ldapId: String

Get user DB object LDAP id (value depends on the field that is ues as LDAP object id)

name: String

Object name

systemRights: int64

Field with system rights as bit flags.

Constants

Status propagation types
Code Description

0x000000000001

Manage users

0x000000000002

Change server configuration

0x000000000004

Configure traps

0x000000000008

SYSTEM_ACCESS_MANAGE_SESSIONS

0x000000000010

SYSTEM_ACCESS_VIEW_EVENT_DB

0x000000000020

SYSTEM_ACCESS_EDIT_EVENT_DB

0x000000000040

SYSTEM_ACCESS_EPP

0x000000000080

SYSTEM_ACCESS_MANAGE_ACTIONS

0x000000000100

SYSTEM_ACCESS_DELETE_ALARMS

0x000000000200

SYSTEM_ACCESS_MANAGE_PACKAGES

0x000000000400

SYSTEM_ACCESS_VIEW_EVENT_LOG

0x000000000800

SYSTEM_ACCESS_MANAGE_TOOLS

0x000000001000

SYSTEM_ACCESS_MANAGE_SCRIPTS

0x000000002000

SYSTEM_ACCESS_VIEW_TRAP_LOG

0x000000004000

SYSTEM_ACCESS_VIEW_AUDIT_LOG

0x000000008000

SYSTEM_ACCESS_MANAGE_AGENT_CFG

0x000000010000

SYSTEM_ACCESS_PERSISTENT_STORAGE

0x000000020000

SYSTEM_ACCESS_SEND_NOTIFICATION

0x000000040000

SYSTEM_ACCESS_MOBILE_DEVICE_LOGIN

0x000000080000

SYSTEM_ACCESS_REGISTER_AGENTS

0x000000100000

SYSTEM_ACCESS_READ_SERVER_FILES

0x000000200000

SYSTEM_ACCESS_SERVER_CONSOLE

0x000000400000

SYSTEM_ACCESS_MANAGE_SERVER_FILES

0x000000800000

SYSTEM_ACCESS_MANAGE_MAPPING_TBLS

0x000001000000

SYSTEM_ACCESS_MANAGE_SUMMARY_TBLS

0x000002000000

SYSTEM_ACCESS_REPORTING_SERVER

0x000004000000

SYSTEM_ACCESS_XMPP_COMMANDS

0x000008000000

SYSTEM_ACCESS_MANAGE_IMAGE_LIB

0x000010000000

SYSTEM_ACCESS_UNLINK_ISSUES

0x000020000000

SYSTEM_ACCESS_VIEW_SYSLOG

0x000040000000

SYSTEM_ACCESS_USER_SCHEDULED_TASKS

0x000080000000

SYSTEM_ACCESS_OWN_SCHEDULED_TASKS

0x000100000000

SYSTEM_ACCESS_ALL_SCHEDULED_TASKS

0x000200000000

SYSTEM_ACCESS_SCHEDULE_SCRIPT

0x000400000000

SYSTEM_ACCESS_SCHEDULE_FILE_UPLOAD

0x000800000000

SYSTEM_ACCESS_SCHEDULE_MAINTENANCE

0x001000000000

SYSTEM_ACCESS_MANAGE_REPOSITORIES

0x002000000000

SYSTEM_ACCESS_VIEW_REPOSITORIES

0x004000000000

SYSTEM_ACCESS_VIEW_ALL_ALARMS

0x008000000000

SYSTEM_ACCESS_EXTERNAL_INTEGRATION

0x010000000000

SYSTEM_ACCESS_SETUP_TCP_PROXY

0x020000000000

SYSTEM_ACCESS_IMPORT_CONFIGURATION

0x040000000000

SYSTEM_ACCESS_UA_NOTIFICATIONS

0x080000000000

SYSTEM_ACCESS_WEB_SERVICE_DEFINITIONS

User

Object represent user object and extends UserDBObject.

Instance attributes

authMethod: int

Authentication method.

certMappingData: String

Data that will be used to mpa certificate

certMappingMethod: int

Certificate mapping methods.

disabledUntil: String

UNIX timestamp with date until this user is disabled

email: String

Email set in user properties

fullName: String

User full name

graceLogins: int

Grace login count

phoneNumber: String

Phone number set in user properties

lastLogin: int

UNIX timestamp with last user’s login time

Constants

Status propagation types
Code Description

0

Password

1

Radius

2

Certificate

3

Certificate or password

4

Certificate or radius

Status propagation types
Code Description

0

Subject

1

Public key

2

CN

UserGroup

Object represent user group object and extends UserDBObject.

Instance attributes

memberCount: int

Group member count

members: Array

Array with objects: User or UserGroup

ClientSession

Object represents client session

Instance attributes

clientInfo: String

Client app info string

clientType: int

Client system type - desktop(0), web(1), mobile(2), tablet(3), application(4)

flags: int

Client flags

id ⇒ Bigint

ID of client session

loginName: String

Login name

loginTime: int

Login time

name: String

User name

systemAccessRights ⇒ Bigint

User access ritht bit flags

user ⇒ User

object of User

userId: int

User ID

webServerAddress: String

Address for web server if it is web type connection

workstation: String

Workstation information if available

Networking Utilities

Classes for network addresses, SNMP, and SSH operations.

InetAddress

Object that contains all information about network address

Instance attributes

address: String

IP address

family: String

Internet address, one of:

  • inet

  • inet6

  • unspec

isAnyLocal: bool

TRUE if address is a wildcard address

isBroadcast: bool

TRUE if address is a broadcast address

isLinkLocal: bool

TRUE if address is a link local address

isLoopback: bool

TRUE if address is a loopback address

isMulticast: bool

TRUE if address is a multicast address

isSubnetBase: bool

TRUE if address is a subnet base address

isSubnetBroadcast: bool

TRUE if address is a subnet broadcast address

isValid: bool

TRUE if address valid

isValidUnicast: bool

TRUE if address valid unicast

mask: int

Address bit mask

subnet ⇒ InetAddress

Subnet base address

Instance methods

contains(address): void

If subnet contains internet address

Parameters

address

InetAddress

Address to check for

Return

TRUE if contains, otherwise FALSE

r = InetAddress("192.168.56.0", 24).contains($node.ipAddress);
println(r); // will print "true", if primary IP address of node is in that subnet
equals(address): void

If addresses are equal

Parameters

address

InetAddress

Address to check to

Return

TRUE if addresses are equal, otherwise FALSE

inRange(addressStart, addressEnd): void

If address is in range

r = $node.ipAddress.inRange(InetAddress("192.168.56.10"), InetAddress("192.168.56.20"));
println(r); // will print "true", if primary IP address of node is in range
Parameters

addressStart

InetAddress

Start of the range address

addressEnd

InetAddress

End of the range address

Return

TRUE if adresse is in range, otherwise FALSE

sameSubnet(address): void

If adresses are in the same subnet (using mask bits from this InetAddress)

Parameters

address

InetAddress

IP address

Return

TRUE if adresses are in the same subnet, otherwise FALSE

Constructors

InetAddress()

Constructor for internet address

Return

InetAddress object

InetAddress(address, mask)

Constructor for internet address

Parameters

address

String

IP address as a string

mask

integer

mask in CIDR notation (optional parameter)

Return

InetAddress object

MacAddress

Represents MAC address

Instance attributes

isBroadcast: bool

TRUE if is broadcst address

isMulticast: bool

TRUE if multicast address

isValid: bool

TRUE if is valid MAC address

Instance methods

equals(mac): bool

Compares two MAC addresses

Parameters

mac

MacAddress

MAC address to compare to

Return

TRUE if MAC addresses are equal

toString(notation): String

Returns MAC address string representation

Parameters

notation

Constant

Optional. Notation of MAC address, one of MAC address notation options. MacAddressNotation::COLON_SEPARATED will be used by default if this parameter is not provided.

Return

MAC address as a string

Constructors

MacAddress(mac)

Creates new MAC address object.

Parameters

mac

String

Optional. String represenation of MAC address to parse to object

Return

MacAddress object

Constants

MAC address notation
Constant Description

MacAddressNotation::FLAT_STRING

Without separator, e.g. 123456789ABC

MacAddressNotation::COLON_SEPARATED

Separated by colon, e.g. 12:34:56:78:9A:BC

MacAddressNotation::BYTEPAIR_COLON_SEPARATED

Bytepairs separated by colon, e.g. 1234:5678:9ABC

MacAddressNotation::HYPHEN_SEPARATED

Separated by hyphen, e.g. 12-34-56-78-9A-BC

MacAddressNotation::DOT_SEPARATED

Separated by dot, e.g. 123.456.789.ABC

MacAddressNotation::BYTEPAIR_DOT_SEPARATED

Bytepairs separated by dot, e.g. 1234.5678.9ABC

MacAddressNotation::DECIMAL_DOT_SEPARATED

Decimal, separated by dot, e.g. 18.52.86.120.154.188

GeoLocation

Represents geographical location (defined by latitude and longitude).

Instance attributes

isManual: bool

TRUE if location is entered manually

isValid: bool

TRUE if location is valid

latitude: float

Latitude as floating point number

latitudeText: String

Latitude as text

longitude: float

Longitude as floating point number

longitudeText: String

Longitude as text

timestamp: int

Lat data update timestamp (UNIX format)

type: int

Data source type:

  • 0 – Unset

  • 1 – Manual

  • 2 - GPS

  • 3 - Network

Constructors

GeoLocation(latitude, longitude, type=1)

Create instance of the class based on floating-point latitude and longitude. Optional argument type can be used to override default value 1 ("Manual").

Constants

Location Types
Value Description

0

Unset (represents unknown location)

1

Manual (set by system administrator)

2

Automatic (obtained from GPS)

3

Network (obtained from network, for example using WiFi AP database)

Examples

Print node location
>>> nodeLoc = $node.geolocation
>>> println(nodeLoc.latitudeText)
N 48° 00' 0.000"
>>> println(nodeLoc.longitudeText)
E 22° 00' 0.000"
Set node location
>>> nodeLoc = GeoLocation(22.11, 48.12, 1)
>>> $node.setGeoLocation(nodeLoc)
>>> println($node.geolocation.latitudeText)
N 48° 12' 0.000"
>>> println($node.geolocation.longitudeText)
E 22° 11' 0.000"
Clear location
>>> $node.clearGeoLocation()
>>> println($node.geolocation)
null

SNMPTransport

Represents SNMP Transport functionality. Objects of this class are typically obtained from nodes that support SNMP. Objects of this class used to access SNMP data form node.

Instance attributes

snmpVersion: String

SNMP version used by the transport. Can be "1", "2c" or "3"

Instance methods

get(oid) ⇒ SNMPVarBind

Get the object value from specific node with SNMP GET request. The node and all SNMP communication details defined by SNMP transport. Returns SNMPVarBind object. Will return null on failure.

Parameters

oid

String

SNMP object id. Can be given with or without leading dot.

getValue(oid): String

Get the object value from specific node with SNMP GET request. The node and all SNMP communication details defined by SNMP transport. This function is similar to SNMPGet but returns string instead of an SNMPVarBind object. Will return null on failure.

Parameters

oid

String

SNMP object id. Can be given with or without leading dot.

println($node.createSNMPTransport()?.getValue("1.3.6.1.2.1.1.2.0")); // Will print e.g. 1.3.6.1.4.1.14988.1
getValues(array): String

Get object values from specific node with SNMP GET request. Request will contain all values that are provided in array. The node and all SNMP communication details defined by SNMP transport.

Parameters

array

Array

Array with SNMP object ids to get

Return

Array with resulting strings for each array

set(oid, value, dataType): bool

Assign a specific value to the given SNMP object for the node. The node and all SNMP communication details defined by SNMP transport. Will return TRUE on success, FALSE in case of failure.

Parameters

oid

String

SNMP object id. Can be given with or without leading dot.

value

String

Value to assign to oid.

dataType

String

SNMP data type (optional).

walk(oid): Array

Get an array of the SNMPVarBind from specific node with SNMP WALK request. The node and all SNMP communication details defined by SNMP transport. Will return null on failure.

Parameters

oid

String

SNMP object id. Can be given with or without leading dot.

Constants

SNMP data types
Description Value

Integer.

INTEGER

Same as INTEGER.

INT

Octet string.

STRING

Object id.

OID

IP address.

IPADDR

Same as IPADDR.

IP ADDRESS

32-bit counter.

COUNTER32

32-bit unsigned integer.

GAUGE32

Timeticks.

TIMETICKS

64-bit counter.

COUNTER64

32-bit unsigned integer.

UINTEGER32

Same as UINTEGER32.

UINT32

SNMPVarBind

Represents an SNMP varbind concept in NetXMS. A varbind logically consists of an OID and a value.

Instance attributes

name: String

Object name (OID string).

type: int

ASN.1 type.

value: String

Object value as a string.

printableValue: String

Object value as a string with non-printable characters replaced by ? character.

valueAsIp: String

Object value IP address, represented as string.

valueAsMac: String

Object value as MAC address, represented as string.

Methods

getValueAsByteStream() ⇒ ByteStream

Returns object value as ByteStream.

getValueAsString(codepage): String

Constructs a new String by decoding the varbind value using the specified codepage.

SSHSession

Represents an interactive SSH session to a remote node for executing commands and managing privilege escalation. SSHSession objects are typically created through the Node class method openSSHSession().

Instance attributes

connected: bool

Returns TRUE if the SSH channel is connected.

lastError: int

Error code from the last operation (0 if connected and no error).

lastErrorMessage: String

Text description of the last error.

nodeId: int

ID of the node this session is connected to.

privileged: bool

Returns TRUE if the session has escalated privileges.

Instance methods

close(): void

Close the SSH session.

session = $node->openSSHSession();
if (session->connected) {
    // Execute commands...
    session->close();
}
escalatePrivilege(password): bool

Escalate to privileged user.

Parameters

password

String

Password for privilege escalation

Return

TRUE if successful, FALSE otherwise.

session = $node->openSSHSession();
if (session->connected) {
    if (session->escalatePrivilege("secretpassword")) {
        // Execute privileged commands...
    }
}
execute(command, timeout): Array

Execute a command on the remote host.

Parameters

command

String

Command to execute

timeout

Integer

Optional timeout in milliseconds

Return

Array of strings (command output lines) or NULL if not connected.

session = $node->openSSHSession();
if (session->connected) {
    output = session->execute("ls -la", 5000);
    foreach (line : output) {
        println(line);
    }
    session->close();
}

WebService

An object that represents a combination of node and web service definition, that will be used for requests.

Instance attributes

id: int

Web service id

name: String

Web service name

description: String

Web service description

Instance methods

get(…​) ⇒ WebServiceResponse

Execute GET request from agent on associated node. Associated node is the node on which getWebService method was executed. This node is used for macro expansion.

Parameters

acceptCached

Boolean

Optional named parameter. If True, response stored in agent’s cache will be used. Default: false.

…​

Strings

Optional additional parameter(s) that will be used in web service definition to expand %1, %2…​ macro.

Return

Instance of WebServiceResponse with request result.

webSvc = $node.getWebService("webSvcName");
result = webSvc.get();
println(result.document); // will print result

result = webSvc.get("additional", "parameters");
println(result.document); // will print result

result = webSvc.get(acceptCached: true, "additional", "parameters");
println(result.document); // will print result
delete(…​) ⇒ WebServiceResponse

Execute DELETE request from agent on associated node. Associated node is the node on which getWebService method was executed. This node is used for macro expansion.

Parameters

…​

Strings

Optional additional parameter(s) that will be used in web service definition to expand %1, %2…​ macro.

Return

Instance of WebServiceResponse with request result.

webSvc = $node.getWebService("webSvcName");
result = webSvc.delete();
println(result.success); //will print "true" if request was successful or "false" otherwise

result = webSvc.delete("additional", "parameters");
println(result.success); //will print "true" if request was successful or "false" otherwise
patch(data, contentType, …​) ⇒ WebServiceResponse

Execute PATCH request from agent on associated node. Associated node is the node on which getWebService method was executed. This node is used for macro expansion.

Parameters

data

String or JsonObject

Data that will be set to the web service.

contentType

String

Optional parameter. Type of provided data that will be set to "Content-Type" header of request. Default type is "application/json".

…​

Strings

Optional additional parameter(s) that will be used in web service definition to expand %1, %2…​ macro.

Return

Instance of WebServiceResponse with request result.

webSvc = $node.getWebService("webSvcName");

result = webSvc.patch("{ \"id\":10 }");
println(result.success); //will print "true" if request was successful or "false" otherwise
to
json = new JsonObject();
json.set("id", 42);
result = webSvc.patch(json,"application/json", "additional", "parameters");
println(result.success); //will print "true" if request was successful or "false" otherwise
post(data, contentType, …​) ⇒ WebServiceResponse

Execute POST request from agent on associated node. Associated node is the node on which getWebService method was executed. This node is used for macro expansion.

Parameters

data

String or JsonObject

Data that will be set to the web service.

contentType

String

Optional parameter. Type of provided data that will be set to "Content-Type" header of request. Default type is "application/json".

…​

Strings

Optional additional parameter(s) that will be used in web service definition to expand %1, %2…​ macro.

Return

Instance of WebServiceResponse with request result.

webSvc = $node.getWebService("webSvcName");

result = webSvc.post("{ \"id\":10 }");
println(result.success);//will print "true" if request was successful or "false" otherwise

json = new JsonObject();
json.set("id", 42);
result = webSvc.post(json,"application/json", "additional", "parameters");
println(result.success); //will print "true" if request was successful or "false" otherwise
put(data, contentType, …​) ⇒ WebServiceResponse

Execute PUT request from agent on associated node. Associated node is the node on which getWebService method was executed. This node is used for macro expansion.

Parameters

data

String or JsonObject

Data that will be set to the web service.

contentType

String

Optional parameter. Type of provided data that will be set to "Content-Type" header of request. Default type is "application/json".

…​

Strings

Optional additional parameter(s) that will be used in web service definition to expand %1, %2…​ macro.

Return

Instance of WebServiceResponse with request result.

webSvc = $node.getWebService("webSvcName");

result = webSvc.put("{ \"id\":10 }");
println(result.success); //will print "true" if request was successful or "false" otherwise

json = new JsonObject();
json.set("id", 42);
result = webSvc.put(json,"application/json", "additional", "parameters");
println(result.success); //will print "true" if request was successful or "false" otherwise

WebServiceResponse

Contains all information about web service custom request execution result

Instance attributes

agentErrorCode: int

Agent error code

body: String

Response body. Alias for document.

document: String

Document that was returned by web service as a response to the request

errorMessage: String

Human readable error message set by server or agent

httpResponseCode: int

HTTP response code

statusCode: int

HTTP response status code. Alias for httpResponseCode.

success: bool

Will return True in case of success and False if there was problem on server or on agent

Data Structures

Classes for common data structures: JSON, files, byte streams, and ranges.

JsonObject

Represents JSON object.

To parse string into JsonObject use JsonParse.

Instance attributes

Attribute values can be accessed in the same way as instance attribute.

Instance methods

get(key) ⇒ ?

Returns attribute value by the key. Value type depends on the type used in JSON.

Parameters

key

String

Attribute key

Return

Attribute value

keys(): Array

Returns attribute array

Return

Attribute array

serialize(): String

Returns string with serialized JSON

Return

String with JSON

set(key, value): void

Sets attribute referenced by key to the given value.

Parameters

key

String

Attribute key

value

String

Attribute new value

Constructors

JsonObject()

Creates new JSON object.

Return

JsonObject object

JsonObject(object)

Creates new JSON object with attributes and values from NXSL object or hashmap.

Added in version 5.3

Parameters

object

object

NXSL object

Return

JsonObject object

JsonArray

Represents JSON array object.

To parse string into JsonObject use JsonParse.

Instance attributes

size: int

Number of elements in array

values: Array

NXSL array with JSON array elements

Instance methods

append(value): void

Appends value to JSON array.

Parameters

value

?

Add value to JSON array. Value type may vary.

get(index) ⇒ ?

Returns array value by the index. Value type depends on the type used in JSON.

Parameters

index

Integer

Index of element in array

Return

Attribute value

insert(index, value): void

Sets value to the provided index in JSON array, moving existing element in this position

Parameters

index

Integer

Index of element in array

value

?

Add value to JSON array. Value type may vary.

serialize(): String

Returns string with serialized JSON

Return

String with serialized JSON

set(index, value): void

Sets value to the provided index in JSON array, in place of existing element in this position

Parameters

index

Integer

Index of element in array

value

?

Add value to JSON array. Value type may vary.

Constructors

JsonArray()

Creates new JSON array.

Return

JsonArray object

JsonArray(array)

Creates new JSON array object from NXSL array.

Added in version 5.3

Parameters

array

array

NXSL array

Return

JsonArray object

ByteStream

Object represents stream of bytes

Instance attributes

eos: bool

Indicates, if current position is in the end of byte stream

pos: int

Current position in the byte stream

size: int

Size of byte stream in bytes

Instance methods

seek(position): int

Change current position in byte stream.

Parameters

position

Integer

Position to seek to

Return

Actual position if position change was successful or -1 if position change was not successful.

readByte(): int (32 bit)

Read byte from byte stream and return it’s value.

readInt16B(): int (32 bit)

Read big-endian 16-bit signed integer from byte stream and return it’s value.

readInt32B(): int (32 bit)

Read big-endian 32-bit signed integer from byte stream and return it’s value.

readInt64B(): int (64 bit)

Read big-endian 64-bit signed integer from byte stream and return it’s value.

readUInt16B(): int (32 bit)

Read big-endian 16-bit unsigned integer from byte stream and return it’s value.

readUInt32B(): int (32 bit)

Read big-endian 32-bit unsigned integer from byte stream and return it’s value.

readUInt64B(): int (64 bit)

Read big-endian 64-bit unsigned integer from byte stream and return it’s value.

readFloatB(): floating-point number

Read 8 bytes from stream as big-endian floating-point number and return it’s value. Deprecated from v 5.1.2, readFloat64B should be used instead.

readFloat32B(): floating-point number (32 bit)

Read 32 bytes from stream as big-endian floating-point number and return it’s value. Added in v 5.1.2.

readFloat64B(): floating-point number (64 bit)

Read 64 bytes from stream as big-endian floating-point number and return it’s value. Added in v 5.1.2.

readInt16L(): int (32 bit)

Read little-endian 16-bit signed integer from byte stream and return it’s value.

readInt32L(): int (32 bit)

Read little-endian 32-bit signed integer from byte stream and return it’s value.

readInt64L(): int (64 bit)

Read little-endian 64-bit signed integer from byte stream and return it’s value.

readUInt16L(): int (32 bit)

Read littleig-endian 16-bit unsigned integer from byte stream and return it’s value.

readUInt32L(): int (32 bit)

Read little-endian 32-bit unsigned integer from byte stream and return it’s value.

readUInt64L(): int (64 bit)

Read little-endian 64-bit unsigned integer from byte stream and return it’s value.

readFloatL(): floating-point number

Read 8 bytes from stream as little-endian floating-point number and return it’s value. Deprecated from v 5.1.2, readFloat64L should be used instead.

readFloat32L(): floating-point number (32 bit)

Read 32 bytes from stream as little-endian floating-point number and return it’s value. Added in v 5.1.2.

readFloat64L(): floating-point number (64 bit)

Read 64 bytes from stream as little-endian floating-point number and return it’s value. Added in v 5.1.2.

readCString(): String

Read C-string from stream and return it’s value. It’s expected that string in the stream is terminates by a null character.

readPString(): String

Read Pascal string from stream and return it’s value. It’s expected that first byte of string in the stream contains length of the string.

readString(length): String

Read string from stream and return it’s value.

Parameters

length

Integer

Length of the string

writeByte(value): void

Write provided value as byte to the byte stream at current position.

writeInt16B(value): void

Write provided value to the byte stream as big-endian 16-bit integer .

writeInt32B(value): void

Write provided value to the byte stream as big-endian 32-bit integer.

writeInt64B(value): void

Write provided value to the byte stream as big-endian 64-bit integer.

writeFloatB(value): void

Write provided value to the byte stream as big-endian 64-bit float. Deprecated from v 5.1.2, writeFloat64B should be used instead.

writeFloat32B(value): void

Write provided value to the byte stream as big-endian 32-bit float. Added in v 5.1.2.

writeFloat64B(value): void

Write provided value to the byte stream as big-endian 64-bit float. Added in v 5.1.2.

writeInt16L(value): void

Write provided value to the byte stream as little-endian 16-bit integer.

writeInt32L(value): void

Write provided value to the byte stream as little-endian 32-bit integer.

writeInt64L(value): void

Write provided value to the byte stream as little-endian 64-bit integer.

writeFloatL(value): void

Write provided value to the byte stream as little-endian 64-bit float. Deprecated from v 5.1.2, writeFloat64L should be used instead.

writeFloat32L(value): void

Write provided value to the byte stream as little-endian 32-bit float. Added in v 5.1.2.

writeFloat64L(value): void

Write provided value to the byte stream as little-endian 64-bit float. Added in v 5.1.2.

writeCString(string): void

Write provided string to the byte stream as null-terminated string (C-string).

writePString(string): void

Write provided string to the byte stream as Pascal string (first byte is string length).

writeString(string): void

Write provided string to the byte stream.

Constructors

ByteStream()

Creates new byte stream.

Return

ByteStream object.

bytestream = new ByteStream();
bytestream.writeString("xyz");
bytestream.seek(0);
while (!bytestream.eos) {
  b = bytestream.readByte();
  print(d2x(b,2) .. " "); // prints "78 79 7A"
}

FILE

Class that represents file on file system. Available only if NXSL.EnableFileIOFunctions configuration parameter is turned on. Use IO::OpenFile() function to create a new FILE object.

File read and write position in the file depends on mode file was opened in.

Instance attributes

eof: bool

If it’s already end of file.

name: String

File name

Instance methods

close(): void

Close file

read(numberOfSymbols): String

Read provided number of bytes from file.

Parameters

numberOfSymbols

Integer

Number of symbol to read from file

Return

String with symbols read from file or null if file closed or end of file reached.

readLine(): String

Read line from file.

Return

String with read line from file or null if file closed or end of file reached.

write(text): void

Will write provided text to the file.

Parameters

text

String

Text to write in to the file

writeLine(text): void

Will write provided text to the file and will add new line at the end.

Parameters

text

String

Text to write in to the file

DateTime

Class containing a calendar date and time broken down into its components. For convenience, all attributes has aliases to match struct tm provided in libc.

All class attributes are settable.

Instance attributes

second: int
sec: int
tm_sec: int

Seconds after the minute. Can be modified.

minute: int
min: int
tm_min: int

Minutes after the hour. Can be modified.

hour: integer
tm_hour: integer

Hours since midnight. Can be modified.

day: int
mday: int
tm_mday: int

Day of the month. Can be modified.

month: int
mon: int
tm_mon: int

Months since January. Can be modified.

year: int
tm_year: int

Year. Can be modified.

dayOfYear: int
yday: int
tm_yday: int

Days since January 1. Can be modified.

dayOfWeek: int
wday: int
tm_wday: int

Days since Sunday. Can be modified.

isDST: bool
isdst: bool
tm_isdst: bool

Daylight Saving Time flag. Can be modified.

isUTC: bool

UTC flag. Can be modified.

timestamp: int

UNIX time (number of seconds since epoch). Can be modified.

Instance methods

format(format): void

Formats a timestamp, and returns a string according to given formatting rules.

Parameters

string

String

Formatting string - see this for available options http://www.cplusplus.com/reference/ctime/strftime/

Return

Formatted time as a string.

time = DateTime();
println(time.format("%Y-%m-%d %H:%M")); //Will print: "2016-01-19 12:14"
println(time.format("%Y-%m-%d %H:%M - timezone %Z - offset from UTC - %z")); //Will print: "2016-01-19 12:14 - timezone CET - offset from UTC - +0100"

Constructors

DateTime()

Creates new DateTime object with current local time.

DateTime(timestamp)

Creates new DateTime with provided local time in UNIX time format.

Parameters

timestamp

Integer

UNIX time (number of seconds since epoch).

DateTime(time, isUTC)

Creates new DateTime object with provided time. Current time will be counted as UTC time if second parameter is true and as local time if second parameter is false.

Parameters

timestamp

Integer

UNIX time (number of seconds since epoch).

isUTC

Boolean

If provided time is in UTC.

Range

Class representing a range that has start and end indexes and step size.

All instance attributes are read-only.

Instance attributes

start ⇒ Number

Range start (inclusive).

end ⇒ Number

Range end (exclusive).

step ⇒ Number

Step size.

Constructors

Range(end)
range(end)

Creates new Range object with range from 0 till end.

Range(start, end)
range(start, end)

Creates new Range object with range from start till end.

Range(start, end, step)
range(start, end, step)

Creates new Range object with range from start till end with step size step.

Examples

Loop from 0 till 9
a = [];
for (i : range(0, 10)) a.append(i);
println(a); // Will print "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"

Class

Class represent classes and methodes in NXSL script

Instance attributes

attributes: Array

String aray with all attribute names

hierarchy: Array

String aray with class inheritance hirarchy

methods: Array

String aray with all method names

name: int

Name of the class

obj = $object;
println("Class hierarchy:");
println(obj.__class.hierarchy.join(" -> "));
println();
println("Attributes:");
for (a : obj.__class.attributes) println(a .. " = " .. obj.__get(a));
println();
println("Methods:");
for (m : obj.__class.methods) println(m);

Hardware and Software

Classes for hardware components, software packages, and system information.

HardwareComponent

Object that contains all information about node hardware component.

Instance Attributes

capacity: int

Component capacity depending on the type.

category: int

Code of the component category.

Possible values are:

Constant Value

HardwareComponentCategory::OTHER

0

HardwareComponentCategory::BASEBOARD

1

HardwareComponentCategory::PROCESSOR

2

HardwareComponentCategory::MEMORY

3

HardwareComponentCategory::STORAGE

4

HardwareComponentCategory::BATTERY

5

HardwareComponentCategory::NETWORK_ADAPTER

6

categoryName: String

Component category name

changeCode: int

Code of the changes that happened to the component during the last configuration poll.

Possible values are listed here: Change Code

description: String

Component description.

index: int

Index of the component.

location: String

Component installation location in the system.

model: String

Component model.

partNumber: String

Component part number.

serialNumber: String

Component serial number.

type: String

Component type depending on the category.

vendor: String

Component vendor.

SoftwarePackage

Represents software package installed on Node object.

Instance attributes

changeCode: int

Change code one of next:

  • CHANGE_NONE: 0

  • CHANGE_ADDED: 1

  • CHANGE_UPDATED: 2

date: String

Change date in YYYYMMDD format

description: String

PAckage description

name: String

Package name

timestamp: int

Package change date as UNIX timestamp

uninstallKey: String

Get product uninstall key if available.

url: String

PAckage URL

vendor: String

PAckage vendor

version: String

Package version

Component

Node components

Instance attributes

class: String

Type of the component:

  • unknown

  • chassis

  • backplane

  • container

  • power supply

  • fan

  • sensor

  • module

  • port

  • stack

children: Array

List of direct children (Array of Component object intances).

description: String

Component description

firmware: String

Component firmware version, if available.

ifIndex: int

Interface index number

model: String

Component model number, if available.

name: String

Component name, if available.

serial: String

Component serial number, if available.

vendor: String

Component vendor, if available.

DeploymentPackage

Represents a software deployment package with metadata for installation on managed nodes. DeploymentPackage objects are typically returned by GetAvailablePackages() function.

Instance attributes

command: String

Installation command to execute.

description: String

Package description.

fileName: String

Path to the package file.

id: int

Unique package identifier.

name: String

Package name.

platform: String

Target platform (e.g., "Windows", "Linux").

type: String

Package type identifier.

version: String

Package version string.

RadioInterface

Class represents radio interface

Instance attributes

band: int

Interface band

bandName: String

Band name

bssid: String

Basic Service Set Identifier

channel: int

Channel

frequency: int

Frequency

ifIndex: int

Index of corresponding element from ifTable, if available

index: int

Index

name: String

Inteface name

powerDBm: int

Power dBm

powerMW: int

Power MW

ssid: String

Service Set Identifier

Constants

Node types
Value Description

0

Unknown

1

2.4 GHZ

2

3.65 GHZ

3

5 GHZ

4

6 GHZ

Discovery and Diagnostics

Classes for network discovery and diagnostic information.

DiscoveredNode

Represents NetXMS node found while performing network discovery. Is available as a $node in script that is set as DiscoveryFilter.

Instance attributes

agentVersion: String

NetXMS agent version as string.

dnsName: String

Node’s DNS name

interfaces: Array

Array with node’s interfaces

ipAddr: String

Node’s ip address. Deprecated and will be removed in a future version, use ipAddress instead.

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isAgent: bool

TRUE if NetXMS agent detected on node

isBridge: bool

TRUE if node is a bridge

isCDP: bool

TRUE if node supports CDP (Cisco Discovery Protocol)

isLLDP: bool

TRUE if node supports LLDP (Link Layer Discovery Protocol)

isPrinter: bool

TRUE if node is a printer

isRouter: bool

TRUE if node is a router (has IP forwarding enabled)

isSNMP: bool

TRUE if SNMP agent detected on node

isSONMP: bool

TRUE if node supports SONMP/NDP (Synoptics/Nortel Discovery Protocol)

isSSH: bool

TRUE if SSH connection is available for this node

netMask: int

Network mask

platformName: String

Platform name reported by NetXMS agent

snmpOID: String

SNMP object identifier (result of 1.3.6.1.2.1.1.2.0 request)

snmpVersion: int

Configured SNMP version:

  • 0: SNMP version 1

  • 1: SNMP version 2c

  • 2: SNMP version 3

subnet: String

Subnet

zone ⇒ Zone

Zone object (null if zoning is disabled)

zoneUIN: int

This node zone UIN

DiscoveredInterface

Represent discovered interface objects in discovered node class

Instance attributes

alias: String

Interface alias (usually value of SNMP ifAlias)

chassis: int

Chassis id

description: String

Interface description

index: int

Interface index

ipAddressList: Array

Array with InetAddress objects, that represent all adresses that this interface has

isPhysicalPort: bool

TRUE if this interface object represents physical port

macAddr: String

String representation of MAC address separated by ":"

module: int

Module

mtu: int

Interface MTU (0 if unknown)

name: String

Interface name

pic: int

Phisical location

port: int

Port number

speed: int64

Speed of the interface

type: int

Interface type

NodeDependency

Detailed information about dependent nodes, usually accessible via instance attribute dependentNodes in class Node.

Instance attributes

id: int

Node id

isAgentProxy: bool

Node is an agent proxy. Helper function for accesing specific bit of type field.

isDataCollectionSource: bool

Node is a data collection source for another node. Helper function for accesing specific bit of type field.

isICMPProxy: bool

Node is an ICMP proxy for another node. Helper function for accesing specific bit of type field.

isSNMPProxy: bool

Node is a SNMP proxy for another node. Helper function for accesing specific bit of type field.

type: int

Type of of the dependencty this object represent. This field is a bitmask, flags are documented at Type bitmask.

Constants

Type bitmask
Value Description

0x01

Agent proxy

0x02

SNMP proxy

0x04

ICMP proxy

0x08

Data collection source

NetworkPathCheckResult

Instance attributes

description: String

Description

reason: int

Reason

rootCauseInterface ⇒ Interface or null

Interface name

rootCauseInterfaceId: int

Interface ID

rootCauseNode ⇒ Node or null

Node name

rootCauseNodeId: int

Node ID

DowntimeInfo

Instance attributes

object ⇒ NetObj

Object

objectId: int

Object ID

totalDowntime: int

Downtime in seconds

uptimePercentage: float

Uptime percentage

MaintenanceJournalRecord

One maintenance journal record entry

Instance attributes

authorId: int

Autor user ID

creationTime: int

UNIX timestamp of creation

description: String

Description

editorId: int

Editor user ID

modificationTime: int

UNIX timestamp of last modification

objectId: int

ID of an object that was under maintenance

OSPF and Routing

Classes for OSPF protocol information.

OSPFArea

OSPF area

Instance attributes

areaBorderRouterCount: int

Area border router count

asBorderRouterCount: int

Autonomous system border router count

id: String

Area ID

lsaCount: int

Link state advertisement count

OSPFNeighbor

OSPF neighbor

Instance attributes

areaId: String

Area ID

ifIndex: String

Interface index

ipAddress ⇒ InetAddress

IP address.

isVirtual: bool

TRUE if it is virtual

node ⇒ Node

Object of Node class

nodeId: int

Node ID

routerId: String

OSPF router ID

state: int

State

stateText: String

State text

LDAP Integration

Classes for LDAP directory integration.

LDAPObject

Represents object recieved form LDAP on synchronization

Instance attributes

description: String

Description

email: String

E-mail

fullName: String

Full name

id: String

Id

isGroup: bool

If objec is a group

isUser: bool

If object is an user

loginName: String

Login name

phoneNumber: String

Phone number

type: String

String that repsesents type. One of: group, user, other

Global Constants

Status of the BusinessService class object

Constant Value Description

BusinessServiceState::OPERATIONAL

0

No failed checks

BusinessServiceState::DEGRADED

2

One of checks returned not normal, but is not failed yet

BusinessServiceState::FAILED

4

At least one of checks failed

Type of BusinessServiceCheck class

Constant Value Description

BusinessServiceType::NONE

0

None

BusinessServiceType::SCRIPT

1

Script

BusinessServiceType::DCI

2

DCI

BusinessServiceType::OBJECT

3

Object

Data types of the DCI class

Constant Value Description

DCI::INT32

0

Signed 32 bit integer

DCI::UINT32

1

Unsigned 32 bit integer

DCI::INT64

2

Signed 64 bit integer

DCI::UINT64

3

Unsigned 64 bit integer

DCI::STRING

4

String

DCI::FLOAT

5

Floating point number

DCI::NULL

6

Used internally; should not be used in the scripts

DCI::COUNTER32

7

32 bit counter

DCI::COUNTER64

8

64 bit counter

Data collection exit codes

Should be used in order to return errors in script DCIs or in transoformation script.

Constant

Description

DataCollection::ERROR

DCI collection eeror

DataCollection::NO_SUCH_INSTANCE

No sutch instance error

DataCollection::NOT_SUPPORTED

Not supported eeror

DCI states of the DCI class

Constant Value Description

DCI::ACTIVE

0

Active

DCI::DISABLED

1

Disabled

DCI::UNSUPPORTED

2

Unsupported

DCI data source (origin) of the DCI class

Constant Value Description

DataSource::INTERNAL

0

Internal

DataSource::AGENT

1

Agent

DataSource::SNMP

2

SNMP

DataSource::WEB_SERVICE

3

Web service

DataSource::PUSH

4

Push data

DataSource::WINPERF

5

Windows Performance Counters

DataSource::SMCLP

6

SMCLP

DataSource::SCRIPT

7

Script

DataSource::SSH

8

SSH

DataSource::MQTT

9

MQTT

DataSource::DEVICE_DRIVER

10

Network Device driver

DataSource::MODBUS

11

MQTT

Flags for DCI class

Constant Value Description

DCI::ALL_THRESHOLDS

0x00002

Process all thresholds

DCI::RAW_VALUE_OCTET_STRING

0x00004

Raw value is octet string

DCI::SHOW_ON_OBJECT_TOOLTIP

0x00008

Show DCI on object tooltip

DCI::AGGREGATE_ON_CLUSTER

0x00080

Aggregate data on cluster

DCI::TRANSFORM_AGGREGATED

0x00100

Transform agregated data

DCI::CALCULATE_NODE_STATUS

0x00400

Used in node status calculation

DCI::SHOW_IN_OBJECT_OVERVIEW

0x00800

Show in object overview

DCI::AGGREGATE_WITH_ERRORS

0x04000

Aggregate with errors

DCI::HIDE_ON_LAST_VALUES_PAGE

0x08000

Hide on last values page

DCI::STORE_CHANGES_ONLY

0x40000

Stor changed values only

Origin of Event class

Constant Value Description

EventOrigin::SYSTEM

0

System

EventOrigin::AGENT

1

Agent

EventOrigin::CLIENT

2

Client

EventOrigin::SYSLOG

3

Syslog

EventOrigin::SNMP

4

SNMP

EventOrigin::NXSL

5

NXSL

EventOrigin::REMOTE_SERVER

6

Remote server

EventOrigin::WINDOWS_EVENT

7

Windows event

Category of HardwareComponent class

Constant Value Description

HardwareComponentCategory::OTHER

0

Other

HardwareComponentCategory::BASEBOARD

1

Baseboard

HardwareComponentCategory::PROCESSOR

2

Processor

HardwareComponentCategory::MEMORY

3

Memory

HardwareComponentCategory::STORAGE

4

Storage

HardwareComponentCategory::BATTERY

5

Battery

HardwareComponentCategory::NETWORK_ADAPTER

6

Network adapter

Expected state for Interface class

Constant Value Description

InterfaceExpectedState::UP

0

Up

InterfaceExpectedState::DOWN

1

Down

InterfaceExpectedState::IGNORE

2

Ignore

Constant Value Description

MapLinkColorSource::CustomColor

2

Link color source custom color

MapLinkColorSource::Default

0

Link color source default color

MapLinkColorSource::InterfaceStatus

5

Link color source interface status

MapLinkColorSource::InterfaceUtilization

4

Link color source interface utilization

MapLinkColorSource::ObjectStatus

1

Link color source object status

MapLinkColorSource::Script

3

Link color source script

Constant Value Description

MapLinkRoutingAlgorithm::Default

0

Map default

MapLinkRoutingAlgorithm::Direct

1

Direct

MapLinkRoutingAlgorithm::Manhattan

2

Manhattan

MapLinkRoutingAlgorithm::BendPoints

3

Bend points

Constant Value Description

MapLinkStyle::Default

0

Map default

MapLinkStyle::Solid

1

Direct

MapLinkStyle::Dash

2

Manhattan

MapLinkStyle::Dot

3

Bend points

MapLinkStyle::DashDot

4

Bend points

MapLinkStyle::DashDotDot

5

Bend points

Constant Value Description

LinkLabelPosition::Center

0

Locate label at the center of the link

LinkLabelPosition::Object1

1

Locate label at the first object

LinkLabelPosition::Object2

2

Locate label at the second object

Node state

Constant Value Description

NodeState::Unreachable

0x00000001

Node is unreachable

NodeState::NetworkPathProblem

0x00000002

Network path problem

NodeState::AgentUnreachable

0x00010000

NetXMS agent unreachable

NodeState::SNMPUnreachable

0x00020000

Unreachable via SNMP

NodeState::EtherNetIPUnreachable

0x00040000

Unreachable via EtherNet/IP industrial protocol

NodeState::CacheModeNotSupported

0x00080000

Cache mode is not supported on NetXMS agent

NodeState::SNMPTrapFlood

0x00100000

SNMP trap flood detected

NodeState::ICMPUnreachable

0x00200000

Unreachable via ICMP

NodeState::SSHUnreachable

0x00400000

Unreachable via SSH

NodeState::MODBUSUnreachable

0x00800000

Unreachable via MODBUS

Object status codes

Constant Value Description

Status::NORMAL

0

Normal

Status::WARNING

1

Warning

Status::MINOR

2

Minor

Status::MAJOR

3

Major

Status::CRITICAL

4

Critical

Status::UNKNOWN

5

Unknown

Status::UNMANAGED

6

Unmanaged

Status::DISABLED

7

Disabled

Status::TESTING

8

Testing

Cluster state

Constant Value Description

ClusterState::Unreachable

0x00000001

Unreachable

ClusterState::NetworkPathProblem

0x00000002

Network Path Problem

ClusterState::Down

0x00010000

Down

Sensor device class

Constant

Value

Description

SensorDeviceClass::Other

0

Other

SensorDeviceClass::UPS

1

UPS

SensorDeviceClass::WaterMeter

2

Water Meter

SensorDeviceClass::ElectricityMeter

3

Electricity Meter

SensorDeviceClass::Temperature

4

Temperature

SensorDeviceClass::Humidity

5

Humidity

SensorDeviceClass::TemperatureAndHumidity

6

Temperature And Humidity

SensorDeviceClass::CO2

7

CO2

SensorDeviceClass::PowerSupply

8

Power Supply

SensorDeviceClass::Current

9

Current

SensorDeviceClass::WaterLeak

10

Water Leak

SensorDeviceClass::Smoke

11

Smoke

Sensor state

Constant Value Description

SensorState::Unreachable

0x00000001

Unreachable

SensorState::NetworkPathProblem

0x00000002

Network Path Problem

SensorState::MODBUSUnreachable

0x00800000

Unreachable via MODBUS

Severity constants

Constant Value Description

Severity::NORMAL

0

Normal

Severity::WARNING

1

Warning

Severity::MINOR

2

Minor

Severity::MAJOR

3

Major

Severity::CRITICAL

4

Critical

Status colors

Constant Value Description

StatusColor::NORMAL

0

Normal

StatusColor::WARNING

1

Warning

StatusColor::MINOR

2

Minor

StatusColor::MAJOR

3

Major

StatusColor::CRITICAL

4

Critical

StatusColor::UNKNOWN

5

Critical

StatusColor::UNMANAGED

6

Critical

StatusColor::DISABLED

7

Critical

StatusColor::TESTING

8

Critical

Change Code

Node attributes change code

Constant Value

ChangeCode::NONE

0

ChangeCode::ADDED

1

ChangeCode::UPDATED

2

ChangeCode::REMOVED

3

Node Capability

Node capability flags. Used with Node attributes capabilities and expectedCapabilities.

Constant Value Description

NodeCapability::SNMP

0x0000000001

Node supports SNMP

NodeCapability::Agent

0x0000000002

Node supports NetXMS native agent

NodeCapability::Bridge

0x0000000004

Node is a bridge

NodeCapability::Router

0x0000000008

Node is a router

NodeCapability::LocalManagement

0x0000000010

Local management capability

NodeCapability::Printer

0x0000000020

Node is a printer

NodeCapability::OSPF

0x0000000040

OSPF support

NodeCapability::SSH

0x0000000080

SSH support

NodeCapability::CDP

0x0000000100

Cisco Discovery Protocol support

NodeCapability::NDP

0x0000000200

Nortel (Synoptics/Bay Networks) topology discovery

NodeCapability::LLDP

0x0000000400

Link Layer Discovery Protocol support

NodeCapability::VRRP

0x0000000800

VRRP support

NodeCapability::VLAN

0x0000001000

VLAN information available

NodeCapability::IEEE802_1x

0x0000002000

802.1x support enabled on node

NodeCapability::STP

0x0000004000

Spanning Tree (IEEE 802.1d) enabled on node

NodeCapability::EntityMIB

0x0000008000

Supports ENTITY-MIB

NodeCapability::IfXTable

0x0000010000

Supports ifXTable (64-bit interface counters)

NodeCapability::AgentIfXCounters

0x0000020000

Agent supports 64-bit interface counters

NodeCapability::WindowsPDH

0x0000040000

Node supports Windows PDH parameters

NodeCapability::WiFiController

0x0000080000

Node is wireless network controller

NodeCapability::SMCLP

0x0000100000

Node supports SMCLP protocol

NodeCapability::NewPolicyTypes

0x0000200000

Agent upgraded to new policy type

NodeCapability::UserAgent

0x0000400000

User agent (desktop support app) is installed

NodeCapability::EtherNetIP

0x0000800000

EtherNet/IP support

NodeCapability::ModbusTCP

0x0001000000

Modbus TCP support

NodeCapability::ProfiNet

0x0002000000

PROFINET support

NodeCapability::FileManager

0x0004000000

Node has file manager support

NodeCapability::LLDPv2

0x0008000000

LLDP v2 MIB support

NodeCapability::EmulatedEntityMIB

0x0010000000

ENTITY MIB support emulated by driver

NodeCapability::DeviceView

0x0020000000

Device view is supported

NodeCapability::WiFiAccessPoint

0x0040000000

Node is wireless access point

NodeCapability::VNC

0x0080000000

Node supports VNC connection from server or zone proxy

NodeCapability::LocalVNC

0x0100000000

Node supports VNC connection via local agent

NodeCapability::RegisteredForBackup

0x0200000000

Node is registered for device configuration backup

NodeCapability::ServiceManager

0x0400000000

Node has service manager accessible via NetXMS agent

NodeCapability::SSHInteractiveChannel

0x0800000000

Interactive (shell) SSH channel can be established

NodeCapability::SSHCommandChannel

0x1000000000

SSH command channel can be established

Other constants

NXSL::BuildTag

Current server build tag

NXSL::Classes

Array containing all NXSL classes

NXSL::Functions

Array containing names of all NXSL functions

NXSL::SystemIsBigEndian

TRUE if system is big endian otherwise FALSE

NXSL::Version

Current server version

Formal Grammar

Grammar
script ::=
  module |
  expression

module ::=
  module_component { module_component }

module_component ::=
  function |
  statement_or_block |
  use_statement

import_statement ::=
  import any_identifier ";"

any_identifier ::=
  IDENTIFIER |
  COMPOUND_IDENTFIER

function ::=
  function IDENTIFIER "(" [ identifier_list ] ")" block

identifier_list ::=
  IDENTIFIER { "," IDENTIFIER }

block ::=
  "{" { statement_or_block } "}"

statement_or_block ::=
  statement |
  block

statement ::=
  expression ";" |
  builtin_statement |
  ";"

builtin_statement ::=
  simple_statement ";" |
  if_statement |
  do_statement |
  while_statement |
  for_statement |
  foreach_statement |
  switch_statement |
  array_statement |
  global_statement |
  break ";"
  continue ";"

simple_statement ::=
  keyword [ expression ]

keyword ::=
  exit |
  print |
  println |
  return

if_statement ::=
  if "(" expression ")" statement_or_block [ else statement_or_block ]

for_statement ::=
  for "(" expression ";" expression ";" expression ")" statement_or_block

foreach_statement ::=
  foreach "(" IDENTIFIER ":" expression ")" statement_or_block

while_statement ::=
  while "(" expression ")" statement_or_block

do_statement ::=
  do statement_or_block while "(" expression ")" ";"

switch_statement ::=
  switch "(" expression ")" "{" case { case } [ default ] "}"

case ::=
  case constant ":" { statement_or_block }

default ::=
  default ":" { statement_or_block }

array_statement ::=
  [ global ] array identifier_list ";"

global_statement ::=
  global global_variable_declaration { "," global_variable_declaration } ";"

global_variable_declaration ::=
  IDENTIFIER [ "=" expression ]

expression ::=
  "(" expression ")" |
  IDENTIFIER "=" expression |
  expression "." IDENTIFIER |
  "-" expression |
  "!" expression |
  "~" expression |
  inc IDENTIFIER |
  dec IDENTIFIER |
  IDENTIFIER inc |
  IDENTIFIER dec |
  expression "+" expression |
  expression "-" expression |
  expression "*" expression |
  expression "/" expression |
  expression "%" expression |
  expression like expression |
  expression ilike expression |
  expression "~=" expression |
  expression match expression |
  expression imatch expression |
  expression "==" expression |
  expression "!=" expression |
  expression "<" expression |
  expression "<=" expression |
  expression ">" expression |
  expression ">=" expression |
  expression "&" expression |
  expression "|" expression |
  expression "^" expression |
  expression "&&" expression |
  expression "||" expression |
  expression "<<" expression |
  expression ">>" expression |
  expression "." expression |
  expression "?" expression ":" expression |
  operand

operand ::=
  function_call |
  type_cast |
  constant |
  IDENTIFIER

type_cast ::=
  builtin_type "(" expression ")"

builtin_type ::=
  int32 |
  int64 |
  uint32 |
  uint64 |
  real |
  string

function_call ::=
  IDENTIFIER "(" [ expression { "," expression } ] ")"

constant ::=
  STRING |
  INT32 |
  INT64 |
  UINT32 |
  UINT64 |
  REAL |
  NULL
Terminal symbols
IDENTIFIER ::= [A-Za-z_\$][A-Za-z_\$0-9]*
COMPOUND_IDENTIFIER ::= { IDENTIFIER}(::{ IDENTIFIER})+
INTEGER ::= \-?(0x)?[0-9]+
INT32 ::= INTEGER
INT64 ::= {INTEGER}L
UINT32 ::= {INTEGER}U
UINT64 ::= {INTEGER}(UL|LU)
REAL ::= \-?[0-9]+\.[0-9]+

Examples

Some real life examples.

Small utility scripts

UNIX timestamp to human readable

return strftime("%d.%m.%Y %H:%M:%S", $1);

Table DCI manipulation script

Get table item. Is used to make DCI from Table DCI.

// Warning: this script works only on the same node
//
// $1 - Description
// $2 - column name
table = GetDCIValueByDescription($node, $1);
if (table != NULL) {
        col = table.getColumnIndex($2);
        if (col >= 0) {
                return table.get(0, col);
        }
}
return 0;

Primary mac address

Script to print primary MAC address.

for(i : $node.interfaces)
{
   for(a : i.ipAddressList)
   {
      if (a.address == $node.ipAddress)
         println(i.macAddr);
   }
}

Check if node is under cluster or container

Script that returns TRUE if current node is under at least one container or cluster.

for (p : $node.parents) {
    if (p.type == 5 or p.type == 14) { //5 is container and 14 is cluster
        return true;
    }
}
return false;

Change expected state for all interfaces

Set ignore expected state for all interfaces of all nodes.

for (n : GetAllNodes()) {
    println(n.name .. "(" .. n.id .. ")");
    for (i : n.interfaces) {
        println("\t" .. i.name);
        i.setExpectedState("IGNORE");
    }
}

Instance filtering script for "Net.InterfaceNames"

Requirements

Instance filtering script for "Net.InterfaceNames" list, that will filter only "eth*" and "bond*" interfaces, that can be used in Net.Interface.BytesIn64 or Net.Interface.BytesOut64 DCIs.

Solution

Select "Agent List" as instance discovery method. Set "Net.InterfaceNames" as list name and add script to instance discovery filter script section:

name=$1;
if (name ~= "eth|bond")
{
    return [name];
}
return false;

Filter out some interfaces from creation

Requirements

Filter interfaces that should not be monitored by NetXMS. In this case "isatap*" interfaces.

Solution

Update "Hook:CreateInterface" script in script library.

if ( $1.name ~= "^isatap" )
    return false;

return true;

Additional Information About Connected Node

Requirements

Add information about name, IP address, and MAC address about connected node to notification about switch port being down and up.

Solution

Script that is being called from Event Processing Policy that adds named event parameter to the event. Parameter is named additionalInfo, correspondingly %<additionalInfo> macro can be used to add value of that parameter to notification text.

// only for interface up and down events
if (($event.name != "SYS_IF_DOWN") && ($event.name != "SYS_IF_UP"))
        return true;

// get interface object from interface index
iface = $node.getInterface($5);
if (iface == null)
        return true;

// get peer node (node connected to this interface) object
peer = iface.peerNode;
if (peer == null)
        return true;

// get peer interface object (needed to obtain MAC address)
peerIface = iface.peerInterface;
if (peerIface != null)
{
        macAddr = peerIface.macAddr;
}
else
{
        macAddr = "<MAC unknown>";
}

// set event's named parameter
SetEventParameter($event, "additionalInfo",
        "Peer: " .. peer.name .. " " .. peer.ipAddress .. " " .. macAddr);

return true;

Enumerate All Nodes

Requirements

Enumerate all nodes in NetXMS database.

Solution 1

Create script in script library which will find "Entire Networks" object and walk down the tree. This script can be executes as an action from event processing policy, or directly from server debug console via exec command or on any node.

In order to be able to access info about all nodes, the Objects.Security.CheckTrustedObjects server configuration variable needs to be set to 0 (which is the default).

// This function walks object tree recursively starting from given root
function EnumerateNodes(obj, level)
{
    foreach(o : obj.children) {
        for (i = 0; i < level; i++) { print("  "); }
        println("[" .. o.type .. " / " .. classof(o) .. "] " .. o.name);

        EnumerateNodes(o, level + 1);
    }
}
// Find "Entire Network" object and start enumeration from it
EnumerateNodes(FindObject("Entire Network"), 0);

Solutions 2

When only nodes are required, not walk down the tree then this script can be used:

for (n : GetAllNodes()) {
  println(n.name);
}

Enumerate All Custom Attributes for Node

Requirements

Enumerate all custom attributes on a node.

Solution

attributes = $node.customAttributes;
foreach(a : attributes.keys)
{
        println(a .. "=" .. attributes[a]);
}

Bubble sort with alphabetical sorting

function BubbleSort(a)
{
   n = a.maxIndex + 1;
   do
   {
      newn = 0;
      for(i = 1; i < n; i++)
      {
         if (a[i - 1].compareTo(a[i]) > 0)
         {
            t = a[i - 1];
            a[i - 1] = a[i];
            a[i] = t;
            newn = i;
         }
      }
      n = newn;
   }
   while(n > 1);
   return a;
}

Bubble sort with numeric sorting

function BubbleSort(a)
{
   n = a.maxIndex + 1;
   do
   {
      newn = 0;
      for(i = 1; i < n; i++)
      {
         if (a[i - 1] > a[i])
             {
            t = a[i - 1];
            a[i - 1] = a[i];
            a[i] = t;
            newn = i;
         }
      }
      n = newn;
   }
   while(n > 1);
   return a;
}

Aggregation of DCI values and applying the 95% percentile average

The example is based around a template which configures ICMP Packet Loss probes. This script will loop around the nodes, collect the required DCI values. The values are then ordered and the top 5 percent discarded, the remaining entries are averaged to give the required value;

trace(1, "Global Ping Loss 95");
array pValue;
arrayI  = 0;

foreach(parent : $node.parents)
{
        trace(3, "Parent object: name='" .. parent.name ."' id=" .. parent.id);
        if (parent.name == "all voice")
        {
                foreach(vNode : parent.children)
                {
                        dciName = "ICMP: Packet loss to " .. vNode.name;
                        dciId = FindDCIByDescription(vNode, dciName);
                        if (dciId > 0)
                        {
                                tmpValue = GetDCIValue(vNode,dciId);
                                if (tmpValue != null)
                                {
                                        pValue[arrayI++] = tmpValue;
                                }
                        }
                }
        }
}

// Sort the Array
bubbleSort(pValue);

// Apply the 95 percent rule
upTo = arrayI * 0.95;
pLoss = 0;
pCount = 0;
for(ia = 0; ia < upTo; ia++)
{
        pLoss += pValue[ia];
        pCount = ia;
}
p95AvgLoss = pLoss / pCount;

trace(1, "Global Ping Loss 95 Summary: arrayI=" .. arrayI .. " upTo=" .. upTo .. " p95AvgLoss=" .. p95AvgLoss );

return p95AvgLoss;

function bubbleSort(arr)
{
        swapped = true;
        while (swapped == true){
                swapped = false;
                for(ia = 1; arr[ia] != null; ia++)
                {
                        ib = ia - 1;

                        if (arr[ib] > arr[ia]){
                                trace(3, "swap: " .. ib .. ":" .. arr[ib] .. " with " .. ia .. ":" .. arr[ia]);
                                swapped=true;
                                t = arr[ib];
                                arr[ib] = arr[ia];
                                arr[ia] = t;
                                swapped = true;
                        }
                }
        }
}

function printArray(arr)
{
        for(ia = 0; arr[ia] != null; ia++)
        {
                trace(1, "printArray: " .. ia .. ":" .. arr[ia]);
        }
}

Read SNMP Value From Node

This script can be put into Script Library and run from server’s debug console. It accepts node object name or ID as parameter and prints value of SNMP sysDescription to console.

if ($1 == null)
{
   println("Please specify node name as parameter");
   return 3;
}

transport = FindObject($1).createSNMPTransport();    // Create SNMP transport for node
if (transport == null)
{
    println("Failed to create SNMP transport, exit");
    return 1;
}

value = transport.getValue("1.3.6.1.2.1.1.1.0");
if (value == null)
{
    println("Failed to issue SNMP GET request");
    return 2;
}
else
{
    println("System description: " .. value);
    return 0;
}

Read SNMP octet string as byte

transport = $node.createSNMPTransport();
if (transport == null) exit;

varbind = transport.get("1.3.6.1.2.1.25.3.5.1.2.1");
if (varbind == null) exit;

bytestream = varbind.getValueAsByteStream();

println(bytestream.pos); // after bytestream is created, it's position is set to 0
println("0x" .. d2x(bytestream.readByte(), 2)); // prints the hex value of 0-th byte

Read Table From Agent

This script can be put into Script Library and run from server’s debug console. It accepts node object name or ID as first parameter, table name as second parameter, and prints content of given table to console.

// Find node object
node = FindObject($1);
if (node == null)
{
        println("ERROR: Node not found");
        return;
}

// REad table data from agent
table = AgentReadTable(node, $2);
if (table == null)
{
        println("ERROR: Cannot read table from agent");
        return;
}

// Print column names
for(i = 0; i < table.columnCount; i++)
        print("| " .. left(table.getColumnName(i), 20));
println("|");
for(i = 0; i < table.columnCount; i++)
        print("+" .. left("-", 21, "-"));
println("+");

// Print data
for(i = 0; i < table.rowCount; i++)
{
        for(j = 0; j < table.columnCount; j++)
        {
                print("| " .. left(table.get(i, j), 20));
        }
        println("|");
}

Recursively Collect Values from Custom Attributes

This script recursively collects values of custom attribute contacts from all node parents. Collected values concatenated into single string and separated by semicolons. Duplicate values added only once.

global contacts = "";  // concatenated values will be stored here
global presence = %{ };  // value presence indicator (hash map)

// walk through each parent object for current node
foreach(o : $node.parents)
{
        add_contacts(o);
}

// Concatenated result is in "contacts" global variable
println("Contacts: " .. contacts);

/**
 * Recursively add contacts from object and it's parents
 */
function add_contacts(curr)
{
        c = curr.getCustomAttribute("contacts");
        if ((c != null) && (presence[c] == null))
        {
                if (length(contacts) > 0)
                        contacts = contacts .. ";" .. c;
                else
                        contacts = c;
                presence[c] = true;
        }

        foreach(o : curr.parents)
        {
                add_contacts(o);
        }
}

Setting node geolocation from SNMP

Adjust the OIDs in SNMPGetValue as required.

transport = $node.createSNMPTransport();
if (transport == null) {
  return null;
}

lat = transport.get("1.2.3.4.1");
lon = transport.get("1.2.3.4.2");

if (lat == null || lon == null) {
  return null;
}

geoLoc = new GeoLocation(lat, lon);
$node.setGeoLocation(geoLoc);

return 0;

Object query to list asset values

Saved object query script to list all nodes linked to asset and list values for serial, vendor, model asset properties.

with
        objName (order = "asc", name = "Object name") = {
            return $node.name;
        },

        serial (name = "Serial") = {
                return $node.assetProperties.serial;
        },

        vendorVar (name = "Vendor") = {
                return $node.assetProperties.vendor;
        },

        model (name = "Model") = {
                return $node.assetProperties.model;
        }

(type == NODE) && $node.asset != null //show all nodes linked to asset

Exactly the same script, but without "with" syntax:

if (($object.type == NODE) && $node.asset != null)
{
    global objName (order = "asc", name = "Object name") = $node.name;
    global serial (name = "Serial") = $node.assetProperties.serial;
    global vendorVar (name = "Vendor") = $node.assetProperties.vendor;
    global model (name = "Model") = $node.assetProperties.model;
}
return ($object.type == NODE) && $node.asset != null; //show all nodes linked to asset

Deprecated Functions

This chapter contains deprecated functions that should not be used in new scripts. Each function lists its recommended replacement.

abs()

Deprecated in 5.0.

Please use Math::Abs instead.

abs(number): float

Returns the absolute value of the number.

Parameters

number

Float

Input value.

Return

Absolute value of the input.

>>> abs(12.3)
12.3
>>> abs(-0.307)
0.307

AddrInRange()

Deprecated in 5.0.

Please use inRange() or contains() methods of InetAddress class.

AddrInRange(address, start, end): bool

Check if IP address is within given range. IPv4 and IPv6 are supported.

Parameters

address

String

IP address to check.

start

String

Starting IP address of a range.

end

String

Ending IP address of a range.

Return

TRUE if address is within given range (including both bounding addresses), and FALSE otherwise.

AddrInRange("10.0.0.16", "10.0.0.2", "10.0.0.44")		//	TRUE
AddrInRange("10.0.0.16", "192.168.1.1", "192.168.1.100")	//	FALSE

AddrInSubnet()

Deprecated in 5.0.

Please use sameSubnet() method of InetAddress class.

AddrInSubnet(address, subnet, mask): bool

Checks if given IP address is within given subnet (including subnet and broadcast addresses). IPv4 and IPv6 are supported.

Parameters

address

String

IP address to check.

subnet

String

Subnet address.

mask

String

Subnet mask, either decimal dotted notation or CIDR notation.

Return

TRUE if address is within given subnet (including subnet and broadcast addresses), and FALSE otherwise.

AddrInSubnet("10.0.0.16", "10.0.0.0", "24")		//TRUE
AddrInSubnet("10.0.0.16", "192.168.1.0", "255.255.255.0")	//FALSE

ArrayToString()

Deprecated in 3.0.

Please use join() method of Array.

ArrayToString(array,separator): <<class-string,String>>

Convert array to string

Parameters

array

Array

Array with elements to concatenate

separator

String

Separator between array elements

Return

Concatenated string

a = [1, 2, 3, 4];
b = ArrayToString(a, ";");
println(b); // will print "1;2;3;4"

Base64Decode()

Deprecated in 5.0.

Please use Base64::Decode instead.

Base64Decode(string,encoding): <<class-string,String>>

Decode base64 encoded string. Accepts string to encode and optional character encoding. Valid character encodings are "UTF-8", "UCS-2", "UCS-4", "SYSTEM". Default is UTF-8.

Parameters

string

String

String to decode

encoding

String

String encoding. Optional parameter.

Return

Decoded string

print(Base64Decode("U29tZSB0ZXh0")); //Will print "Some text"

Base64Encode()

Deprecated in 5.0.

Please use Base64::Encode instead.

Base64Encode(): <<class-string,String>>

Encode string as base64. Accepts string to encode and optional character encoding. Valid character encodings are "UTF-8", "UCS-2", "UCS-4", "SYSTEM". Default is UTF-8.

Parameters

string

String

String to encode

encoding

String

String encoding. Optional parameter.

Return

Encoded string

print(Base64Encode("Some text")); //Will print "U29tZSB0ZXh0"

AgentExecuteCommand()

Deprecated in 5.0.

Please use executeAgentCommand() method of NetObj class.

AgentExecuteCommand(node, commandName, …): bool

Execute agent command (action) on given node. Optional arguments starting from 3rd are passed as command arguments to the agent.

Prior to v. 4.2 this function was named AgentExecuteAction
Parameters

node

Node object instance (e.g. $node)

commandName

Name of the command to be executed

Optional arguments for command

Return

Boolean indicator of success

>>> AgentExecuteCommand($node, "System.Restart");
true

>>> AgentExecuteCommand($node, "Custom.RestartService", "jetty9");
true

>>> AgentExecuteCommand($node, "nonexisting action");
false

AgentExecuteCommandWithOutput()

Deprecated in 5.0.

Please use executeAgentCommandWithOutput() method of NetObj class.

AgentExecuteCommandWithOutput(node, commandName, …): String

Execute agent command (action) on given node and collect standard output of the application defined by the command. Optional arguments starting from 3rd are passed as command arguments to the agent.

Prior to v. 4.2. this function was named AgentExecuteActionWithOutput.
Parameters

node

Node object instance (e.g. $node)

commandName

Name of the command to be executed

Optional arguments for command

Return

Output of the command or null if execution failed.

>>> AgentExecuteCommandWithOutput($node, "Custom.Ping", "10.10.8.16");
PING 10.10.8.16 (10.10.8.16): 56 data bytes
64 bytes from 10.10.8.16: icmp_seq=0 ttl=64 time=0.084 ms
64 bytes from 10.10.8.16: icmp_seq=1 ttl=64 time=0.120 ms
64 bytes from 10.10.8.16: icmp_seq=2 ttl=64 time=0.121 ms

AgentReadList()

Deprecated in 3.0.

Please use method readAgentList of class Node.

AgentReadList(node, name): Array

Request list metric directly from agent on given node.

Parameters

node

Node object instance (e.g. $node)

name

List name

Return

Array of strings or null if failed.

>>> supportedLists = AgentReadList($node, "Agent.SupportedLists");
>>> foreach (l : supportedLists) { println(l); }
Agent.ActionList
Agent.SubAgentList
Agent.SupportedLists
Agent.SupportedParameters
Agent.SupportedPushParameters
…

AgentReadParameter()

Deprecated in 3.0.

Please use method readAgentParameter of class Node.

AgentReadParameter(node, name): String

Request metric directly from agent on given node.

Parameters

node

Node object instance (e.g. $node)

name

Metric name

Return

String value or null if failed.

>>> v = AgentReadParameter($node, "Agent.Version")
>>> println(v)
2.2.13

AgentReadTable()

Deprecated in 3.0.

Please use method readAgentTable() of class Node.

AgentReadTable(node, name) ⇒ Table

Request table metric directly from agent on given node.

Parameters

node

Node object instance (e.g. $node)

name

List name

Return

Instance of Table or null if failed.

>>> t = AgentReadTable($node, "Agent.SubAgents");
>>> for (c : t.columns) {
>>>   print(c.name .. " | ");
>>> }
>>> println("");
>>> for (row : t.rows) {
>>>   for(cell : row.values) {
>>>      print(cell .. " | ");
>>>   }
>>>   println("");
>>> }
NAME | VERSION | FILE |
Darwin | 2.2.13 | darwin.nsm |
FILEMGR | 2.2.13-3-g4c02b65c50 | filemgr.nsm |
PING | 2.2.13-3-g4c02b65c50 | ping.nsm |

BindObject()

Deprecated in 3.0.

Please use bind() or bindTo() methods of NetObj class instead.

This function is enabled by default, but can be disabled by setting configuration parameter "NXSL.EnableContainerFunctions".
BindObject(parent, child): void

Bind all NetXMS objects that can be bound from console (nodes, subnets, clusters, and another containers) to container objects.

Parameters

parent

Parent object (NetObj referring to container object or infrastructure service root).

child

The NetXMS object to be linked to given parent object (Node or NetObj referring to subnet, container, or cluster).

Return

None.

BindObject(FindObject(2), $node);    // Link current node directly to "Infrastructure Services"
BindObject(FindObject("Services"), FindObject("Service_1"));    // Link object named "Service_1" to container "Services"

ceil()

Deprecated in 5.0.

Please use Math::Ceil instead.

ceil(input): int

Round up value.

Parameters

input

Input value.

Return

Value round up to nearest integer.

>>> ceil(2.3)
3.0
>>> ceil(3.8)
4.0
>>> ceil(-2.3)
-2.0
>>> ceil(-3.8)
-3.0

cos()

Deprecated in 5.0.

Please use Math::Cos instead.

cos(x): float

Calculates cosine from given angle in radians.

Parameters

x

Float

Angle in rad

Return

Result of cosine for this angle

print(cos(0.5)); //will print 0.877583

CreateContainer()

This function is enabled by default, but can be disabled by setting configuration parameter "NXSL.EnableContainerFunctions".

Deprecated in 5.0.

Please use createContainer() method of Container, Collector or ServiceRoot class instead.

CreateContainer(parent, name) => Container

Create new container under parent object with desired name.

Parameters

parent

Parent object (NetObj referring to container object or infrastructure service root).

name

Name of the container to create

Return

Instance of newly created Container object or null if failed.

CreateNode()

This function is enabled by default, but can be disabled by setting configuration parameter "NXSL.EnableContainerFunctions".

Deprecated in 5.0.

Please use createNode() of Container, Collector or ServiceRoot class instead.

CreateNode(parent, name, primaryHostName, zoneUIN): <<class-node>>

Create node object.

Parameters

parent

NetObj

Parent object

name

String

Name for new node

primaryHostName

String

Primary host name for new node (optional)

zoneUIN

Integer

zone UIN (optional)

Return

New node object or null on failure

CreateSNMPTransport()

Deprecated in 3.0.

Please use method createSNMPTransport of class Node.

CreateSNMPTransport(node, port, context, community) => SNMP_Transport

Create SNMP transport with communication settings defined on the node. It is possible to specify a community string but only community strings listed in Network Credentials will be accepted.

Parameters

node

Target node.

port

Optional parameter with port.

context

Optional parameter with context as a string.

community

Optional parameter with community string as a string.

Return

Instance of SNMPTransport or null if failed.

>>> transport = CreateSNMPTransport(FindObject("Server1"))
>>> print transport.snmpVersion
2c

DeleteCustomAttribute()

Deprecated in 3.0.

Please use deleteCustomAttribute() method of NetObj class instead.

DeleteCustomAttribute(object, name): void

Delete custom attribute name from object.

Parameters

object

Target object.

name

Name of the custom attribute.

Return
>>> DeleteCustomAttribute($node, "test")
>>> test@$node
null

DeleteObject()

Deprecated in 3.0.

Please use delete() method of NetObj class instead.

This function is enabled by default, but can be disabled by setting configuration parameter "NXSL.EnableContainerFunctions".
DeleteObject(object): void

Delete object of class NetObj, Interface, or Node from the system.

Parameters

object

NetXMS object to be deleted. Can be instance of NetObj or any inherited (e.g. Node). Reference to the object can be obtained using FindObject function.

Return

None.

DeleteObject(FindObject("Service_1")); //delete object named Service_1

DriverReadParameter()

Deprecated in 3.0.

DriverReadParameter(object, name): <<class-string,String>>

Request driver-specific metric directly from network device driver (e.g. Rital). Works similarly to AgentReadParameter(), but query device driver insterad.

Parameters

object

node object

name

Name of the metric to query

Return

String value of the metric or null if request failed / metric not supported by driver


EnterMaintenance()

Deprecated in 3.0.

Please use enterMaintenance() method of NetObj class instead.

EnterMaintenance(object): void

Make an object enter Maintenance mode.

Parameters

object

NetObj that will be entered in maintenance mode

Return

None.

EnterMaintenance($node);    // Enter current node in maintenance mode
EnterMaintenance(FindObject("Services"));    // Enter container "Services" in maintenance mode

EventCodeFromName()

Deprecated in 5.0.

EventCodeFromName(name): int

Get event code from event name

Parameters

name

String

Event name

Return

Event code

println(EventCodeFromName("SYS_NODE_DOWN")); // will print "28"

EventNameFromCode()

Deprecated in 5.0.

EventNameFromCode(code): <<class-string,String>>

Get event name from code

Parameters

code

Integer

Event code

Return

Event name

println(EventNameFromCode(28)); // will print "SYS_NODE_DOWN"

ExpandString()

Use of this function is not recommended. Please use expandString method of NetObj, Event or Alarm instead.

ExpandString(string, object, event): <<class-string,String>>

Expand string by replacing macros with their values.

Parameters

string

String to expand

object

Object. Optional, required to expand object-related macros

event

Event object. Optional, required to expand event-related macors

Return

Formated string

>>> ExpandString("%v")
3.5.90
>>> ExpandString("%n", $node)
My node name
>>> ExpandString("%N", $node, $event)
SYS_THRESHOLD_REACHED

floor()

Deprecated in 5.0.

Please use Math::Floor instead.

floor(input): int

Round down value.

Parameters

input

Input value.

Return

Value round down to nearest integer.

>>> floor(2.3)
2
>>> floor(3.8)
3
>>> floor(-2.3)
-3
>>> floor(-3.8)
-4

format()

Deprecated in 5.0.

Please use FormatNumber instead.

format(number, width, precision): <<class-string,String>>

Formats a numeric value.

Parameters

number

Number

The numeric value to format.

width

Number

Minimum number of characters. If the number of characters in the output value is less than the specified width, blanks are added to the left or the right of the values — depending on whether the width is negative (for left alignment) or positive (for right alignment) — until the minimum width is reached. The width specification never causes a value to be truncated.

precision

Number

The number of decimal places. Floating point value will be rounded accordingly.

Return

Formatted numeric value.

format(3.7, 7, 2)		//	"   3.70"
format(3.7, -7, 2)		//	"3.70   "
format(5.7278, 1, 2)	//	"5.73"
format(5.7278, 1, 0)	//	"6"

GetCustomAttribute()

Deprecated in 3.0.

Please use getCustomAttribute() method of NetObj class instead.

GetCustomAttribute(object, name): <<class-string,String>>

Lookup custom attribute of the object.

Alternatively, attributes can be accessed as instance attribues (with ., attribute should exist) or by using attribute@object notion (which will return null instead of runtime error if attribue is missing).

Parameters

object

Object to query.

name

Name of the custom attribute.

Return

String value of the custom attribute of null if not found.

>>> GetCustomAttribute($node, "test")
testvalue
>>> $node.test
testvalue
>>> test@$node
testvalue

GetEventParameter()

Deprecated in 5.0.

Please use getParameter method in Event.

GetEventParameter(event, parameterName): <<class-string,String>>

Get value of event’s named parameter.

Parameters

event

Event

Event object, you can use predefined variable $event to refer to current event.

parameterName

String

Parameter’s name.

Return

String value of requested parameter or null if no such parameter exist.

GetEventParameter($event, "ifName")	// "eth0"
GetEventParameter($event, "bad_name")	// NULL

GetInterfaceName()

Deprecated in 3.4.

Please use getInterface(), getInterfaceByIndex(), getInterfaceByMACAddress() or getInterfaceByName() methods of Node class to get interface object and name attribute to get it’s name.

GetInterfaceName(node, interfaceIndex): <<class-string,String>>

Get interface name by index

Parameters

node

Node

node object

interfaceIndex

Integer

interface index

Return

Interface name as a string

println(GetInterfaceName($node, 1)); //Will print "lo"

GetInterfaceObject()

Deprecated in 3.4.

GetInterfaceObject(node, interfaceIndex) => Interface

Get interface object by index

Parameters

node

Node

node object

interfaceIndex

Integer

interface index

Return

Get node’s interface by it’s index

interface = GetInterfaceObject($node, 1); //Will return interface with index 1
println(interface.ifIndex); //Will print "1"

GetNodeInterfaces()

Deprecated in 3.0.

Please use interfaces attribute in Node.

GetNodeInterfaces(node): void

Get all interfaces for given node.

Parameters

node

Object of class Node.

Return

Array of objects of class Interface, with first object placed at index 0.

// Log names and ids of all interface objects for given node
interfaces = GetNodeInterfaces($node);
for(i : interfaces)
{
	trace(1, "Interface: name='" .. i.name .. "' id=" .. i.id);
}

GetNodeParents()

Deprecated in 3.0.

Please use parents attribute of NetObj class.

GetNodeParents(node): <<class-array,Array>>

Get accessible parent objects for given node.

Parameters

node

Node

Node object

Return

Array of objects of class NetObj or inherited from it, with first object placed at index 0. End of list indicated by array element with null value. Return value also affected by trusted nodes settings.

// Log names and ids of all accessible parents for current node
parents = GetNodeParents($node);
foreach(p : parents)
{
	trace(1, "Parent object: name='" .. p.name .. "' id=" .. p.id);
}

GetNodeTemplates()

Deprecated in 3.0.

Please use templates attribute of DataCollectionTarget.

GetNodeTemplates()

Get template objects applied on given node.

Parameters

node

Node object.

Return

Array of objects, with first object placed at index 0. Return value also affected by trusted nodes settings.

GetObjectChildren()

Deprecated in 3.0.

Please use children attribute in NetObj.

GetObjectChildren(object): <<class-array,Array>>

Return array of child objects for the object.

Parameters

object

Target object.

Return

Array of NetObj instances.

// Log names and ids of all accessible child objects for current node
children = GetObjectChildren($node);
for(p : children)
{
	trace(1, "Child object: name='" .. p.name .. "' id=" .. p.id);
}

GetObjectParents()

Deprecated in 3.0.

Please use parents attribute in NetObj.

GetObjectParents(object): <<class-array,Array>>

Return array of object parents.

Parameters

object

Target object.

Return

Array of NetObj instances.

// Log names and ids of all accessible parents for current node
parents = GetObjectParents($node);
for(p : parents)
{
	trace(1, "Parent object: name='" .. p.name .. "' id=" .. p.id);
}

gmtime()

Deprecated in 5.0.

Please use DateTime class.

gmtime(time) => TIME

Converts time in UNIX format (number of seconds since epoch) to calendar date and time broken down into its components, expressed as UTC (or GMT timezone). Function uses either time given in time argument or current time if time is omitted.

Parameters

time

Integer

Time as seconds since epoch (1 January 1970 00:00:00 UTC). If omitted, current time is used.

Return

Object of class DateTime.

println(gmtime(time()).year);	// 2020
println(gmtime().year);		// 2020

index()

Deprecated in 5.0.

Replaced with method indexOf() of the string instance.

index(string, substring, position): int

Returns the position of the first occurrence of substring in string at or after position if specified. All index values are 1-based (i.e. the first character has index 1, not 0).

Parameters

string

String

The string which will be examined.

substring

String

The string which we will search for.

position

Integer

The starting position in the string to begin our search from the left. Optional parameter

Return

Integer value of the position substring was found at, will return 0 if not found.

println(index("abcdef","cd")); //Will print "3"
println(index("abcdef","cd",4)); //Will print "0"
println(index("abcdefabcdef","cd",4)); //Will print "9"

inList()

Deprecated in 5.0.

Replaced with method split() of the string instance. Sample usage: "b" in "a,b,c".split(",")

inList(string, separator, token): bool

Split input string by separator into elements and compare each element with token.

Parameters

string

Input string.

separator

Elements separator.

token

Pattern to compare with.

Return

True if token is found in input string.

>>> inList("1,2,3", ",", "1")
true
>>> inList("ab|cd|ef", "|", "test")
false

Instance()

Deprecated in 5.0.

Instead of using this function, just return an array with the following values:

  1. instance ({instance} in DCIs)

  2. instance name ({instance-name} in DCIs, optional)

  3. related object (optional)

Unlike previous versions, true is not required as the first value in the array, since presence of the array itself is enough to accept the instance. However, old scripts with four values will still work.

Instance(name, displayName, object): <<class-array,Array>>

This is helper function for instance filter script. It can be used to return accepted item. This function has named parameters.

Parameters

name

String

Instance name ({instance})

displayName

String

Instance display name ({instance-name})

object

NetObj

Related object

Return

Array, where the first value is true, the second is name, the third is displayName and the forth is object.

return Instance(displayName: GetInterfaceName($node, $1), object: GetInterfaceObject($node, $1), name: $1); //This will return correctly formatted array to accept instance

LeaveMaintenance()

Deprecated in 3.0.

Please use leaveMaintenance() method of NetObj class instead.

LeaveMaintenance(object): void

Make an object leave Maintenance mode.

Parameters

object

NetObj that will leave maintenance mode

Return

None.

LeaveMaintenance($node);    // Make current node leave maintenance mode
LeaveMaintenance(FindObject("Services"));    // Make container "Services" leave maintenance mode

left()

Deprecated in 5.0.

Replaced with method left() of the string instance.

left(string, length, pad): <<class-string,String>>

Returns the string of length characters of string, optionally padded with pad character instead of a blank (space).

Parameters

string

String

The string which will be processed.

length

Integer

The number of character to return, must be a positive integer.

pad

String

The pad character to use instead of blank spaces. Optional parameter.

Return

String of the left length characters.

println(left("abc d",8)); //Will print "abc d   "
println(left("abc d",8,".")); //Will print "abc d..."
println(left("abc  def",7)); //Will print "abc  de"

length()

Deprecated in 5.0.

Replaced with method length() of the string instance.

length(string): int

Returns the length of string.

Parameters

string

String

The string to determine its length.

Return

Length of the string passed to the function.

println(length("abcd")); // Will print "4"

localtime()

Deprecated in 5.0.

Please use DateTime class.

localtime(time): void

Converts time in UNIX format (number of seconds since epoch) to calendar date and time broken down into its components, using server time zone. Function uses either time given in time argument or current time if time is omitted.

Parameters

time

Integer

Time as seconds since epoch (1 January 1970 00:00:00 UTC). If omitted, current time is used.

Return

DateTime object.

println(localtime(time()).year); //Will print 2020
println(localtime().year); //Will print 2020

lower()

Deprecated in 5.0.

Replaced with method toLowerCase() of the string instance.

lower(string): <<class-string,String>>

Converts string to lowercase string.

Parameters

string

String

String to convert

Return

Source string converted to lowercase.

println(lower("aBcD")); // Will print "abcd"

ltrim()

Deprecated in 5.0.

Replaced with method trimLeft() of the string instance.

ltrim(string): <<class-string,String>>

Removes blanks (space and tab characters) from the left side of specified string.

Parameters

string

String

String to trim

Return

Source string with blanks at the left side removed.

ltrim("  abc def  "); // Will print "abc def  "

ManageObject()

Deprecated in 3.0.

Please use manage() method of NetObj class.

ManageObject(object): void

Set object into managed state. Has no effect if object is already in managed state.

Parameters

object

NetXMS object to be modified. Can be NXSL class NetObj or any inherited for it. Reference to object can be obtained using FindObject function.

Return
ManageObject(FindObject(125));    // Set object with id 125 to managed state

max()

Deprecated in 5.0.

Please use Math::Max instead.

max(value1, value2, ...): void

Returns maximal value from a list of values.

Parameters

values

Number

Values separated by comma

Return

Maximal value.

max(2, 3, 4, 8); //Will print "8"

min()

Deprecated in 5.0.

Please use Math::Min instead.

min(value1, value2, ...): float

Returns minimal value from a list of values.

Parameters

values

Number

Comma separated values

Return

Minimal value.

println(min(2, 3, 4, 8)); // Will print "2"

mktime()

Deprecated in 5.0.

Please use DateTime class.

mktime(time): void

Converts broken down time (represented by object of DateTime class) to UNIX time (number of seconds since epoch). DateTime object can be returned by localtime or gmtime functions or created using operator new. Broken down time assumed to be local time.

Parameters

time

DateTime

Broken down time.

Return

UNIX time (number of seconds since epoch).

t = new TIME();  // create new TIME object
t.year = 2018;
t.mon = 3;	// April (0-based month numbering)
t.mday = 10;
t.hour = 10;
t.min = 16;
t.sec = 55;
t.isdst = -1;	// auto detect daylight saving
println(mktime(t)); //Will print "1523344615"

pow()

Deprecated in 5.0.

Please use Math::Pow instead.

pow(x, y): float

Calculates x raised to the power of y.

Parameters

x

Float

Initial value.

y

Float

Power.

Return

x raised to the power of y.

println(pow(2, 3)); //Will print "8"

random()

Deprecated in 5.0.

Please use Math::Random instead.

random(minValue, maxValue): int

Generate pseudo random number in given range. Uses cryptographically secure pseudo random generator (CSPRNG)

Parameters

minValue

Integer

Start of range.

minValue

Integer

End of range.

Return

Random value in range minValue..maxValue.

println(random(0, 100)); // Will print random value in 0..100 range

RenameObject()

Deprecated in 3.0.

Please use rename method in NetObj.

RenameObject(object, name): void

Rename object.

Parameters

object

NetXMS object to be renamed. Can be NXSL class NetObj or any inherited for it. Reference to object can be obtained using FindObject function.

name

New name for object.

Return

None.

RenameObject(FindObject(2), "My Services");    // Rename "Infrastructure Services" object

replace()

Deprecated in 5.0.

Replaced with method replace() of the string instance.

replace(string, old, new): <<class-string,String>>

Returns the string with all the occurrences of old substring replaced with the new substring. The replacement proceeds from the beginning of the string to the end, for example, replacing "aa" with "b" in the string "aaa" will result in "ba" rather than "ab".

Parameters

string

String

The string which will be processed.

old

String

Old substring to be replaced

new

String

The new substring, which would replace the old substring. Can be an empty string.

Return

Source string with substrings replaced.

println(replace("one four three","four","two")); //Will print "one two three"
println(replace("abc  def"," ","")); //Will print "abcdef"

right()

Deprecated in 5.0.

Replaced with method right() of the string instance.

right(string, length, pad): <<class-string,String>>

Returns the string of length characters of string, optionally padded with pad character instead of blank (space) starting from the right. Padding occurs on the left portion of the string.

Parameters

string

String

The string which will be processed.

length

Integer

The number of character to return, must be a positive integer.

pad

String

The pad character to use instead of blank spaces. Option parameter.

Return

String of the right length characters.

println(right("abc  d",8)); //Will print "  abc  d"
println(right("abc def",5)); //Will print "c def"
println(right("17",5,"0")); //Will print "00017"

rindex()

Deprecated in 5.0.

Replaced with method lastIndexOf() of the string instance.

rindex(string, substring, position): int

Returns the position of the last occurrence of substring in string up to or before position if specified. All index values are 1-based (i.e. the first character has index 1, not 0).

Parameters

string

String

The string which will be examined.

substring

String

The string which we will search for.

position

Integer

The position in string to start searching back from. Optional parameter.

Return

Integer value of the position substring was found at, will return 0 if not found.

println(rindex("abcdabcd","cd")); // Will print "7"
println(rindex("abcdef","cd",2)); // Will print "0"
println(rindex("abcdefabcdef","cd",4)); // Will print "3"

round()

Deprecated in 5.0.

Please use Math::Round instead.

round(x, precision): float

Round floating point value to the nearest integral value or floating point value with given precision.

Parameters

x

Float

Floating point value.

precision

Integer

Optional number of decimal places to be left. If omitted or set to 0, x will be rounded to integral value.

Return

The integral value that is closest to x if precision is omitted or set to 0, or floating point value rounded to have given number of decimal places.

println(round(2.3)); // Will print "2"
println(round(3.8)); // Will print "4"
println(round(-2.3)); // Will print "-2"
println(round(-3.8)); // Will print "-4"
println(round(2.378, 2)); // Will print "2.38"
println(round(2.378, 1)); // Will print "2.4"

rtrim()

Deprecated in 5.0.

Replaced with method trimRight() of the string instance.

rtrim(string): <<class-string,String>>

Removes blanks (space and tab characters) from the right side of specified string.

Parameters

string

String

Source string

Return

Source string with blanks at the right side removed.

println(rtrim("  abc def  ")); //Will print "  abc def"

SetCustomAttribute()

Deprecated in 3.0.

Please use setCustomAttribute method in NetObj.

SetCustomAttribute(object, name, value): void

Set custom attribute name to value on object.

Parameters

object

Target object.

name

Custom attribute name.

value

Custom attribute value.

Return
>>> SetCustomAttribute($node, "test", "test value")
>>> test@$node
test value

SetEventParameter()

Deprecated in 5.0.

Please use setNamedParameter method in Event.

SetEventParameter(event, parameterName, value): void

Set value of event’s named parameter.

Parameters

event

Event

Event object, you can use predefined variable $event to refer to current event.

parameterName

String

Parameter’s name.

value

String

New value.

Return

No return value

SetEventParameter($event, "customParameter", "new value");

SetInterfaceExpectedState()

Deprecated in 3.0.

Please use setExpectedState() method of Interface class.

SetInterfaceExpectedState(): void

Set expected state for given interface.

Parameters

interface

Interface object. Can be obtained using GetNodeInterfaces or GetInterfaceObject.

state

New expected state for interface. Can be specified as integer code or state name. Interface expected states

Return

None.

// Set expected state to "ignore" for all interfaces of given node
interfaces = GetNodeInterfaces($node);
foreach(i : interfaces)
{
	SetInterfaceExpectedState(i, "IGNORE");
}

sin()

Deprecated in 5.0.

Please use Math::Sin instead.

sin(x): float

Calculates sine from given angle in radians.

Parameters

x

Float

Angle in radian

Return

Result of sine for this angle

print(sin(0.5)); //will print 0.479426

SNMPGet()

Deprecated in 3.0.

Please use get method of SNMPTransport class.

SNMPGet(transport, oid) => SNMP_VarBind

Perform SNMP GET request for oid over provided transport.

Parameters

transport

Transport created by CreateSNMPTransport().

oid

SNMP OID string.

Return

Instance of SNMPVarBind or null on failure.

>>> transport = CreateSNMPTransport(FindObject("Server1"));
>>> if (transport != null) {
>>>   oid = ".1.3.6.1.2.1.25.1.6.0"; // number of running processes
>>>   varbind = SNMPGet(transport, oid);
>>>   if (varbind != null) {
>>>     trace(1, varbind.name .. "=" .. varbind.value);
>>>   }
>>>   else {
>>>     trace(0, "SNMPGet() failed");
>>>   }
>>> }

SNMPGetValue()

Deprecated in 3.0.

Please use getValue method of SNMPTransport class.

SNMPGetValue(transport, oid): <<class-string,String>>

Perform SNMP GET request for oid over provided transport and return single string value instead of varbind.

This function is a wrapper for SNMPGet().

Parameters

transport

Transport created by CreateSNMPTransport().

oid

SNMP OID string.

Return

String value of the result or null on failure.

>>> transport = CreateSNMPTransport(FindObject("Server1"));
>>> if (transport != null) {
>>> oid = ".1.3.6.1.2.1.25.1.6.0"; // number of running processes
>>> value = SNMPGetValue(transport, oid);
>>> if (value != null) {
>>>     trace(1, value);
>>> }
>>> else {
>>>     trace(0, "SNMPGetValue() failed");
>>> }
>>> }

SNMPSet()

Deprecated in 3.0.

Please use set method of SNMPTransport class.

SNMPSet(transport, oid, value, dataType): bool

Perform SNMP SET request for oid over provided transport. Return boolean success indicator. value is automatically converted from string based in dataType. If dataType is not provided, default type "STRING" will be used.

Parameters

transport

oid

SNMP OID string.

value

New value.

dataType

Type of the value, default to "STRING". <<SNMP data types

Return

Boolean. TRUE on success and FALSE in case of failure.

>>> if (!SNMPSet(transport, oid, "192.168.0.1", "IPADDR") {
>>>     trace(1, "SNMPSet failed");
>>> }

SNMPWalk()

Deprecated in 3.0.

Please use walk method of SNMPTransport class.

SNMPWalk(transport, oid): <<class-array,Array>>

Perform SNMP WALK request for oid over provided transport and return collected values as array of SNMPVarBind or null on failure.

Parameters

transport

Transport created by CreateSNMPTransport().

oid

SNMP OID string.

Return

Array of SNMPVarBind or null or failure.

>>> transport = CreateSNMPTransport(FindObject("Server1"));
>>> if (transport != null) {
>>>     oid = ".1.3.6.1.2.1.25.4.2.1.2"; // Names of the running processes
>>>     vars = SNMPWalk(transport, oid);
>>>     if (vars != null) {
>>>         foreach (v: vars) {
>>>             trace(1, v.name .. "=" .. v.value);
>>>         }
>>>     }
>>> }

SplitString()

Deprecated in 5.0.

Replaced with method split() of the string instance.

SplitString(string, separator): <<class-array,Array>>

Split string into array of strings at given separator.

Parameters

string

String

String to split.

separator

String

Separator character. If supplied string is longer than 1 character, it’s first character will be used as separator.

Return

Array with strings

SplitString("a;b;c;d", ";"); //Will be splited to ["a", "b", "c", "d"]
SplitString("abcd", ";"); //Will be splited to ["abcd"]

sqrt()

Deprecated in 5.0.

Please use Math::Sqrt instead.

sqrt(input): float

Gets square root from number.

Parameters

input

Number

Input number.

Return

Square root value.

>>> sqrt(4)
2

strftime()

Deprecated in 5.0.

Please use format() method of DateTime class.

strftime(string, time): <<class-string,String>>

Formats a Unix timestamp, and returns a string according to given formatting rules.

Parameters

string

String

Formatting string - see this for available options http://www.cplusplus.com/reference/ctime/strftime/

time

Integer

UNIX time (number of seconds since epoch).

Return

Formatted time as a string.

println(strftime("%Y-%m-%d %H:%M", time())); //Will print: "2016-01-19 12:14"
println(strftime("%Y-%m-%d %H:%M - timezone %Z - offset from UTC - %z", time())); //Will print: "2016-01-19 12:14 - timezone CET - offset from UTC - +0100"

substr()

Deprecated in 5.0.

Replaced with method substring() of the string instance.

substr(string, n, len): void

Extracts the substring from string that begins at the nth character and is of length len.

Parameters

string

String

Source string.

n

Integer

Starting character index for substring. The n must be a positive whole number. If n is greater than length(string), then empty string is returned.

len

Integer

Length of substring. If you omit length, the rest of the string is returned. Optional parameter.

Return

Extracted substring.

print(substr("abcdef", 3, 2)); //Will print: "cd"
print(substr("abcdef", 8)); //Will print: ""
print(substr("abcdef", 4)); //Will print: "def"

tan()

Deprecated in 5.0.

Please use Math::Tan instead.

tan(x): float

Calculates tangent x

Parameters

x

Float

Angle in radian

Return

Result of tangent for this angle

print(tan(0.5)); //will print 0.546302

trim()

Deprecated in 5.0.

Replaced with method trim() of the string instance.

trim(string): <<class-string,String>>

Removes blanks (space and tab characters) from both sides of specified string.

Parameters

string

String

String to trim

Return

Source string with blanks at both sides removed.

print(trim("  abc def  ")); //will print "abc def"

UnbindObject()

Deprecated in 3.0.

Please use unbind() and unbindFrom() methods of NetObj class instead.

This function is enabled by default, but can be disabled by setting configuration parameter "NXSL.EnableContainerFunctions".
UnbindObject(parent, child): void

Remove (unbind) object from a container.

Parameters

parent

Parent object (NetObj referring to container object or infrastructure service root).

child

The NetXMS object to be unlinked from given parent object (Node or NetObj referring to node, subnet, container, or cluster).

Return

None.

UnbindObject(FindObject("Services"), FindObject("Service_1"));    // Unlink object named "Service_1" from container "Services"

UnmanageObject()

Deprecated in 3.0.

Please use unmanage methods in NetObj.

UnmanageObject(object): void

Set object into unmanaged state. Has no effect if object is already in unmanaged state.

Parameters

object

NetXMS object to be modified. Can be NXSL class NetObj, Node, or Interface. Reference to object can be obtained using FindObject function.

Return

None.

UnmanageObject(FindObject(2));    // Set "Infrastructure Services" object to unmanaged state

upper()

Deprecated in 5.0.

Replaced with method toUpperCase() of the string instance.

upper(string): <<class-string,String>>

Converts string to uppercase.

Parameters

string

String

String to convert

Return

Source string converted to uppercase.

print(upper("aBcD")); //will print "ABCD"

Alphabetical Index

This appendix provides a quick alphabetical reference to all NXSL functions and classes.

Use your browser’s search (Ctrl+F / Cmd+F) to quickly find what you’re looking for.

Functions

Function Category

_exit()

Utility

assert()

Utility

Base64::Decode()

Base64 Package

Base64::Encode()

Base64 Package

CalculateDowntime()

Data Collection

CancelScheduledTasksByKey()

Utility

chr()

String Operations

classof()

Utility

CountryAlphaCode()

Utility

CountryName()

Utility

CountScheduledTasksByKey()

Utility

CreateDCI()

Data Collection

CreateUserAgentNotification()

Utility

Crypto::MD5()

Cryptography Package

Crypto::SHA1()

Cryptography Package

Crypto::SHA256()

Cryptography Package

CurrencyAlphaCode()

Utility

CurrencyExponent()

Utility

CurrencyName()

Utility

d2x()

String Operations

DetectAnomalies()

Data Collection

FindAlarmById()

Events and Alarms

FindAlarmByKey()

Events and Alarms

FindAlarmByKeyRegex()

Events and Alarms

FindAccessPointByMACAddress()

Object Navigation

FindAllDCIs()

Data Collection

FindDCIByDescription()

Data Collection

FindDCIByName()

Data Collection

FindDCIByTag()

Data Collection

FindDCIByTagPattern()

Data Collection

FindNodeByAgentId()

Object Navigation

FindNodeByIPAddress()

Object Navigation

FindNodeByMACAddress()

Object Navigation

FindNodeBySysName()

Object Navigation

FindNodeObject()

Object Navigation

FindObject()

Object Navigation

FindObjectByGUID()

Object Navigation

FindVendorByMACAddress()

Utility

FormatMetricPrefix()

String Operations

FormatNumber()

String Operations

GetAllNodes()

Object Navigation

GetAvailablePackages()

Utility

GetAvgDCIValue()

Data Collection

GetConfigurationVariable()

Utility

GetCurrentTime()

Time and Date

GetCurrentTimeMs()

Time and Date

GetDCIObject()

Data Collection

GetDCIRawValue()

Data Collection

GetDCIValue()

Data Collection

GetDCIValueByDescription()

Data Collection

GetDCIValueByName()

Data Collection

GetDCIValueByTag()

Data Collection

GetDCIValueByTagPattern()

Data Collection

GetDCIValues()

Data Collection

GetDCIValuesEx()

Data Collection

GetMappingTableKeys()

Utility

GetMaxDCIValue()

Data Collection

GetMinDCIValue()

Data Collection

GetMonotonicClockTime()

Time and Date

GetServerNode()

Object Navigation

GetServerNodeId()

Object Navigation

GetServerQueueNames()

Utility

GetSumDCIValue()

Data Collection

GetSyslogRuleCheckCount()

Utility

GetSyslogRuleMatchCount()

Utility

GetThreadPoolNames()

Utility

IO::CopyFile()

File I/O Package

IO::CreateDirectory()

File I/O Package

IO::DeleteFile()

File I/O Package

IO::FileAccess()

File I/O Package

IO::OpenFile()

File I/O Package

IO::RemoveDirectory()

File I/O Package

IO::RenameFile()

File I/O Package

IsMarkdownComment()

Utility

JsonParse()

Utility

LevenshteinDistance()

String Operations

LoadEvent()

Events and Alarms

map()

Utility

mapList()

Utility

Math::Abs()

Math Package

Math::Acos()

Math Package

Math::Asin()

Math Package

Math::Atan()

Math Package

Math::Atan2()

Math Package

Math::Atanh()

Math Package

Math::Average()

Math Package

Math::Ceil()

Math Package

Math::Cos()

Math Package

Math::Cosh()

Math Package

Math::Exp()

Math Package

Math::Floor()

Math Package

Math::Log()

Math Package

Math::Log10()

Math Package

Math::Max()

Math Package

Math::MeanAbsoluteDeviation()

Math Package

Math::Min()

Math Package

Math::Pow()

Math Package

Math::Pow10()

Math Package

Math::Random()

Math Package

Math::Round()

Math Package

Math::Sin()

Math Package

Math::Sinh()

Math Package

Math::Sqrt()

Math Package

Math::StandardDeviation()

Math Package

Math::Sum()

Math Package

Math::Tan()

Math Package

Math::Tanh()

Math Package

Math::Weierstrass()

Math Package

Net::GetLocalHostName()

Network Package

Net::ResolveAddress()

Network Package

Net::ResolveHostname()

Network Package

ord()

String Operations

PollerTrace()

Utility

PostEvent()

Events and Alarms

PostEventEx()

Events and Alarms

print()

Utility

println()

Utility

PushDCIData()

Data Collection

QueryAIAssistant()

Utility

range()

Utility

ReadPersistentStorage()

Utility

RegisterAITask()

Utility

SecondsToUptime()

Time and Date

SendMail()

Utility

SendNotification()

Utility

SimilarityScore()

String Operations

sleep()

Utility

time()

Time and Date

trace()

Utility

typeof()

Utility

WritePersistentStorage()

Utility

x2d()

String Operations

Deprecated Functions

These functions are deprecated and should not be used in new scripts. See Deprecated Functions for replacement recommendations.

Function Replacement

abs()

Math::Abs()

AddrInRange()

InetAddress::inRange()

AddrInSubnet()

InetAddress::sameSubnet()

AgentExecuteCommand()

Node method

AgentExecuteCommandWithOutput()

Node method

AgentReadList()

Node::readAgentList()

AgentReadParameter()

Node::readAgentParameter()

AgentReadTable()

Node::readAgentTable()

ArrayToString()

Array::join()

Base64Decode()

Base64::Decode()

Base64Encode()

Base64::Encode()

BindObject()

NetObj::bind()

ceil()

Math::Ceil()

cos()

Math::Cos()

CreateContainer()

Container/ServiceRoot method

CreateNode()

Container/ServiceRoot method

CreateSNMPTransport()

Node method

DeleteCustomAttribute()

NetObj::deleteCustomAttribute()

DeleteObject()

NetObj::delete()

DriverReadParameter()

Node::readDriverParameter()

EnterMaintenance()

NetObj::enterMaintenance()

EventCodeFromName()

Event attribute

EventNameFromCode()

Event attribute

ExpandString()

String method

floor()

Math::Floor()

format()

FormatNumber()

GetCustomAttribute()

NetObj::getCustomAttribute()

GetEventParameter()

Event attribute

GetInterfaceName()

Interface attribute

GetInterfaceObject()

Node::getInterface()

GetNodeInterfaces()

Node attribute

GetNodeParents()

NetObj attribute

GetNodeTemplates()

Node attribute

GetObjectChildren()

NetObj attribute

GetObjectParents()

NetObj attribute

gmtime()

DateTime class

index()

String::indexOf()

inList()

Array method

Instance()

classof()

LeaveMaintenance()

NetObj::leaveMaintenance()

left()

String::left()

length()

String::length

localtime()

DateTime class

lower()

String::toLowerCase()

ltrim()

String::trimLeft()

ManageObject()

NetObj method

max()

Math::Max()

min()

Math::Min()

mktime()

DateTime class

pow()

Math::Pow()

random()

Math::Random()

RenameObject()

NetObj attribute

replace()

String::replace()

right()

String::right()

rindex()

String::lastIndexOf()

round()

Math::Round()

rtrim()

String::trimRight()

SetCustomAttribute()

NetObj method

SetEventParameter()

Event method

SetInterfaceExpectedState()

Interface method

sin()

Math::Sin()

SNMPGet()

SNMPTransport method

SNMPGetValue()

SNMPTransport method

SNMPSet()

SNMPTransport method

SNMPWalk()

SNMPTransport method

SplitString()

String::split()

sqrt()

Math::Sqrt()

strftime()

DateTime::format()

substr()

String::substring()

tan()

Math::Tan()

trim()

String::trim()

UnbindObject()

NetObj::unbind()

UnmanageObject()

NetObj method

upper()

String::toUpperCase()

Classes

Class Domain

AccessPoint

Network Objects

Alarm

Events and Alarms

AlarmComment

Events and Alarms

Asset

Infrastructure

AssetProperties

Infrastructure

BusinessService

Infrastructure

BusinessServiceCheck

Infrastructure

ByteStream

Data Structures

Chassis

Infrastructure

Circuit

Network Objects

Class

Data Structures

ClientSession

Users and Security

Cluster

Infrastructure

Collector

Infrastructure

Component

Hardware and Software

Container

Infrastructure

DataCollectionTarget

Base Classes

DataPoint

Data Collection

DateTime

Data Structures

DCI

Data Collection

DeploymentPackage

Hardware and Software

DiscoveredInterface

Discovery and Diagnostics

DiscoveredNode

Discovery and Diagnostics

DowntimeInfo

Discovery and Diagnostics

Event

Events and Alarms

FILE

Data Structures

GeoLocation

Networking Utilities

HardwareComponent

Hardware and Software

InetAddress

Networking Utilities

Interface

Network Objects

JsonArray

Data Structures

JsonObject

Data Structures

LDAPObject

LDAP Integration

LinkDataSource

Data Collection

MacAddress

Networking Utilities

MaintenanceJournalRecord

Discovery and Diagnostics

MobileDevice

Infrastructure

NetObj

Base Classes

NetworkMap

Network Objects

NetworkMapLink

Network Objects

NetworkPathCheckResult

Discovery and Diagnostics

Node

Network Objects

NodeDependency

Discovery and Diagnostics

Object

Base Classes

OSPFArea

OSPF and Routing

OSPFNeighbor

OSPF and Routing

RadioInterface

Hardware and Software

Range

Data Structures

ScoredDciValue

Data Collection

Sensor

Infrastructure

ServiceRoot

Infrastructure

SNMPTransport

Networking Utilities

SNMPVarBind

Networking Utilities

SoftwarePackage

Hardware and Software

SSHSession

Networking Utilities

Subnet

Network Objects

Table

Data Collection

TableColumn

Data Collection

TableRow

Data Collection

Template

Infrastructure

Tunnel

Network Objects

User

Users and Security

UserDBObject

Users and Security

UserGroup

Users and Security

VLAN

Network Objects

WebService

Networking Utilities

WebServiceResponse

Networking Utilities

WirelessDomain

Network Objects

WirelessStation

Network Objects

Zone

Network Objects