NXSL
NXSL
http://netxms.org/
Script security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Language syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Built-in Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
String literals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Function Declaration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Function Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
String attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
String methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Array Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Array attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Array methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Array conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Hash maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Assignment Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Bitwise Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Incrementing/Decrementing Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
String Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Control structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
if. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
else . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
do-while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
break. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
continue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
with . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
exit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Short-circuit evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Regular expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Function Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
ArrayToString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
chr(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
d2x() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
format() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
index() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
inList() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
left(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
length() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
lower() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
ltrim() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
ord() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
replace() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
right() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
rindex() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
rtrim(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
SplitString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
substr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
trim(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
upper() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
x2d() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
abs() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
acos(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
asin() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
atan() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
atan2() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
ceil() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
cos(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
cosh() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
exp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
floor() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
log() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
log10(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
max(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
min() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
pow(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
round() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
sin() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
sinh(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
sqrt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
tan(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
tanh() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
GetCurrentTimeMs() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
gmtime(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
localtime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
mktime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
strftime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
time() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
BindObject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
CreateContainer() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
CreateNode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
DeleteCustomAttribute() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
DeleteObject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
EnterMaintenance() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
ExpandString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
FindNodeByAgentId() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
FindNodeByIPAddress() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
FindNodeByMACAddress() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
FindNodeBySysName(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
FindNodeObject(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
FindObject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
FindObjectByGUID() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
GetAllNodes() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
GetCustomAttribute() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
GetInterfaceName(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
GetInterfaceObject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
GetNodeInterfaces() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
GetNodeParents(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
GetNodeTemplates() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
GetObjectChildren() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
GetObjectParents() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
GetServerNode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
GetServerNodeId(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
LeaveMaintenance() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
ManageObject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
RenameObject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
SetCustomAttribute() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
SetInterfaceExpectedState() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
UnbindObject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
UnmanageObject(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Data collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
CreateDCI() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
FindAllDCIs(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
FindDCIByDescription() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
FindDCIByName() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
GetAvgDCIValue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
GetDCIObject() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
GetDCIRawValue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
GetDCIValue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
GetDCIValueByDescription() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
GetDCIValueByName() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
GetDCIValues() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
GetMaxDCIValue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
GetMinDCIValue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
GetSumDCIValue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
PushDCIData() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Agent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
AgentExecuteCommand() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
AgentExecuteCommandWithOutput() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
AgentReadList() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
AgentReadParameter() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
AgentReadTable() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Alarms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
FindAlarmById() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
FindAlarmByKey(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
FindAlarmByKeyRegex() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
GetEventParameter() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
SetEventParameter(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
LoadEvent(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
PostEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
PostEventEx() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Miscelanious . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
_exit() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
AddrInRange() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
AddrInSubnet() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
assert() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
classof() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
CountryAlphaCode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
CountryName(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
CountScheduledTasksByKey() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
CreateUserAgentNotification() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
CurrencyAlphaCode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
CurrencyExponent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
CurrencyName() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
DriverReadParameter() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
EventCodeFromName() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
EventNameFromCode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
FormatMetricPrefix() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
FindVendorByMACAddress() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
GetConfigurationVariable() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
gethostbyaddr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
gethostbyname() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
GetServerQueueNames() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
GetSyslogRuleCheckCount() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
GetSyslogRuleMatchCount() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
GetThreadPoolNames() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Instance() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
JsonParse(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
map() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
mapList() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
print() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
println() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
random() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
ReadPersistentStorage() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
SecondsToUptime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
SendMail() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
SendNotification() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
sleep() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
trace() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
typeof() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
PollerTrace() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
WritePersistentStorage() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
weierstrass() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Situations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
FindSituation() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
GetSituationAttribute(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Base64Decode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Base64Encode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
md5() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
sha1() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
sha256() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
SNMP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
CreateSNMPTransport(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
SNMPGet() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
SNMPGetValue(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
SNMPSet() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
SNMPWalk() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
CopyFile(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
CreateDirectory(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
DeleteFile() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
FileAccess() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
OpenFile() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
RemoveDirectory() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
RenameFile() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
AccessPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Alarm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
AlarmComment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Asset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
BusinessServiceCheck. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
ByteStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Chassis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
ClientSession . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Cluster. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
DataCollectionTarget. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
DCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
DiscoveredInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
DiscoveredNode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
FILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
GeoLocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
HardwareComponent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
InetAddress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
JsonArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
JsonObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
LDAPObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
MaintenanceJournalRecord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
MobileDevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
NetObj. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
NodeDependency. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
OSPFArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Instance attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
OSPFNeighbor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
SNMPTransport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
SNMPVarBind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
SoftwarePackage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Subnet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
TableColumn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
TableRow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Tunnel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
UserDBObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
UserGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Instance attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
VLAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
WebService . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
WebServiceResponse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Zone. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
NXSL::BuildTag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
NXSL::Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
NXSL::Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
NXSL::SystemIsBigEndian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
NXSL::Version. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Solution 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Solutions 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Aggregation of DCI values and applying the 95% percentile average . . . . . . . . . . . . . . . . . . . . . . . . 217
1
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 such strict security checks are not required (for example, all users have
read access to all nodes), they can be disabled to simplify configuration. Enforcement of trusted
nodes checking controlled by server’s configuration variable CheckTrustedNodes. By default it is set
to 1 and check of trusted nodes is enforced. To disable it, server’s configuration variable
CheckTrustedNodes must be set to 0. The server restart is required to make this change effective.
2
Language syntax
Built-in Types
The following sections describe the standard types that are built into the interpreter.
NXSL is loose 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.
• 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
3
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.
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
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;
4
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. Variable can be declared global using global operator.
For example:
x = 1;
myFunction();
sub myFunction()
{
println("x=" . x);
}
This script will cause run time error Error 5 in line 6: Invalid operation with NULL value,
because variable x is local (in implicit main function) and is not visible in function myFunction. The
following script will produce expected result (prints x=1):
global x = 1;
myFunction();
sub myFunction()
{
println("x=" . x);
}
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 use keywords.
5
sub NAME ( ARGUMENTS ) BLOCK
where NAME is any valid identifier, ARGUMENTS is optional list of argument names, and BLOCK is code
block.
NAME ( LIST )
where NAME is identifier used in function definition, and LIST is an optional list of expressions
passed as function arguments.
sub message()
{
println("Hello!");
}
Function Arguments
The first argument you pass to the function is available within the function as $1, the second
argument is $2, and so on. For example, this simple function adds two numbers and prints the
result:
sub add()
{
result = $1 + $2;
println("The result was: " . result);
}
add(1, 2);
If you want named arguments, list of aliases for $1, $2, etc. can be provided in function declaration
inside the brackets:
If parameter was not provided at function call, value of appropriate variable will be NULL.
6
Another option to name parameters is to provide named parameters inside of function. In this case
leave braces of function empty and add names to function call. In this case parameters will be
available in function as $parameterName.
Example:
sub func()
{
println($param1); //Will print "text1"
println($param2); //Will print "text2"
}
The arguments received by script when it was launched are available in a global variable $ARGS,
which is an array that contains all arguments. First argument available as $ARGS[1];
You can return a value from a function using the return keyword:
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.
If an explicit main() doesn’t exist, an implicit $main() function will be created by the script
interpreter and the script will enter at the $main() function.
The $main() function is constructed from code that is not a part of any other functions.
7
Calling library script functions
You can call functions from scripts that are stored in Script Library. One way is to use the use
keyword accompanied by the name of the script:
use my_math_library;
println( add(1, 2) );
println( my_math_library::add(1, 2) );
Strings
Strings are not objects, it’s a separate variable type. However, strings have methods and attributes
described below
String attributes
isEmpty ⇒ Boolean
Returns "true" if string is empty or "false" otherwise.
Example
s = "";
println(s->isEmpty); // prints "true"
length ⇒ Integer
Returns number of characters in the string.
Example
s = "1234567890";
println(s->length); // prints '10'
String methods
compareTo(string) ⇒ Integer
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.
8
Example
compareToIgnoreCase(string) ⇒ Integer
Same as compareTo, but ignoring the case.
Example
contains(string) ⇒ Boolean
Returns true` if this string contains the argument string or false otherwise.
Example
endsWith(string) ⇒ Boolean
Returns true` if this string ends with the argument string or false otherwise.
Example
equalsIgnoreCase(string) ⇒ Boolean
Returns true` if argument string is equal to this string ignoring the case or false otherwise.
Example
indexOf(string) ⇒ Integer
Returns index of first occurence of argument string in this string or -1 if the argument is not a
substring of the string.
Example
9
println("ABC-DEF-GHI"->indexOf("JKL")); // prints "-1"
lastIndexOf(string) ⇒ Integer
Returns index of last occurence of argument string in this string or -1 if the argument is not a
substring of the string.
Example
left(numberOfCharacters) ⇒ String
Returns left numberOfCharacters of this string.
Example
Example
right(numberOfCharacters) ⇒ String
Returns right numberOfCharacters of this string.
Example
split(separator) ⇒ Array
Split string into array of strings at given separator.
Example
startsWith(string) ⇒ Boolean
Returns true` if this string starts with the argument string or false otherwise.
Example
10
println("Just a sentence"->startsWith("Just a")); // prints "true"
Example
toLowercase() ⇒ String
Converts this string to lowercase.
Example
toUpperCase() ⇒ String
Converts this string to uppercase.
Example
trim() ⇒ String
Returns this string with whitespace from both sides removed.
Example
trimLeft() ⇒ String
Returns this string with whitespace from left side removed.
Example
trimRight() ⇒ String
Returns this string with whitespace from right side removed.
Example
11
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 sub array from the array use [a:b] operator. This operator returns sub array of an array
from the element with index a inclusive till the element with index b exclusive. If a is omitted then
sub array will be taken from the start of the array and if b is omitted then sub array 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
New array can be created in two ways. First is to use array operator. This statement will create
empty array and assign reference to it to variable a.
array a;
You can then assign values to the array. Please note arrays in NXSL are sparse, so indices can
contain gaps.
array a;
a[1] = 1;
a[2] = 2;
a[260] = 260;
println(a[1]); // will print 1
12
println(a); // will print "[1, 2, 260]"
Second way is to use %( ) construct to create array already populated with values.
This statement will create array with four elements at positions 0, 1, 2, and 3, and assign reference
to this array to variable a.
sub 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.
Array attributes
maxIndex ⇒ Integer
Returns highest index in the array.
Example
a = %(1, 2, 3);
println(a->maxIndex); // prints '2'
println(a[a->maxIndex]); // prints '3'
minIndex ⇒ Integer
Returns lowest index in the array.
Example
a = %(1, 2, 3);
println(a->minIndex); // prints '0'
size ⇒ Integer
Returns number of elements in the array.
13
Example
a = %(1, 2, 3);
println(a->size); // prints '3'
Array methods
append(newElement) ⇒ Integer
Appends new element to the array. Returns highest index in the array - that’s index of the
appended element.
Example
a = %("a","b","c");
a->append("d");
println(a); // prints '[a, b, c, d]'
appendAll(anotherArray) ⇒ Integer
Appends elements of anotherArray to the array. Returns highest index in the array.
Example
a = %(1,2);
b = %(3,4);
a->appendAll(b);
println(a); // prints '[1, 2, 3, 4]'
Example
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.
14
Example
a = %(1,2);
b = %(3,4);
a->insertAll(1,b);
println(a); // prints '[1, 3, 4, 2]'
Example
a = %();
a->push("one");
a->push("two");
println(a->pop());
println(a->pop());
push(newElement) ⇒ Integer
Same as append().
remove(index) ⇒ void
Removes element at specified index. Indexes of elements that have index greater or equal to
index are decremented.
Example
a = %(1,2,3);
a->remove(0);
println(a);
Array conversion
Array can be converted to string. string(array) function is used to get string representation of
array. The string representation consists of a list of the array’s elements, enclosed in square
brackets (“[]”). Adjacent elements are separated by the characters “, ” (a comma followed by a
space).
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]]"
15
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"];
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};
keys ⇒ Array
Returns array with keys of items in the hash map.
Example
h = %{100:"value1", 101:"value2"};
println(h->keys); // prints '[100,101]'
size ⇒ Integer
Returns number of items in the hash map.
Example
values ⇒ Array
Returns array with values of items in the hash map.
16
Example
h = %{"key1":123, "key2":456};
println(h->keys); // prints '[123,456]'
contains(key) ⇒ Boolean
Returns true, if hash map contains specified key or false otherwise.
Example
h = %{"key1":123, "key2":456};
println(h->contains("key2")); // prints 'true'
remove(key) ⇒ void
Removes item with specified key.
Example
h = %{"key1":123, "key2":456};
h->remove("key1");
println(h); // prints '{key2=456}'
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).
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
17
Example Name Result
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.
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
Comparison Operators
18
Example Name Result
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:
Note that strings which actually contain number are converted to numeric type prior to
comparison. So, for example:
s1 = "1";
s2 = "1.0";
19
i = 1;
println(s1 == s2); // prints "true"
println(s1 == i); // prints "true"
Incrementing/Decrementing Operators
Logical Operators
String Operators
20
Example Name Result
[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.
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
21
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:
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.
22
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");
}
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");
23
}
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.
24
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 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:
25
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.
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
26
Tutorial
Syntactically, NXSL looks similar to Perl or C. Here’s simple NXSL program:
/* sample program */
sub main()
{
println("Hello!");
return 0;
}
Also, keep in mind that you are free to choose your own formatting style. E.g. the above could have
been written as:
/* sample program */
Everything inside /* */ is considered a comment and will be ignored by interpreter. You can
enclose comments, like below:
sub main()
{
}
This is a function definition. A function is a part of a program that can be called by other parts of
the program. A function definition always has the following form:
sub name(parameters)
{
27
// the function code goes here
}
The function can return a value to the caller and accept zero or more parameters.
The function name follows the rules for all names (formally: identifiers): it must consist entirely of
letters (uppercase and lowercase are different!), digits, underscores (_) and dollar signs ($), but may
not begin with a digit. Please note that most special identifiers starts with dollar sign ($), so it is
recommended not to start your identifiers with it.
println("Hello!");
In this line, println is an embedded operator which prints given string to standard output with
carriage return, and "Hello!" is a string we want to print. Please note semicolon at the end of line –
it’s a separator between operators. Each operator should end with semicolon.
return 0;
return is another built-in operator which exits the function and sets it’s return value.
28
Function Reference
Strings
ArrayToString()
Parameters
Return
Concatenated string
Example
a = %(1, 2, 3, 4);
b = ArrayToString(a, ";");
println(b); // will print "1;2;3;4"
chr()
Parameters
Return
A string consisting of single character.
Example
d2x()
29
Convert decimal devValue to hex string with optional left-padding with zeroes.
Parameters
Return
Hex string.
Example
>>> d2x(1234)
4D2
>>> d2x(1234, 8)
000004D2
format()
Parameters
precision Number The number of decimal places. Floating point value will be
rounded accordingly.
Return
Formatted numeric value.
Example
30
index()
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
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.
Example
inList()
Split input string by separator into elements and compare each element with token.
Parameters
Return
True if token is found in input string.
Example
31
left()
Returns the string of length characters of string, optionally padded with pad character instead of a
blank (space).
Parameters
pad String The pad character to use instead of blank spaces. Optional
parameter.
Return
String of the left length characters.
Example
length()
Parameters
Return
Length of the string passed to the function.
Example
lower()
32
Converts string to lowercase string.
Parameters
Return
Source string converted to lowercase.
Example
ltrim()
Removes blanks (space and tab characters) from the left side of specified string.
Parameters
Return
Source string with blanks at the left side removed.
Example
ord()
Parameters
Return
An ASCII/Unicode value
Example
33
println(ord("abc")); //Will pritn 97
replace()
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
new String The new substring, which would replace the old substring.
Can be an empty string.
Return
Source string with substrings replaced.
Example
right()
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
pad String The pad character to use instead of blank spaces. Option
parameter.
Return
String of the right length characters.
34
Example
rindex()
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
Return
Integer value of the position substring was found at, will return 0 if not found.
Example
rtrim()
Removes blanks (space and tab characters) from the right side of specified string.
Parameters
Return
Source string with blanks at the right side removed.
Example
35
SplitString()
Parameters
Return
Array with strings
Example
substr()
Extracts the substring from string that begins at the nth character and is of length len.
Parameters
len Integer Length of substring. If you omit length, the rest of the
string is returned. Optional parameter.
Return
Extracted substring.
Example
36
trim()
Removes blanks (space and tab characters) from both sides of specified string.
Parameters
Return
Source string with blanks at both sides removed.
Example
upper()
Parameters
Return
Source string converted to uppercase.
Example
x2d()
Parameters
Return
Converted value.
37
Example
>>> x2d("4D2")
1234
Math
abs()
Parameters
Return
Absolute value of the input.
Example
>>> abs(12.3)
12.3
>>> abs(-0.307)
0.307
acos()
Parameters
Return
The angle in radians whose cosine is x
Example
38
asin()
Parameters
Return
The angle in radians whose sine is x
Example
atan()
Parameters
Return
The angle in radians whose arc tangent is x
Example
atan2()
Parameters
39
Return
The angle in radians
Example
ceil()
Round up value.
Parameters
Return
Value round up to nearest integer.
Example
>>> ceil(2.3)
3.0
>>> ceil(3.8)
4.0
>>> ceil(-2.3)
-2.0
>>> ceil(-3.8)
-3.0
cos()
Parameters
Return
Result of cosine for this angle
40
Example
cosh()
Parameters
Return
Result of hyperbolic cosine for this angle
Example
exp()
Parameters
Return
Result of the exponential function
Example
>>> exp(2)
7.3890561
floor()
41
Parameters
Return
Value round down to nearest integer.
Example
>>> floor(2.3)
2
>>> floor(3.8)
3
>>> floor(-2.3)
-3
>>> floor(-3.8)
-4
log()
Parameters
Return
Natural logarithm of x.
Example
log10()
Parameters
Return
Logarithm of x to base 10.
42
Example
max()
Parameters
Return
Maximal value of numbers.
Example
min()
Parameters
Return
Minimal value of numbers.
Example
pow()
Parameters
43
x Number Initial value.
y Number Power.
Return
x raised to the power of y.
Example
round()
Round floating point value to the nearest integral value or floating point value with given precision.
Parameters
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.
Example
sin()
Parameters
Return
44
Result of sine for this angle
Example
sinh()
Parameters
Return
Result of hyperbolic sine for this angle
Example
sqrt()
Parameters
input Number
Return
Square root value.
Example
>>> sqrt(4)
2
tan()
45
Calculates tangent x
Parameters
Return
Result of tangent for this angle
Example
tanh()
Parameters
Return
Result of hyperbolic tangent for this angle
Example
Time
GetCurrentTimeMs()
Return
Current time in milliseconds
Example
>>> GetCurrentTimeMs()
1674586722493
46
gmtime()
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
Return
Object of class TIME.
Example
println(gmtime(time())->year); // 2020
println(gmtime()->year); // 2020
localtime()
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
Return
TIME object.
Example
mktime()
47
Converts broken down time (represented by object of TIME class) to UNIX time (number of seconds
since epoch). TIME object can be returned by localtime or gmtime functions or created using
operator new. Broken down time assumed to be local time.
Parameters
Return
UNIX time (number of seconds since epoch).
Example
strftime()
Formats a Unix timestamp, and returns a string according to given formatting rules.
Parameters
Return
Formatted time as a string.
Example
time()
48
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).
Example
Objects
BindObject()
Bind all NetXMS objects that can be bound from console (nodes, subnets, clusters, and another
containers) to container objects.
Parameters
child The NetXMS object to be linked to given parent object (Node or NetObj
referring to subnet, container, or cluster).
Return
None.
Example
49
CreateContainer()
Parameters
Return
Instance of newly created Container object or null if failed.
Example
CreateNode()
Parameters
Return
New node object or null on failure
Example
50
DeleteCustomAttribute()
Parameters
Example
DeleteObject()
Parameters
Return
None.
51
Example
EnterMaintenance()
Parameters
Return
None.
Example
ExpandString()
Parameters
Return
52
Formated string
Example
>>> ExpandString("%v")
3.5.90
>>> ExpandString("%n", $node)
My node name
>>> ExpandString("%N", $node, $event)
SYS_THRESHOLD_REACHED
FindNodeByAgentId()
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
Return
Instance of Node object or null if not found or not accessible.
Example
FindNodeByIPAddress()
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
53
ipaddress String IP address.
Return
Instance of Node object or null if not found or not accessible.
Example
FindNodeByMACAddress()
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
Return
Instance of Node object or null if not found or not accessible.
Example
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()
If trusted node validation is enforced, currentNode should point to execution context object
54
(instance of NetObj, $node in most cases). If trusted nodes are disabled (default server
configuration), currentNode can be omitted or set to null.
Parameters
Return
Instance of Node object or null if not found or not accessible.
Example
node = FindNodeBySysName("switch-main");
if (node != NULL) println(node->name); // Prints node name if node with given sysName
is found
FindNodeObject()
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
Return
Instance of Node object or null if not found or not accessible.
Example
55
FindObject()
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
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().
Example
FindObjectByGUID()
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
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().
56
Example
GetAllNodes()
Return
Array of node objects.
Example
6766 - demo-netxms
6901 - Control Unit 1
6902 - Control Unit 2
GetCustomAttribute()
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
Return
57
String value of the custom attribute of null if not found.
Example
GetInterfaceName()
Parameters
Return
Interface name as a string
Example
GetInterfaceObject()
58
Get interface object by index
Parameters
Return
Get node’s interface by it’s index
Example
GetNodeInterfaces()
Parameters
Return
Array of objects of class Interface, with first object placed at index 0.
Example
// 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()
59
GetNodeParents(node) => Array
Parameters
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.
Example
// 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()
GetNodeTemplates()
Parameters
Return
Array of objects, with first object placed at index 0. Return value also affected by trusted nodes
settings.
GetObjectChildren()
This function is deprecated starting from version 3.0. Please use children
attribute in NetObj.
60
GetObjectChildren(object) => Array
Parameters
Return
Array of NetObj instances.
Example
// 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()
This function is deprecated starting from version 3.0. Please use parents
attribute in NetObj.
Parameters
Return
Array of NetObj instances.
Example
// 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);
}
61
GetServerNode()
Return
Node instance.
Example
>>> GetServerNode()
Node@0x7facac2889e0
GetServerNodeId()
Return
ID of node instance.
Example
>>> GetServerNodeId()
161
LeaveMaintenance()
Parameters
Return
None.
62
Example
ManageObject()
This function is deprecated starting from version 3.0. Please use manage
functions in NetObj.
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.
Example
RenameObject()
This function is deprecated starting from version 3.0. Please use rename
method in NetObj.
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.
Return
None.
63
Example
SetCustomAttribute()
Parameters
Example
SetInterfaceExpectedState()
Parameters
state New expected state for interface. Can be specified as integer code or state
name. Interface expected states
64
Return
None.
Example
UnbindObject()
Parameters
child The NetXMS object to be unlinked from given parent object (Node or
NetObj referring to node, subnet, container, or cluster).
Return
None.
Example
UnmanageObject()
65
UnmanageObject(object) => void
Set object into unmanaged state. Has no effect if object is already in unmanaged state.
Parameters
Return
None.
Example
Data collection
CreateDCI()
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.
dataType Type of the collected data. Possible values: "int32", "uint32", "int64",
"uint64", "counter32", "counter64", "float", "string". Alternatively, you can
use DCI data type constants.
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.
66
Example
FindAllDCIs()
Find all DCI on the node matching nameFilter and descriptionFilter. Filter can contain glob symbols
"?" and "*". If filter is null, it’s ignored.
Parameters
nameFilter GLOB for mastching DCI name or null if name should be ignored.
Return
Array of DCI.
Example
67
>>> 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))
…
FindDCIByDescription()
Find ID of the DCI on node by description (exact match). FindAllDCIs() can be used for pattern
search.
Parameters
Return
Integer ID of the DCI or 0 if not found.
Example
FindDCIByName()
Find ID of the DCI on node by parameter name (exact match). FindAllDCIs() can be used for pattern
search.
Parameters
Return
Integer ID of the DCI or 0 if not found.
68
Example
GetAvgDCIValue()
Get the average value of the DCI for the given period. The DCI value type must be numeric.
Parameters
Return
Average value or null on failure.
Example
GetDCIObject()
Parameters
id Number DCI id
Return
DCI object or null if not found
69
Example
GetDCIObject($node, 2) // object
GetDCIObject($node, bad_id) // `null`
GetDCIRawValue()
Parameters
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.
Example
GetDCIValue()
Get last collected value of the DCI. Return null on error, Table instance for table DCI or String
otherwise.
Parameters
Return
Table for table DCIs, String, or null if failed or no data is available.
Example
70
GetDCIValueByDescription()
Parameters
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.
Example
GetDCIValueByDescription($node, "Status") // 0
GetDCIValueByName()
Parameters
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.
Example
GetDCIValues()
Get all values for period of DCI with given ID on given node.
71
Parameters
id Integer DCI ID
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.
Example
GetMaxDCIValue()
Get the maximum value of the DCI for the given period. The DCI value must be of numeric type.
Parameters
id Integer DCI ID
Return
Maximum value or null on failure.
Example
GetMinDCIValue()
Get the minimum value of the DCI for the given period. The DCI value must be of numeric type.
72
Parameters
id Integer DCI ID
Return
Minimum value or null on failure.
Example
GetSumDCIValue()
Get the sum value of the DCI for the given period. The DCI value must be of numeric type.
Parameters
id Integer DCI ID
Return
Sum value or null on failure.
Example
PushDCIData()
73
Parameters
dciId Integer DCI id for which new value will be pushed (DCI source
must be set to "Push").
Return
No return value
Example
Agent
AgentExecuteCommand()
rd
Execute agent command (action) on given node. Optional arguments starting from 3 are passed as
command arguments to the agent.
Parameters
Return
Boolean indicator of success
Example
74
AgentExecuteCommandWithOutput()
Execute agent command (action) on given node and collect standard output of the application
rd
defined by the command. Optional arguments starting from 3 are passed as command arguments
to the agent.
Parameters
Return
Output of the command or null if execution failed.
Example
AgentReadList()
This function is deprecated starting from version 3.0. Please use method
readAgentList of class Node.
Parameters
Return
Array of strings or null if failed.
75
Example
AgentReadParameter()
This function is deprecated starting from version 3.0. Please use method
readAgentParameter of class Node.
Parameters
Return
String value or null if failed.
Example
AgentReadTable()
This function is deprecated starting from version 3.0. Please use method
readAgentTable() of class Node.
76
Parameters
Return
Instance of Table or null if failed.
Example
Alarms
FindAlarmById()
Parameters
id Integer Alarm id
Return
Alarm object or null if no such alarm exist.
Example
77
FindAlarmByKey()
Parameters
Return
Will return object of class alarm
Example
FindAlarmByKeyRegex()
Parameters
Return
Alarm object found by key
Example
Events
GetEventParameter()
78
Get value of event’s named parameter.
Parameters
event Event Event object, you can use predefined variable $event to
refer to current event.
Return
String value of requested parameter or null if no such parameter exist.
Example
SetEventParameter()
Parameters
event Event Event object, you can use predefined variable $event to
refer to current event.
Return
No return value
Example
LoadEvent()
Will load event from the database and return Event object or NULL if event not found.
Parameters
79
Return
Event loaded from database or NULL if event not found.
Example
>>>event = LoadEvent(315);
>>>event->id;
315
PostEvent()
Parameters
event Integer or String Event code or name (name can be used since 1.2.6).
tag String User tag associated with event. Optional, can be leaved out
or set to null.
Return
TRUE if event was posted successfully or FALSE if not.
Example
PostEvent($node, 100000);
PostEvent($node, 100000, "my tag", "param1", "param2");
PostEvent($node, "MY_EVENT_NAME", null, "param1");
PostEventEx()
Miscelanious
_exit()
Parameters
80
exitCode Integer Optional exit code for the script. Defaults to 0.
AddrInRange()
Check if IP address is within given range. IPv4 and IPv6 are supported.
Parameters
Return
TRUE if address is within given range (including both bounding addresses), and FALSE otherwise.
Example
AddrInSubnet()
Checks if given IP address is within given subnet (including subnet and broadcast addresses). IPv4
and IPv6 are supported.
Parameters
Return
TRUE if address is within given subnet (including subnet and broadcast addresses), and FALSE
otherwise.
Example
81
assert()
Parameters
Example
node = FindObject("aaa");
assert(node != null); //Will go through, if object with name "aaa" found and will exit
script if not
classof()
Parameters
Return
Class name.
Example
>>> classof($node)
Node
CountryAlphaCode()
Parameters
Return
Two letter country code or null if country not found.
82
Example
>>> CountryAlphaCode('020')
AN
>>> CountryAlphaCode('AND')
AN
>>> CountryAlphaCode('124')
CA
CountryName()
Parameters
Return
Country name
Example
CountScheduledTasksByKey()
Parameters
Return
Scheduled task count with provided key
Example
CreateUserAgentNotification()
83
CreateUserAgentNotification(object, message, startTime, endTime) => Number
Parameters
Return
New user agent notification id
Example
CurrencyAlphaCode()
Parameters
Return
Currency alpha code from numeric code
Example
CurrencyExponent()
84
Parameters
Return
Currency exponent
Example
CurrencyName()
Parameters
Return
Currency name
Example
DriverReadParameter()
Request driver-specific metric directly from network device driver (e.g. Rital). Works similarly to
AgentReadParameter(), but query device driver insterad.
Parameters
Return
String value of the metric or null if request failed / metric not supported by driver
85
Example
EventCodeFromName()
Parameters
Return
Event code
Example
EventNameFromCode()
Parameters
Return
Event name
Example
FormatMetricPrefix()
Parameters
86
number Number Number to format.
Return
String containing the value converted to human-readable form with metric prefix.
Example
>>> FormatMetricPrefix(5000)
5.00k
>>> FormatMetricPrefix(5000, true)
4.88Ki
>>> FormatMetricPrefix(-1234567.89, false, 0)
-1M
>>> FormatMetricPrefix(-1234567.89,, 10)
-1.2345678900M
FindVendorByMACAddress()
Parameters
Return
NIC vendor name or null
Example
>>> FindVendorByMACAddress("00:00:5e:00:53:af")
ICANN, IANA Department
GetConfigurationVariable()
Parameters
87
key Configuration parameter name to lookup.
Return
Value of the server configuration parameter. If key is not found, null is returned or defaultValue is
specified.
Example
>>> GetConfigurationVariable("NumberOfStatusPollers")
10
>>> GetConfigurationVariable("BadVariable")
NULL
>>> GetConfigurationVariable("BadVariable", 22)
22
gethostbyaddr()
Parameters
Return
Host name
Example
gethostbyname()
Parameters
Return
IP address as a String
88
Example
GetServerQueueNames()
Return
Array with strings.
Example
foreach(l : GetServerQueueNames())
{
println(l);
}
GetSyslogRuleCheckCount()
Get syslog rule check count for all objects or for exact object.
Parameters
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
Example
GetSyslogRuleMatchCount()
Get syslog rule match count or all objects or for exact object.
89
Parameters
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
Example
GetThreadPoolNames()
Return
Array with strings.
Example
Instance()
This is helper function for instance filter script. It can be used to return accepted item. This
function has named parameters.
Parameters
Return
Array, where the first value is true, the second is name, the third is displayName and the forth is
object.
Example
90
GetInterfaceObject($node, $1), name: $1); //This will return correctly formatted array
to accept instance
JsonParse()
Parameters
Return
JsonObject if root object is Json object and JsonArray if root object is Json array or null if failed to
parse
map()
Parameters
Return
When key or table is not found, return null or default value if provided.
Example
mapList()
Lookup multiple keys (separated by user-defined separator) from mapping table. Result string is
joined using the same separator.
Parameters
91
list string of keys separated by separator.
Example
print()
Parameters
Example
a = %("a", 1, 1.5);
print("Array: ");
print(a); //Result: Array: [a, 1, 1.500000]
println()
Prints any text or text representation of object and adds new line symbol after it
Parameters
Example
a = %("a", 1, 1.5);
println("Array: ");
println(a);
//Array:
//[a, 1, 1.500000]
random()
92
Generate pseudo random number in given range. Uses c/c++ rand() function.
Parameters
Return
Random value in range minValue..maxValue.
Example
ReadPersistentStorage()
Parameters
Return
Value referenced by key or null if key not exist.
Example
>>> ReadPersistentStorage("key1")
value1
>>> ReadPersistentStorage("key2")
null
>>> WritePersistentStorage("key2", "value2")
>>> ReadPersistentStorage("key2")
value2
SecondsToUptime()
Parameters
93
Return
System uptime in format "n days, hh:mm".
Example
SendMail()
Parameters
Return
No return value
Example
SendNotification()
Parameters
subject String Subject. Not all notification channel may support this field,
in this case empty string "" should be provided.
94
Return
No return value
Example
sleep()
Parameters
Return
No return value
Example
trace()
Writes message to NetXMS main log if current debug level is equal or higher than debugLevel.
Parameters
Example
typeof()
95
Parameters
Return
Name of the type.
Example
>>> typeof(1)
int32
>>> typeof(1L)
int64
>>> typeof(%(1, 2, 3))
array
>>> typeof(new Table())
object
>>> typeof(null)
null
PollerTrace()
Sends poller trace message to client (if poll initiated by client) and log it. Used only in hooks.
Parameters
WritePersistentStorage()
Parameters
Example
96
weierstrass()
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
Return
Value in point x for Weierstrass function with given coefficients
Example
Situations
FindSituation()
Find situation
Parameters
Example
GetSituationAttribute()
97
…
Parameters
Return
Attribute value
Example
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
Return
Decoded string
Example
Base64Encode()
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
98
encoding String String encoding. Optional parameter.
Return
Encoded string
Example
md5()
Parameters
Return
MD5 hash
Example
sha1()
Parameters
Return
Result of sha1
Example
sha256()
99
sha256(string) => String
Parameters
Return
Result of sha256
Example
SNMP
CreateSNMPTransport()
This function is deprecated starting from version 3.0. Please use method
createSNMPTransport of class Node.
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
Return
Instance of SNMPTransport or null if failed.
Example
100
SNMPGet()
This function is deprecated starting from version 3.0. Please use method
get of class SNMPTransport.
Parameters
Return
Instance of SNMPVarBind or null on failure.
Example
SNMPGetValue()
This function is deprecated starting from version 3.0. Please use method
getValue of class SNMPTransport.
Perform SNMP GET request for oid over provided transport and return single string value instead
of varbind.
101
Parameters
Return
String value of the result or null on failure.
Example
SNMPSet()
This function is deprecated starting from version 3.0. Please use method
set of class SNMPTransport.
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
Return
Boolean. TRUE on success and FALSE in case of failure.
102
Example
SNMPWalk()
This function is deprecated starting from version 3.0. Please use method
set of class SNMPTransport.
Perform SNMP WALK request for oid over provided transport and return collected values as array
of SNMPVarBind or null on failure.
Parameters
Return
Array of SNMPVarBind or null or failure.
Example
Files
Available only if 'NXSL.EnableFileIOFunctions' configuration parameter is turned on.
CopyFile()
103
Makes a copy of source file or folder to destination file or folder and returns TRUE if action was
successful.
Parameters
Return
TRUE if copy was successful and FALSE if not.
Example
CreateDirectory()
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
Return
TRUE if creation was successful and FALSE if not.
Example
DeleteFile()
Deletes file.
Parameters
Return
104
TRUE if delete was successful and FALSE if not.
Example
FileAccess()
Parameters
00 Existence only
02 Write-only
04 Read-only
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.
Example
return FileAccess("/tmp/file", 5) // Will return true if user has read and execute
access to file
OpenFile()
105
Parameters
openingMode String Mode file should be opened in. More can be found there.
Return
File class or NULL if error occurred.
Example
RemoveDirectory()
Removes directory.
Parameters
Return
TRUE if delete was successful and FALSE if not.
Example
RenameFile()
Renames file.
Parameters
Return
TRUE if renamed was successful and FALSE if not.
Example
106
will be renamed to "mewFileName"
107
Class Reference
AccessPoint
Represents NetXMS access point object.
Instance attributes
icmpAverageRTT ⇒ Integer
ICMP average response time for primary address. Will return null if no information.
icmpLastRTT ⇒ Integer
ICMP last response time for primary address. Will return null if no information.
icmpMaxRTT ⇒ Integer
ICMP maximal response time for primary address. Will return null if no information.
icmpMinRTT ⇒ Integer
ICMP minimal response time for primary address. Will return null if no information.
icmpPacketLoss ⇒ Integer
ICMP packet loss for primary address. Will return null if no information.
index ⇒ Integer
Index
model ⇒ String
Model
node ⇒ Node
Parent node
serialNumber ⇒ String
Serial number
state ⇒ String
State from Access point state
vendor ⇒ String
Vendor
Constants
Access point state
Description Value
AP_ADOPTED 0
108
Description Value
AP_UNADOPTED 1
AP_DOWN 2
AP_UNKNOWN 3
Alarm
Represents NetXMS alarm.
Instance attributes
ackBy ⇒ Number
ID of user who acknowledged this alarm.
creationTime ⇒ Number
Unix timestamp of the alarm creation time.
dciId ⇒ Number
If alarm was created as a result of DCI threshold violation, this attribute will contain ID of the
DCI.
eventCode ⇒ Number
Event code of originating event.
eventId ⇒ Number
ID of originating event.
eventName ⇒ String
Name of originating event.
eventTagList ⇒ Number
List of event tags as a coma separated string
helpdeskReference ⇒ String
Helpdesk system reference (e.g. issue ID).
helpdeskState ⇒ Number
Helpdesk state:
• 0 = Ignored
• 1 = Open
• 2 = Closed
id ⇒ Number
Unique identifier of the alarm.
109
impact ⇒ String
Alarm impact text
key ⇒ String
Alarm key.
lastChangeTime ⇒ Number
Unix timestamp of the last update.
message ⇒ String
Alarm message.
originalSeverity ⇒ Number
Original severity of the alarm.
parentId ⇒ Number
Parent alarm id
repeatCount ⇒ Number
Repeat count.
resolvedBy ⇒ Number
ID of user who resolved this alarm.
rcaScriptName ⇒ String
Name of root cause analysis script
ruleGuid ⇒ String
Guid of the rule that generated the event.
ruleDescription ⇒ String
Description of the rule that generated the event.
severity ⇒ Number
Current alarm severity.
sourceObject ⇒ Number
ID of the object where alarm is raised.
state ⇒ Number
Alarm state:
• 0 = Outstanding
• 1 = Acknowledged
• 2 = Resolved
• 17 = Sticky acknowledged
110
Instance methods
acknowledge() ⇒ Number
Acknowledge alarm. Return 0 on success or error code on failure.
expandString(string) ⇒ String
Expand string by replacing macros with their values.
Parameters
Return
Formated string
resolve() ⇒ Number
Resolve alarm. Return 0 on success or error code on failure.
terminate() ⇒ Number
Terminate alarm. Return 0 on success or error code on failure.
Parameters
Return
Id of the newly created alarm comment.
getComments() ⇒ Array
Get array of alarm comments.
Return
Array of AlarmComment objects.
AlarmComment
Represents NetXMS alarm comment.
Instance attributes
id ⇒ Number
Alarm comment ID.
111
changeTime ⇒ Number
Unix timestamp of the alarm comment last modification time.
userId ⇒ Number
ID of user who last modified this alarm commant.
text ⇒ String
Alarm comment text.
Asset
Object represent asset, extends NetObj
Instance attributes
linkedObject ⇒ NetObj
Linked object
linkedObjectId ⇒ Integer
ID of the linked object
Asset Properties
Object contains all asset properties accessible by property name. So value of asset property with
name ipAddr can be accesed like:
$node->assetProperties->ipAddr
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 ⇒ Integer
ID of the prototype object
112
serviceState ⇒ Integer
Current state of the business service one of states
BusinessServiceCheck
Object represents business service check
Instance attributes
currentTicketId ⇒ Integer
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 ⇒ Integer
ID of the check
relatedDCI ⇒ DCI
DCI object of class DCI that is checked or NULL if check is not DCI based
relatedDCIId ⇒ Integer
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 ⇒ Integer
ID of related objec or 0
state ⇒ Integer
Current state of the business service check one of states
type ⇒ Integer
Business service check one of types
ByteStream
Object represents stream of bytes
Instance attributes
113
pos ⇒ Integer
Current position in the byte stream
size ⇒ Integer
Size of byte stream in bytes
eos ⇒ boolean
Indicates, if current position is in the end of byte stream
Instance methods
seek(position) ⇒ Integer
Change current position in byte stream.
Parameters
Return
Actual position if position change was successful or -1 if position change was not successful.
114
readInt32L() ⇒ Integer (32 bit)
Read little-endian 32-bit signed integer from byte stream and return it’s value.
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
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.
115
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.
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.
Example
Chassis
Object represent chassis, extends DataCollectionTarget
Instance attributes
controller ⇒ Node
Chassis controller node
116
controllerId ⇒ Integer
Chassis controller’s node id
flags ⇒ Integer
Bit flags
rack ⇒ NetObj
Will return Rack object as NetObj if chassis is added in rack
rackId ⇒ Integer
Will return Rack id if chassis is added in rack
rackHeight ⇒ Integer
Object height in rack
rackPosition ⇒ Integer
Object position in rack
Constants
Access point state
Description Value
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 methode names
name ⇒ Integer
Name of the class
ClientSession
Object represents client session
117
Instance attributes
clientInfo ⇒ String
Client app info string
clientType ⇒ Integer
Client system type - desktop(0), web(1), mobile(2), tablet(3), application(4)
flags ⇒ Integer
Client flags
id ⇒ Bigint
ID of client session
loginName ⇒ String
Login name
loginTime ⇒ Integer
Login time
name ⇒ String
User name
systemAccessRights ⇒ Bigint
User access ritht bit flags
user ⇒ User
object of User
userId ⇒ Integer
User ID
webServerAddress ⇒ String
Address for web server if it is web type connection
workstation ⇒ String
Workstation information if available
Cluster
Object represent cluster, extends DataCollectionTarget
Instance attributes
nodes ⇒ Array
Will return all nodes of class Node, that are under this cluster
118
zone ⇒ Zone
Will return zone this cluster is under
zoneUIN ⇒ Integer
Will return zone UIN this cluster is under
Instance methods
getResourceOwner(name) ⇒ Node
Get node which currently owns named resource.
Parameters
Return
Node object instance which currently owns resource of null if failed.
add(object) ⇒ void
Add node to cluster
Parameters
remove(object) ⇒ void
Remove node from cluster
Parameters
Component
Node components
Instance attributes
class ⇒ String
Type of the component:
• unknown
• chassis
• backplane
• container
• power supply
119
• 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 ⇒ Number
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.
Container
Object represent container, extends NetObj.
Instance attributes
autoBindScript ⇒ String
Source of the script for automatic binding.
isAutoBindEnabled ⇒ Boolean
Indicate if automatic binding is enabled.
isAutoUnbindEnabled ⇒ Boolean
Indicate if automatic unbinding is enabled.
120
Instance methods
Parameters
setAutoBindScript(script) ⇒ void
Update automatic binding script source.
Parameters
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.
Example
// 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
Parameters
121
enableConfigurationPolling(flag) ⇒ void
Enable or disable configuration polling for a node
Parameters
enableDataCollection(flag) ⇒ void
Enable or disable data collection polling for a node.
Parameters
enableStatusPolling(flag) ⇒ void
Enable or disable status polling for a node.
Parameters
readInternalParameter(name) ⇒ String
Reads object internal metric (metric with source "Internal").
Parameters
readInternalTable(name) ⇒ String
Reads object internal table metric (metric with source "Internal").
Parameters
removeTemplate(template) ⇒ void
Parameters
DCI
Represents Data Collection Item (DCI).
122
Instance attributes
activeThresholdSeverity ⇒ Integer
Severity of the active threshold. If there are no active thresholds, defaults to 0 (NORMAL).
comments ⇒ String
DCI Comments (since 2.0-M5)
dataType ⇒ Integer
Data type of the DCI.
description ⇒ String
Description
errorCount ⇒ Integer
Number of consecutive data collection errors
flags ⇒ Integer
DCI flags
hasActiveThreshold ⇒ Boolean
TRUE if DCI has active threshold
id ⇒ Integer
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 ⇒ Integer64
Time of last DCI poll (either successful or not) as number of seconds since epoch (1 Jan 1970
00:00:00 UTC)
lastCollectionTime ⇒ Integer64
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 ⇒ Integer
Data origin of the DCI.
pollingInterval ⇒ Integer
Current polling interval
123
relatedObject ⇒ NetObj
Related object or null if there is no object
status ⇒ Integer
Data status of the DCI.
systemTag ⇒ String
System tag. Always empty for user-defined DCIs.
template ⇒ Template
Template object if DCI came from Template or NULL.
templateId ⇒ Integer
Template id if DCI came from Template or 0.
templateItemId ⇒ Integer
DCI item id in template if DCI came from Template or 0.
type ⇒ Integer
DCI type:
• 1 = single value
• 2 = table
Instance methods
forcePoll() ⇒ void
Start DCI force poll.
DiscoveredInterface
Represent discovered interface objects in discovered node class
Instance attributes
alias ⇒ String
Interface alias (usually value of SNMP ifAlias).
chassis ⇒ Integer
Chassis id
description ⇒ String
Interface description
index ⇒ Integer
Interface index.
124
ipAddressList ⇒ Array
Array with InetAddress objects, that represent all adresses that has this interface has
isPhysicalPort ⇒ Boolean
TRUE if this interface object represents physical port
macAddr ⇒ String
String representation of MAC address separated by ":".
module ⇒ Integer
Module
mtu ⇒ Integer
Interface MTU (0 if unknown).
name ⇒ String
Interface name
pic ⇒ Integer
Phisical location.
port ⇒ Integer
Port number.
speed ⇒ Integer64
Speed of the interface.
type ⇒ Integer
Interface type
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
125
isAgent ⇒ Boolean
TRUE if NetXMS agent detected on node
isBridge ⇒ Boolean
TRUE if node is a bridge
isCDP ⇒ Boolean
TRUE if node supports CDP (Cisco Discovery Protocol)
isLLDP ⇒ Boolean
TRUE if node supports LLDP (Link Layer Discovery Protocol)
isPrinter ⇒ Boolean
TRUE if node is a printer
isRouter ⇒ Boolean
TRUE if node is a router (has IP forwarding enabled)
isSNMP ⇒ Boolean
TRUE if SNMP agent detected on node
isSONMP ⇒ Boolean
TRUE if node supports SONMP/NDP (Synoptics/Nortel Discovery Protocol)
isSSH ⇒ Boolean
TRUE if SSH connection is available for this node
netMask ⇒ Integer
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 ⇒ Integer
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)
126
zoneUIN ⇒ Integer
This node zone UIN
Event
Represents NetXMS event object.
Instance attributes
code ⇒ Number
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 ⇒ Number
DCI id that is source for this event or 0 if generated not by threshold
id ⇒ Number
Unique event identifier.
lastAlarmKey ⇒ String
Key for last generated alarm for this event or null
message ⇒ String
Event message. Get/set attribute.
name ⇒ String
Event name.
origin ⇒ Number
Origin of the event
• 0 - SYSTEM
• 1 - AGENT
• 2 - CLIENT
• 3 - SYSLOG
• 4 - SNMP
• 5 - NXSL
• 6 - REMOTE_SERVER
127
originTimestamp ⇒ Number
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 ⇒ Number64
Id of event that is root cause of this event or 0 if there is no such event.
severity ⇒ Number
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 ⇒ Number
ID of the source object for the event.
tags ⇒ Array
Event tags as an array of strings.
tagList ⇒ String
Event tags as a coma separated list.
timestamp ⇒ Integer
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
Parameters
128
addTag(tag) ⇒ void
Set event tag, which can be later accessed via tags attribute.
Parameters
correlateTo(eventId) ⇒ void
Sets root cause id for the event
Parameters
expandString(string) ⇒ String
Expand string by replacing macros with their values.
Parameters
Return
Formated string
Example
>>> $event->expandString("%N")
SYS_THRESHOLD_REACHED
hasTag(tag) ⇒ Boolean
Return if event has specific tag.
Parameters
removeTag(tag) ⇒ void
Remove tag from event tag list
Parameters
setMessage(message) ⇒ void
Set event message to message.
Parameters
129
setNamedParameter(name, value) ⇒ void
Set named parameter or change value of existing named parameter
Parameters
Parameters
setSeverity(severityCode) ⇒ void
Change event severity to severityCode.
Parameters
toJson() ⇒ String
Serialize object to JSON.
Return
String representation of the object in JSON format.
FILE
Class that represents file on file system. Available only if 'NXSL.EnableFileIOFunctions'
configuration parameter is turned on. File read and write position in file depends on mode file was
opened in.
Instance attributes
eof ⇒ Boolean
If it’s already end of file.
name ⇒ String
File name
130
Instance methods
close() ⇒ void
Close file
read(numberOfSymbols) ⇒ String
Read provided number of bytes from file.
Parameters
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
writeLine(text) ⇒ void
Will write provided text to the file and will add new line at the end.
Parameters
GeoLocation
Represents geographical location (defined by latitude and longitude).
Instance attributes
isManual ⇒ Boolean
TRUE if location is entered manually
isValid ⇒ Boolean
TRUE if location is valid
latitude ⇒ Number
Latitude as floating point number
131
latitudeText ⇒ String
Latitude as text
longitude ⇒ Number
Longitude as floating point number
longitudeText ⇒ String
Longitude as text
type ⇒ Number
Data source type:
• 0 – Unset
• 1 – Manual
• 2 - GPS
• 3 - Network
Constructors
Constants
Location Types
Value Description
Examples
Print node location
132
Set node location
Clear location
>>> $node->clearGeoLocation()
>>> println($node->geolocation)
null
HardwareComponent
Object that contains all information about node hardware component.
Instance Attributes
changeCode ⇒ Integer
Code of the changes that happened to the component during the last configuration poll.
categoryName ⇒ String
Component category name
category ⇒ Integer
Code of the component category.
Constant Value
HardwareComponentCategory::OTHER 0
HardwareComponentCategory::BASEBOARD 1
HardwareComponentCategory::PROCESSOR 2
HardwareComponentCategory::MEMORY 3
HardwareComponentCategory::STORAGE 4
HardwareComponentCategory::BATTERY 5
HardwareComponentCategory::NETWORK_ADA 6
PTER
133
index ⇒ Integer
Index of the component.
capacity ⇒ Integer
Component capacity depending on the type.
type ⇒ String
Component type depending on the category.
vendor ⇒ String
Component vendor.
model ⇒ String
Component model.
location ⇒ String
Component installation location in the system.
partNumber ⇒ String
Component part number.
serialNumber ⇒ String
Component serial number.
description ⇒ String
Component description.
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 ⇒ Boolean
TRUE if address is a wildcard address
134
isBroadcast ⇒ Boolean
TRUE if address is a broadcast address
isLinkLocal ⇒ Boolean
TRUE if address is a link local address
isLoopback ⇒ Boolean
TRUE if address is a loopback address
isMulticast ⇒ Boolean
TRUE if address is a multicast address
isValid ⇒ Boolean
TRUE if address valid
isValidUnicast ⇒ Boolean
TRUE if address valid unicast
mask ⇒ Integer
Address bit mask
Constructors
InetAddress()
Constructor for internet address
Return
InetAddress object
InetAddress(address)
Constructor for internet address
Parameters
Return
InetAddress object
Interface
Represent interface object. Inherit all attributes and methods of the NetObj class.
Instance attributes
adminState ⇒ Integer
Administrative state of the interface.
135
bridgePortNumber ⇒ Integer
Bridge port number for this interface.
chassis ⇒ Chassis
Parent Chassis
description ⇒ String
Interface description
dot1xBackendAuthState ⇒ Integer
802.1x back-end authentication state
dot1xPaeAuthState ⇒ Integer
802.1x PAE authentication state
expectedState ⇒ Integer
Expected state of the interface.
flags ⇒ Integer
Interface flags (bit mask, uint32).
icmpAverageRTT ⇒ Integer
ICMP average response time for current interface. Will return null if no information.
icmpLastRTT ⇒ Integer
ICMP last response time for current interface. Will return null if no information.
icmpMaxRTT ⇒ Integer
ICMP maximal response time for current interface. Will return null if no information.
icmpMinRTT ⇒ Integer
ICMP minimal response time for current interface. Will return null if no information.
icmpPacketLoss ⇒ Integer
ICMP packet loss for current interface. Will return null if no information.
ifAlias ⇒ String
Interface alias
ifIndex ⇒ Integer
Interface index.
ifType ⇒ Integer
Interface type
ipAddressList ⇒ Array
Array with InetAddress objects, that represent all addresses that has this interface has
136
isExcludedFromTopology ⇒ Boolean
TRUE if this interface excluded from network topology
isIncludedInIcmpPoll ⇒ Boolean
TRUE if this interface is included in ICMP statistics
isLoopback ⇒ Boolean
TRUE if this interface is a loopback
isManuallyCreated ⇒ Boolean
TRUE if this interface object was created manually by NetXMS administrator
isOSPF ⇒ Boolean
TRUE if this interface is OSPF
isPhysicalPort ⇒ Boolean
TRUE if this interface object represents physical port
macAddr ⇒ String
String representation of MAC address separated by ":".
module ⇒ Integer
Module
mtu ⇒ Integer
Interface MTU (0 if unknown).
node ⇒ Node
Parent node object
operState ⇒ Integer
Operational state.
ospfAreaId ⇒ String
OSPF area ID
ospfState ⇒ Integer
OSPF state
ospfStateText ⇒ String
OSPF state as a text
ospfType ⇒ Integer
OSPF type
ospfTypeText ⇒ String
OSPF type as s text
137
peerInterface ⇒ Interface
Peer interface object if known, otherwise null.
peerNode ⇒ Node
Peer node object if known, otherwise null.
pic ⇒ Integer
Phisical location.
port ⇒ Integer
Port number.
speed ⇒ Integer64
Speed of the interface.
vlans ⇒ Array
Array with this inteface vlan objects
zone ⇒ Zone
Zone object (null if zoning is disabled).
zoneUIN ⇒ Integer
Zone UIN of this interface.
Instance methods
enableAgentStatusPolling(enabled) ⇒ void
Enable\disable agent status polling for this interface
Parameters
enableICMPStatusPolling(enabled) ⇒ void
Enable\disable ICMP status polling for this interface
Parameters
enableSNMPStatusPolling(enabled) ⇒ void
Enable\disable SNMP status polling for this interface
Parameters
setExcludeFromTopology(excluded) ⇒ void
Change isExcludedFromTopology flag.
138
Parameters
setExpectedState(newState) ⇒ void
Set expected state to newState.
Parameters
setIncludeInIcmpPoll(enabled) ⇒ void
Enabele/Disable ICMP statistics collection for current interface.
Parameters
Constants
Interface states
Code Description
0 Unknown
1 Up
2 Down
3 Testing
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
139
Code Type
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
140
Code Type
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
141
Code Type
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
142
Code Type
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
143
Code Type
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
144
Code Type
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
145
Code Type
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
146
Code Type
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
147
Code Type
272 IFTYPE_VMWARE_NIC_TEAM
JsonArray
Represents JSON array object
Instance attributes
size ⇒ Number
Number of elements in array
values ⇒ Array
NXSL array with JSON array elements
Instance methods
append(value) ⇒ void
Appends value to JSON array.
Parameters
get(index) ⇒ ?
Returns array value by the index. Value type depends on the type used in JSON.
Parameters
Return
Attribute value
Parameters
serialize() ⇒ String
Returns string with serialized JSON
Return
String with serialized JSON
148
set(index, value) ⇒ void
Sets value to the provided index in JSON array, in place of existing element in this position
Parameters
Constructors
JsonArray()
Creates new JSON array.
Return
JsonArray object
JsonObject
Represents JSON object
Instance attributes
Instance methods
get(key) ⇒ ?
Returns attribute value by the key. Value type depends on the type used in JSON.
Parameters
Return
Attribute value
keys() ⇒ Array
Returns attribute array
Return
Attribute array
serialize() ⇒ String
Returns string with serialized JSON
Return
String with JSON
149
set(key, value) ⇒ void
Sets attribute referenced by key to the given value.
Parameters
Constructors
JsonObject()
Creates new JSON object.
Return
JsonObject object
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 ⇒ Boolean
If objec is a group
isUser ⇒ Boolean
If object is an user
loginName ⇒ String
Login name
phoneNumber ⇒ String
Phone number
type ⇒ String
String that repsesents type. One of: group, user, other
150
MaintenanceJournalRecord
One maintenance journal record entry
Instance attributes
authorId ⇒ Integer
Autor user ID
creationTime ⇒ Integer
UNIX timestamp of creation
description ⇒ String
Description
editorId ⇒ Integer
Editor user ID
modificationTime ⇒ Integer
UNIX timestamp of last modification
objectId ⇒ Integer
ID of an object that was under maintenance
MobileDevice
Class that represents mobile device object, extends DataCollectionTarget
Instance attributes
altitude ⇒ Integer
Altitude
batteryLevel ⇒ Integer
Battery percentage
commProtocol ⇒ String
Communication Protocol
deviceId ⇒ String
Device id
direction ⇒ String
Direction
lastReportTime ⇒ Integer
UNIX timestamp when device last reported data
151
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
NetObj
Base class for all NetXMS objects.
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.
alias ⇒ String
Object alias. For interfaces it is automatically collected on configuration poll (e.g. from SNMP
ifAlias).
asset ⇒ Asset
Reference to asset class.
assetId ⇒ Integer
Id of linked asset object.
152
backupZoneProxy ⇒ Node
Currently selected backup zone proxy (null if zoning is disabled or backup proxy is not
assigned)
backupZoneProxyId ⇒ Integer
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 ⇒ Integer
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 ⇒ Integer64
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 ⇒ Integer
Unique object identifier.
ipAddr ⇒ String
Primary IP address.
153
isInMaintenanceMode ⇒ Boolean
Maintenance mode indicator (true if object currently is in maintenace mode).
maintenanceInitiator ⇒ Integer
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 ⇒ Integer
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 ⇒ Integer
Current object state. One of: Node state, Cluster state, Sensor state
status ⇒ Integer
Current object status.
streetAddress ⇒ String
Postal address - street.
type ⇒ Integer
Object type.
154
Instance methods
bind(childObject) ⇒ void
Parameters
bindTo(parentObject) ⇒ void
Parameters
clearGeoLocation() ⇒ void
Clears GeoLocation data from the node
delete() ⇒ void
Deletes current object.
deleteCustomAttribute(name) ⇒ void
Delete custom attribute.
Parameters
getResponsibleUsers(level) ⇒ array
Returns responsible users that have escalation level equal to specified level.
Parameters
level Integer
Return
Array with user objects that are added as responsible users for this object. Objects are User or
UserGroup
isDirectChild(object) ⇒ Boolean
If provided object is direct child of this object
155
Parameters
object NetObj
Return
TRUE if provided object is direct child of this object
isDirectParent(object) ⇒ Boolean
If provided object is direct parent of this object
Parameters
object NetObj
Return
TRUE if provided object is direct parent of this object
enterMaintenance() ⇒ void
Enable maintenance mode for the object.
expandString(string) ⇒ String
Expand string by replacing macros with their values.
Parameters
Return
Formated string
Example
>>> $node->expandString("%n")
My node name
getCustomAttribute(name) ⇒ String
Returns value of the custom attribute with the provided name.
Parameters
isChild(object) ⇒ Boolean
If provided object is child of this object
Parameters
object NetObj
Return
TRUE if provided object is child of this object
156
isParent(object) ⇒ Boolean
If provided object is parent of this object
Parameters
object NetObj
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.
Parameters
startTime Integer
Return
Array with MaintenanceJournalRecord objects
rename(name) ⇒ void
Rename object.
Parameters
setAlias(name) ⇒ void
Set object alias name
Parameters
setCategory(idOrName) ⇒ void
Set object category id or name (used to get object display image)
Parameters
157
setComments(comment) ⇒ void
Set object comments
Parameters
Parameters
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
setNameOnMap(name) ⇒ void
Sets object’s name, that will be used to display object on network map
Parameters
setStatusCalculation(type, …) ⇒ void
Sets status calculation method.
Parameters
setStatusPropagation(type, …) ⇒ void
Sets status propagation method.
158
Parameters
… 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
Parameters
unbindFrom(object) ⇒ void
Parameters
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
Constants
Object Types
Code Description
0 Generic
1 Subnet
2 Node
3 Interface
159
Code Description
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
Code Description
0 Default
1 Most critical
2 Single threshold
3 Multiple thresholds
Code Description
0 Default
1 Unchanged
2 Fixed
3 Relative
4 Translated
Code Description
0 Default
1 Unchanged
2 Fixed
3 Relative
4 Translated
160
Node
Represents NetXMS node object. Extends DataCollectionTarget.
Instance attributes
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 ⇒ Integer64
Number of seconds since node start 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 ⇒ Integer
Detected node capabilities ("Have Agent", "Support SNMP", etc.) Bitwise AND of Node capability
flags constants.
cipDeviceType ⇒ Integer
EtherNet/IP device type
cipDeviceTypeAsText ⇒ String
EtherNet/IP device type as text
cipExtendedStatus ⇒ Integer
EtherNet/IP device extended status
cipExtendedStatusAsText ⇒ String
EtherNet/IP device extended status as text
161
cipStatus ⇒ Integer
EtherNet/IP device status
cipStatusAsText ⇒ String
EtherNet/IP device status as text
cipState ⇒ Integer
EtherNet/IP device state
cipStateAsText ⇒ String
EtherNet/IP device state as text
cipVendorCode ⇒ Integer
EtherNet/IP vendor code in numeric form.
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.
driver ⇒ String
Named of selected device-specific SNMP driver.
downSince ⇒ Integer64
UNIX timestamp when node went down.
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 ⇒ Integer
Bit mask of Node flags.
hasAgentIfXCounters ⇒ Boolean
TRUE if agent supports 64-bit interface counters.
hasEntityMIB ⇒ Boolean
TRUE if supports ENTITY-MIB.
hasIfXTable ⇒ Boolean
TRUE if supports ifXTable via SNMP (64-bit counters for interface statistics).
162
hasUserAgent ⇒ Boolean
TRUE if has user agent
hasVLANs ⇒ Boolean
TRUE if VLAN information available.
hardwareId ⇒ String
Nodes' unique hardware id
hardwareComponents ⇒ Array
Retutrns an array of awailiable hardware of class HardwareComponent.
hasWinPDH ⇒ Boolean
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 ⇒ Integer
ICMP average response time for primary address. Will return null if no information.
icmpLastRTT ⇒ Integer
ICMP last response time for primary address. Will return null if no information.
icmpMaxRTT ⇒ Integer
ICMP maximal response time for primary address. Will return null if no information.
icmpMinRTT ⇒ Integer
ICMP minimal response time for primary address. Will return null if no information.
icmpPacketLoss ⇒ Integer
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 ⇒ Boolean
TRUE if node supports 802.1x. Equivalent of isPAE.
isAgent ⇒ Boolean
TRUE if NetXMS agent detected on node
163
isBridge ⇒ Boolean
TRUE if node is a bridge
isCDP ⇒ Boolean
TRUE if node supports CDP (Cisco Discovery Protocol)
isEtherNetIP ⇒ Boolean
TRUE if node supports EtherNet/IP (Industrial Protocol)
isExternalGateway ⇒ Boolean
TRUE if node is remotely managed node
isInMaintenanceMode ⇒ Boolean
TRUE if node is in maintenance mode
isLLDP ⇒ Boolean
TRUE if node supports LLDP (Link Layer Discovery Protocol)
isLocalManagement ⇒ Boolean
TRUE if node is a local management server (NetXMS server)
isLocalMgmt ⇒ Boolean
TRUE if node is a local management server (NetXMS server)
isNDP ⇒ Boolean
TRUE if node supports OSPF/NDP. Equivalent of isOSPF.
isModbusTCP ⇒ Boolean
TRUE if node supports Modbus TCP
isOSPF ⇒ Boolean
TRUE if node supports OSPF/NDP. Equivalent of isNDP.
isPAE ⇒ Boolean
TRUE if node supports 802.1x. Equivalent of is802_1x.
isPrinter ⇒ Boolean
TRUE if node is a printer
isProfiNet ⇒ Boolean
TRUE if node supports PROFINET (Process Field Network)
isRouter ⇒ Boolean
TRUE if node is a router (has IP forwarding enabled)
isSMCLP ⇒ Boolean
TRUE if node supports SMCLP (Server Management Command Line Protocol)
164
isSNMP ⇒ Boolean
TRUE if SNMP agent detected on node
isSSH ⇒ Boolean
TRUE if SSH is connection available
isSONMP ⇒ Boolean
TRUE if node supports SONMP/NDP (Synoptics/Nortel Discovery Protocol)
isSTP ⇒ Boolean
TRUE if node supports STP (Spanning Tree Protocol)
isUserAgentInstalled ⇒ Boolean
TRUE if user agent is installed.
isVirtual ⇒ Boolean
TRUE if node is virtual
isVRRP ⇒ Boolean
TURE if VRRP supported.
lastAgentCommTime ⇒ Integer
Unix timestamp of last time when communication with agent was
nodeSubType ⇒ String
Node sub type
nodeType ⇒ Integer
Node type Node types
ospfAreas ⇒ OSPFArea
Returns OSPFArea class object
ospfNeighbors ⇒ Array
Array with OSPFArea class objects
ospfRouterId ⇒ String
OSPF router ID
platformName ⇒ String
Platform name reported by NetXMS agent
physicalContainer ⇒ Object
Physical container object: Rack NetObj or Chassis Chassis
physicalContainerId ⇒ Integer
Physical container object id (Rack or Chassis)
165
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
rackId ⇒ Integer
Will return Rack id if node is added in rack
rackHeight ⇒ Integer
Object height in rack
rackPosition ⇒ Integer
Object position in rack
runtimeFlags ⇒ Integer
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.
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 ⇒ Integer
Configured SNMP version:
166
• 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)
zone ⇒ Zone
Zone object (null if zoning is disabled)
zoneProxyAssignments ⇒ Integer
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 ⇒ Boolean
Status of this node as zone proxy (true if active).
zoneUIN ⇒ Integer
This node zone UIN
Instance methods
Parameters
requestType String Request type. One of: GET, DELETE, PATCH, POST, PUT
167
contentType String Optional parameter. Type of provided data that will be set
to "Content-Type" header of request. Default type is
"application/json".
Return
Instance of WebServiceResponse with request result.
Example
Parameters
Return
Instance of SNMPTransport or null if failed.
enable8021xStatusPolling(flag) ⇒ void
Enable or disable 802.1x port state checking during status polls.
Parameters
168
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
enableDiscoveryPolling(flag) ⇒ void
Enable or disable discovery polling.
Parameters
enableEtherNetIP(flag) ⇒ void
Enable or disable usage of EtherNet/IP for polls.
Parameters
enableIcmp(flag) ⇒ void
Enable or disable usage of ICMP pings for status polls.
Parameters
enablePrimaryIPPing(flag) ⇒ void
Enable or disable usage of ICMP ping for primary IP.
Parameters
enableRoutingTablePolling(flag) ⇒ void
Enable or disable routing table polling.
Parameters
enableSnmp(flag) ⇒ void
Enable or disable usage of SNMP for all polls.
Parameters
169
enableSsh(flag) ⇒ void
Enable or disable usage of SSH
Parameters
enableTopologyPolling(flag) ⇒ void
Enable or disable topology polling.
Parameters
executeAgentCommand(command, …) ⇒ Boolean
Execute agent command (action) on node.
Parameters
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
Return
String with output of the command or null on failure.
executeSSHCommand(command) ⇒ array
Execute SSH command on node.
Parameters
Return
Array of strings with output of the command or null on failure.
getInterface(ifIdentifier) ⇒ Interface
Get interface object by index, MAC address or name. If name is number method will assume that
it is index.
Parameters
170
ifIdentifier Integer or String Index, MAC address or name of interface.
Return
Interface object.
Example
getInterfaceByIndex(ifIndex) ⇒ Interface
Get interface object by index.
Parameters
Return
Interface object.
Example
getInterfaceByMACAddress(ifMACAddr) ⇒ Interface
Get interface object by MAC address.
Parameters
Return
Interface object.
Example
getInterfaceByName(IfName) ⇒ Interface
Get interface object by name.
Parameters
Return
Interface object.
171
Example
getInterfaceName(ifIndex) ⇒ String
Get interface name by index.
Parameters
getWebService(webSvcName) ⇒ WebService
Get web service object by name.
Parameters
Return
WebService object.
Example
webSvc = $node->getWebService("webSvcName");
readAgentParameter(name) ⇒ String
Reads current value of agent metric.
Parameters
readAgentList(name) ⇒ Array
Reads current value of agent list metric and returns array of strings.
Parameters
readAgentTable(name) ⇒ Table
Reads current value of agent table metric and returns Table.
Parameters
readDriverParameter(name) ⇒ String
Request driver-specific metric directly from network device driver (e.g. Rital).
Parameters
172
name String List name.
readInternalParameter(name) ⇒ String
Read internal parameter
Parameters
Return
Value of requested internal parameter
readInternalTable(name) ⇒ Table
Read internal table
Parameters
Return
Value of requested internal table of class Table
readWebServiceList(name) ⇒ Array
Read list from node using web service
Parameters
Return
Array with string with web service instances
readWebServiceParameter(name) ⇒ String
Read from node web service parameter
Parameters
Return
String with result read from web service
setIfXTableUsageMode(mode) ⇒ void
Set ifXTable usage mode 0 - use default, 1 - enable, 2 - disable
Parameters
173
Constants
Node flags
Description Value
DCF_DISABLE_STA 0x00000001
TUS_POLL
DCF_DISABLE_CO 0x00000002
NF_POLL
DCF_DISABLE_DA 0x00000004
TA_COLLECT
DCF_LOCATION_C 0x00000008
HANGE_EVENT
NF_EXTERNAL_GA 0x00010000
TEWAY
NF_DISABLE_DISC 0x00020000
OVERY_POLL
NF_DISABLE_TOP 0x00040000
OLOGY_POLL
NF_DISABLE_SNM 0x00080000
P
NF_DISABLE_NXC 0x00100000
P
NF_DISABLE_ICMP 0x00200000
NF_FORCE_ENCRY 0x00400000
PTION
NF_DISABLE_ROU 0x00800000
TE_POLL
NF_AGENT_OVER_ 0x01000000
TUNNEL_ONLY
NF_SNMP_SETTIN 0x02000000
GS_LOCKED
NF_PING_PRIMAR 0x04000000
Y_IP
NF_DISABLE_ETH 0x08000000
ERNET_IP
NF_DISABLE_PERF 0x10000000
_COUNT
174
Description Value
DCDF_QUEUED_F 0x00000001
OR_STATUS_POLL
DCDF_QUEUED_F 0x00000002
OR_CONFIGURATI
ON_POLL
DCDF_QUEUED_F 0x00000004
OR_INSTANCE_PO
LL
DCDF_DELETE_IN_ 0x00000008
PROGRESS
DCDF_FORCE_STA 0x00000010
TUS_POLL
DCDF_FORCE_CON 0x00000020
FIGURATION_POL
L
DCDF_CONFIGURA 0x00000040
TION_POLL_PASSE
D
DCDF_CONFIGURA 0x00000080
TION_POLL_PEND
ING
NDF_QUEUED_FO 0x00010000
R_TOPOLOGY_POL
L
NDF_QUEUED_FO 0x00020000
R_DISCOVERY_PO
LL
NDF_QUEUED_FO 0x00040000
R_ROUTE_POLL
NDF_RECHECK_CA 0x00080000
PABILITIES
NDF_NEW_TUNNE 0x00100000
L_BIND
Value Description
175
Value Description
0x00010000 Node supports ifXTable via SNMP (64-bit counters for interface statistics)
Node types
Value Description
0 Unknown
1 Physical
2 Virtual
3 Controller
4 Container
NodeDependency
Detailed information about dependent nodes, usually accessible via instance attribute
dependentNodes in class Node.
176
Instance attributes
id ⇒ Integer
Node id
isAgentProxy ⇒ Boolean
Node is an agent proxy. Helper function for accesing specific bit of type field.
isDataCollectionSource ⇒ Boolean
Node is a data collection source for another node. Helper function for accesing specific bit of
type field.
isICMPProxy ⇒ Boolean
Node is an ICMP proxy for another node. Helper function for accesing specific bit of type field.
isSNMPProxy ⇒ Boolean
Node is a SNMP proxy for another node. Helper function for accesing specific bit of type field.
type ⇒ Integer
Type of of the dependencty this object represent. This field is a bitmask, flags are documented at
Type bitmask.
Constants
Type bitmask
Value Description
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
177
name String Name of the attribute
Return
Attribute value
__invoke(name, …) ⇒ Value
Execute any method, by it’s name
Parameters
Return
Method return value if method returns something
OSPFArea
OSPF area
Instance attributes
areaBorderRouterCount ⇒ Integer
Area border router count
asBorderRouterCount ⇒ Integer
Autonomous system border router count
id ⇒ String
Area ID
lsaCount ⇒ Integer
Link state advertisement count
OSPFNeighbor
OSPF neighbor
Instance attributes
areaId ⇒ String
Area ID
ifIndex ⇒ String
Interface index
178
ipAddress ⇒ String
IP address
isVirtual ⇒ Boolean
TRUE if it is virtual
node ⇒ Node
Object of Node class
nodeId ⇒ Integer
Node ID
routerId ⇒ String
OSPF router ID
state ⇒ Integer
State
stateText ⇒ String
State text
Sensor
Object represent sensor, extends DataCollectionTarget
Instance attributes
description ⇒ String
Description
frameCount ⇒ Integer
Frame count
lastContact ⇒ Integer
Last contact UNIX timestamp
metaType ⇒ String
Meta type
protocol ⇒ Integer
Communication protocol
serial ⇒ String
Serial number
type ⇒ Integer
<<sensor-type>
179
vendor ⇒ String
Vendor
Constants
Sensor type
Description Value
Unknown 1
LoraWAN 2
DLMS 3
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 functions of nodes.
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
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
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
180
array Array Array with SNMP object ids to get
Return
Array with resulting strings for each array
Parameters
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
Constants
SNMP data types
Description Value
Integer. INTEGER
IP address. IPADDR
Timeticks. TIMETICKS
Same as UINT32
UINTEGER32.
181
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).
printableValue ⇒ String
Object value as a printable string.
type ⇒ Integer
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.
SoftwarePackage
Represents software package installed on Node object.
Instance attributes
changeCode ⇒ Integer
Change code one of next:
• CHANGE_NONE: 0
• CHANGE_ADDED: 1
• CHANGE_UPDATED: 2
182
date ⇒ String
Change date in YYYYMMDD format
description ⇒ String
PAckage description
name ⇒ String
Package name
timestamp ⇒ Integer
Package change date as UNIX timestamp
url ⇒ String
PAckage URL
vendor ⇒ String
PAckage vendor
version ⇒ String
Package version
Subnet
Object represent subnet, extends NetObj
Instance attributes
ipNetMask ⇒ Integer
Subnet mask
isSyntheticMask ⇒ Boolean
TRUE is mask is synthetic
zone ⇒ Zone
Zone object (null if zoning is disabled)
zoneUIN ⇒ Integer
This subnet zone UIN
Table
Represents table object (usually it’s value of table DCI).
Instance attributes
columnCount ⇒ Number
Number of columns.
183
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 ⇒ Numbers
Number of rows.
rows ⇒ Array<TableRow>
Array of rows with data.
title ⇒ String
Title of table.
Instance methods
Parameters
Return
Column index
addRow() ⇒ Integer
Adds row to table
Return
Row index
deleteColumn(columnId) ⇒ void
Delete column
Parameters
deleteRow(rowId) ⇒ void
Delete row
184
Parameters
findRowByInstance(instance) ⇒ TableRow
Finds row by instance
Parameters
Return
Table row that corresponds to provided instance
findRowIndexByInstance(instance) ⇒ Integer
Finds row index by instance
Parameters
Return
Table row index corresponds to provided instance
Parameters
Return
Cell value as string
getColumnIndex(columnName) ⇒ Integer
Get column index by column name
Parameters
Return
Column name
getColumnName(columnId) ⇒ String
Get column name by column index
Parameters
185
Return
Column index
Parameters
Return
Column index
Constructors
Table()
Creates new Table object.
TableColumn
Represents table column definition object (used by Table class).
Instance attributes
dataType ⇒ Integer
Data type
displayName ⇒ String
Display name
isInstanceColumn ⇒ Boolean
TRUE if column is marked as instance column
name ⇒ String
Column name
TableRow
Represents table row definition object (used by Table class).
Instance attributes
index ⇒ Integer
Row index number
186
instance ⇒ String
Row instance name
values ⇒ Array<String>
Row values for all columns
Instance methods
get(columnId) ⇒ String
Get cell value
Parameters
Return
Cell value
Parameters
Template
Object represent template, extends NetObj.
Instance attributes
autoApplyScript ⇒ String
Source of the script for automatic binding.
isAutoApplyEnabled ⇒ Boolean
Indicate if automatic binding is enabled.
isAutoRemoveEnabled ⇒ Boolean
Indicate if automatic unbinding is enabled.
version ⇒ Integer
Template version
Instance methods
applyTo(object) ⇒ void
Apply teplate on object
187
Parameters
removeFrom(object) ⇒ void
emplate form object
Parameters
Parameters
setAutoApplyScript(script) ⇒ void
Update automatic binding script source.
Parameters
TIME
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.
Instance attributes
sec ⇒ Number
tm_sec ⇒ Number
Seconds after the minute.
min ⇒ Number
tm_min ⇒ Number
Minutes after the hour.
hour ⇒ Number
tm_hour ⇒ Number
Hours since midnight.
mday ⇒ Number
tm_mday ⇒ Number
Day of the month.
188
mon ⇒ Number
tm_mon ⇒ Number
Months since January.
year ⇒ Number
tm_year ⇒ Number
Year.
yday ⇒ Number
tm_yday ⇒ Number
Days since January 1.
wday ⇒ Number
tm_wday ⇒ Number
Days since Sunday.
isdst ⇒ Boolean
tm_isdst ⇒ Boolean
Daylight Saving Time flag.
Constructors
TIME()
Creates new TIME object.
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 ⇒ Number
UNIX timestamp with current certificate expiration day
189
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 ⇒ Number
Tunnel id
isAgentProxy ⇒ Boolean
TRUE if agent proxy is enabled on the agent that opened the tunnel
isBound ⇒ Boolean
TRUE if tunnel is bound
isSnmpProxy ⇒ Boolean
TRUE if SNMP proxy is enabled on the agent that opened the tunnel
isSnmpTrapProxy ⇒ Boolean
TRUE if SNMP trap proxy is enabled on the agent that opened the tunnel
isUserAgentInstalled ⇒ Boolean
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 ⇒ Number
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 ⇒ Number
Node’s zone UIN if set in agent’s configuration file
190
User
Object represent user object and extends UserDBObject.
Instance attributes
authMethod ⇒ Integer
Authentication method.
certMappingData ⇒ String
Data that will be used to mpa certificate
certMappingMethod ⇒ Integer
Certificate mapping methods.
disabledUntil ⇒ String
UNIX timestamp with date until this user is disabled
disabledUntil ⇒ String
UNIX timestamp with date until this user is disabled
email ⇒ String
Email set in user properties
fullName ⇒ String
User full name
graceLogins ⇒ Integer
Grace login count
phoneNumber ⇒ String
Phone number set in user properties
lastLogin ⇒ Integer
UNIX timestamp with last user’s login time
xmppId ⇒ String
XMPP id
Constants
Status propagation types
Code Description
0 Password
1 Radius
2 Certificate
191
Code Description
3 Certificate or password
4 Certificate or radius
Code Description
0 Subject
1 Public key
2 CN
UserDBObject
Base class for User and UserGroup with common fields
Instance attributes
description ⇒ String
Description
flags ⇒ Integer
Flags
guid ⇒ String
GUID
id ⇒ Integer
Id
isDeleted ⇒ Boolean
TRUE if user DB object is deleted
isDisabled ⇒ Boolean
TRUE if user DB object is disabled
isGroup ⇒ Boolean
TRUE if user DB object is group object: UserGroup
isModified ⇒ Boolean
TRUE if user DB object is modified
isLDAPUser ⇒ Boolean
TRUE if user DB object is synchronized from LDAP
ldapDN ⇒ String
Get user DB object LDAP domain name
192
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 ⇒ Integer64
Field with system rights as bit flags.
Constants
Status propagation types
Code Description
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
193
Code Description
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
UserGroup
Object represent user group object and extends UserDBObject.
Instance attributes
memberCount ⇒ Integer
Group member count
members ⇒ Array
Array with objects: User or UserGroup
VLAN
Represents VLAN object.
194
Instance attributes
id ⇒ Integer
VLAN id.
name ⇒ String
VLAN name.
interfaces ⇒ Array
Interfaces in that VLAN (array of objects of class Interface).
WebService
An object that represents a combination of node and web service definition, that will be used for
requests.
Instance attributes
id ⇒ Integer
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
Return
Instance of WebServiceResponse with request result.
Example
webSvc = $node->getWebService("webSvcName");
result = webSvc->get();
println(result->document); // will print result
195
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
Return
Instance of WebServiceResponse with request result.
Example
webSvc = $node->getWebService("webSvcName");
result = webSvc->delete();
println(result->success); //will print "true" if request was successful or "false"
otherwise
Parameters
contentType String Optional parameter. Type of provided data that will be set
to "Content-Type" header of request. Default type is
"application/json".
Return
Instance of WebServiceResponse with request result.
Example
webSvc = $node->getWebService("webSvcName");
196
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
Parameters
contentType String Optional parameter. Type of provided data that will be set
to "Content-Type" header of request. Default type is
"application/json".
Return
Instance of WebServiceResponse with request result.
Example
webSvc = $node->getWebService("webSvcName");
Parameters
197
contentType String Optional parameter. Type of provided data that will be set
to "Content-Type" header of request. Default type is
"application/json".
Return
Instance of WebServiceResponse with request result.
Example
webSvc = $node->getWebService("webSvcName");
WebServiceResponse
Contains all information about web service custom request execution result
Instance attributes
agentErrorCode ⇒ Integer
Agent error code
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 ⇒ Integer
HTTP response code
success ⇒ Boolean
Will return True in case of success and False if there was problem on server or on agent
Zone
Represent network zone. Inherit all attributes and methods of the NetObj class.
198
Instance attributes
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 ⇒ Integer
Zone UIN (Unique Identification Number).
199
Global Constants
Status of the BusinessService class object
Constant Value Description
BusinessServiceSt 2 One of checks returned not normal, but is not failed yet
ate::DEGRADED
BusinessServiceTy 0 None
pe::NONE
BusinessServiceTy 1 Script
pe::SCRIPT
BusinessServiceTy 2 DCI
pe::DCI
BusinessServiceTy 3 Object
pe::OBJECT
DCI::STRING 4 String
200
DCI states of the DCI class
Constant Value Description
DCI::ACTIVE 0 Active
DCI::DISABLED 1 Disabled
DCI::UNSUPPORTE 2 Unsupported
D
DataSource::INTE 0 Internal
RNAL
DataSource::AGEN 1 Agent
T
DataSource::SNMP 2 SNMP
DataSource::SMCL 6 SMCLP
P
DataSource::SCRIP 7 Script
T
DataSource::SSH 8 SSH
DataSource::MQTT 9 MQTT
201
Constant Value Description
EventOrigin::SYST 0 System
EM
EventOrigin::AGE 1 Agent
NT
EventOrigin::CLIE 2 Client
NT
EventOrigin::SYSL 3 Syslog
OG
EventOrigin::SNM 4 SNMP
P
EventOrigin::NXSL 5 NXSL
202
Constant Value Description
HardwareCompon 0 Other
entCategory::OTH
ER
HardwareCompon 1 Baseboard
entCategory::BASE
BOARD
HardwareCompon 2 Processor
entCategory::PROC
ESSOR
HardwareCompon 3 Memory
entCategory::MEM
ORY
HardwareCompon 4 Storage
entCategory::STOR
AGE
HardwareCompon 5 Battery
entCategory::BATT
ERY
InterfaceExpected 0 Up
State::UP
InterfaceExpected 1 Down
State::DOWN
InterfaceExpected 2 Ignore
State::IGNORE
Node state
Constant Value Description
203
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::UNMANAG 6 Unmanaged
ED
Status::DISABLED 7 Disabled
Status::TESTING 8 Testing
Cluster state
Constant Value Description
204
Constant Value Description
Sensor state
Constant Value Description
Severity constants
Constant Value Description
Severity::NORMAL 0 Normal
Severity::WARNIN 1 Warning
G
Severity::MINOR 2 Minor
Severity::MAJOR 3 Major
Severity::CRITICA 4 Critical
L
Status colors
Constant Value Description
StatusColor::NOR 0 Normal
MAL
StatusColor::WAR 1 Warning
NING
205
Constant Value Description
StatusColor::MINO 2 Minor
R
StatusColor::MAJO 3 Major
R
StatusColor::CRITI 4 Critical
CAL
StatusColor::UNKN 5 Critical
OWN
StatusColor::UNM 6 Critical
ANAGED
StatusColor::DISAB 7 Critical
LED
StatusColor::TESTI 8 Critical
NG
Change Code
Node attributes change code
Constant Value
ChangeCode::NONE 0
ChangeCode::ADDED 1
ChangeCode::UPDATED 2
ChangeCode::REMOVED 3
Other constants
NXSL::BuildTag
NXSL::Classes
NXSL::Functions
206
NXSL::SystemIsBigEndian
NXSL::Version
207
Formal Grammar
Grammar
script ::=
module |
expression
module ::=
module_component { module_component }
module_component ::=
function |
statement_or_block |
use_statement
use_statement ::=
use any_identifier ";"
any_identifier ::=
IDENTIFIER |
COMPOUND_IDENTFIER
function ::=
sub 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 |
208
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 |
209
"!" 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 ::=
210
IDENTIFIER "(" [ expression { "," expression } ] ")"
constant ::=
STRING |
INT32 |
INT64 |
UINT32 |
UINT64 |
REAL |
NULL
Terminal symbols
211
Examples
Some real life examples.
for(i : $node->interfaces)
{
for(a : i->ipAddressList)
{
if (a->address == $node->ipAddr)
println(i->macAddr);
}
}
Script that returns TRUE if current node is under at least one container or cluster.
212
for (p : $node->parents) {
if (p->type == 5 or p->type == 14) { //5 is container and 14 is cluster
return true;
}
}
return false;
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" 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 Instance(displayName: name, name: name);
}
return false;
Requirements
Filter interfaces that should not be monitored by NetXMS. In this case "isatap*" interfaces.
213
Solution
if ( $1->name ~= "^isatap" )
return false;
return true;
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.
214
SetEventParameter($event, "additionalInfo",
"Peer: " .. peer->name .. " " .. peer->ipAddr .. " " .. macAddr);
return true;
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 CheckTrustedNodes server configuration
variable needs to be set to 0.
// This function walks object tree recursively starting from given root
sub EnumerateNodes(obj, level)
{
foreach(o : obj->children) {
for (i = 0; i < level; i++) { print(" "); }
println("[" .. o->type .. " / " .. classof(o) .. "] " .. o->name);
Solutions 2
When only nodes are required, not walk down the tree then this script can be used:
for (n : GetAllNodes()) {
println(n->name);
}
215
Requirements
Solution
attributes = $node->customAttributes;
foreach(a : attributes->keys)
{
println(a .. "=" .. attributes[a]);
}
sub 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;
}
sub BubbleSort(a)
{
n = a->maxIndex + 1;
do
{
newn = 0;
for(i = 1; i < n; i++)
{
216
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;
}
sub main()
{
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;
}
}
}
}
}
217
// Sort the Array
bubbleSort(pValue);
return p95AvgLoss;
}
sub bubbleSort(arr)
{
swapped = true;
while (swapped == true){
swapped = false;
for(ia = 1; arr[ia] != null; ia++)
{
ib = ia - 1;
sub printArray(arr)
{
for(ia = 0; arr[ia] != null; ia++)
{
trace(1,"printArray: ".ia.":".arr[ia]);
}
}
218
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;
}
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;
}
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();
219
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.
// Print data
for(i = 0; i < table->rowCount; i++)
{
for(j = 0; j < table->columnCount; j++)
{
print("| " .. left(table->get(i, j), 20));
}
println("|");
}
220
// walk through each parent object for current node
foreach(o : $node->parents)
{
add_contacts(o);
}
/**
* Recursively add contacts from object and it's parents
*/
sub 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);
}
}
transport = $node->createSNMPTransport();
if (transport == null) {
return null;
}
lat = transport->get(".1.2.3.4.1");
lon = transport->get(".1.2.3.4.2");
221
return 0;
with
objName (order = "asc", name = "Object name") = {
return $node->name;
},
(type == NODE) && $node->asset != null //show all nodes linked to asset
222