NetXMS Scripting Language

Table of Contents

Introduction...... 8

Script security ...... 8

Language syntax...... 10

Script entry point ...... 10

Built-in Types ...... 10

Truth Value Testing...... 11

Variables ...... 11

Function Declaration ...... 12

Function Arguments ...... 13

Return Values from a Function ...... 13

Arrays ...... 14

Array Initialization ...... 14

Operators ...... 15

Arithmetic Operators ...... 15

Assignment Operator ...... 15

Bitwise Operators ...... 16

Comparison Operators ...... 16

Incrementing/Decrementing Operators...... 17

Logical Operators ...... 18

String Operators ...... 18

Control structures ...... 18

if...... 19

else ...... 19

while ...... 19

do-while ...... 19

for ...... 20

break...... 20

continue ...... 20

switch ...... 20

return ...... 21

exit...... 21

Expressions ...... 21

Short-circuit evaluation ...... 22

Regular expressions ...... 22

Comments ...... 22

Tutorial ...... 22

1 Function Reference ...... 24

String functions ...... 24

ArrayToString() ...... 24

chr()...... 24

d2x() ...... 25

format() ...... 25

index() ...... 25

inList() ...... 26

left()...... 26

length()...... 26

lower() ...... 27

ltrim() ...... 27

ord() ...... 27

right() ...... 27

rindex() ...... 28

rtrim()...... 28

SplitString() ...... 28

substr() ...... 29

trim()...... 29

upper() ...... 29

x2d() ...... 29

Math functions ...... 30

abs() ...... 30

acos()...... 30

asin() ...... 31

ceil() ...... 31

cos()...... 31

cosh() ...... 32

exp() ...... 32

floor() ...... 32

log() ...... 33

log10()...... 33

max()...... 33

min() ...... 34

pow()...... 34

round() ...... 34

sin() ...... 34

sinh()...... 35

tan()...... 35

tanh() ...... 35

Time related functions ...... 36

2 gmtime()...... 36

localtime() ...... 36

mktime() ...... 36

strftime() ...... 36

time() ...... 37

Object functions ...... 37

CreateContainer() ...... 37

CreateNode()...... 37

RenameObject() ...... 38

DeleteObject() ...... 38

ManageObject() ...... 39

UnmanageObject()...... 39

Finding objects ...... 40

GetAllNodes() ...... 40

FindObject() ...... 40

FindNodeObject()...... 40

GetObjectParents() ...... 41

GetNodeParents()...... 41

GetObjectChildren() ...... 42

GetNodeTemplates() ...... 42

Binding objects to containers ...... 43

BindObject() ...... 43

UnbindObject()...... 43

Interfaces...... 44

GetInterfaceName()...... 44

GetInterfaceObject() ...... 44

GetNodeInterfaces() ...... 45

SetInterfaceExpectedState() ...... 45

Custom attributes ...... 46

GetCustomAttribute() ...... 46

SetCustomAttribute() ...... 47

DeleteCustomAttribute() ...... 47

Maintenance mode ...... 48

EnterMaintenance() ...... 48

LeaveMaintenance() ...... 48

Data Collection ...... 49

CreateDCI() ...... 49

FindAllDCIs()...... 50

FindDCIByDescription() ...... 51

FindDCIByName() ...... 52

GetAvgDCIValue() ...... 52

3 GetDCIObject() ...... 53

GetDCIRawValue() ...... 53

GetDCIValue() ...... 53

GetDCIValueByDescription() ...... 54

GetDCIValueByName() ...... 54

GetDCIValues() ...... 54

GetMaxDCIValue() ...... 55

GetMinDCIValue() ...... 55

GetSumDCIValue() ...... 55

PushDCIData() ...... 56

Agent related functions ...... 56

AgentExecuteAction() ...... 56

AgentExecuteActionWithOutput()...... 57

AgentReadList() ...... 57

AgentReadParameter()...... 58

AgentReadTable() ...... 58

A