NetObj

Base class for all NetXMS objects. Extends Object.

Instance attributes

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

Hint for AI anomaly profile generation.

alarms ⇒ array

List of active Alarms for this object.

alarmStats ⇒ array

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

alias: String

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

asset ⇒ Asset

Reference to asset class of asset linked to this object.

assetId: int

Id of linked asset object.

assetProperties ⇒ AssetProperties

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

backupZoneProxy: Node

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

backupZoneProxyId: int

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

category: String

Object’s category name

categoryId: int

Object’s category ID

children ⇒ array

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

city: String

Postal address - city.

comments: String

Object comments.

country: String

Postal address - country.

creationTime: int64

Object creation time as UINX timestamp

customAttributes ⇒ HashMap

Hash map of object custom attributes.

district: String

Postal address - district.

geolocation ⇒ GeoLocation

Object geographical location.

guid: String

Object GUID as string.

id: int

Unique object identifier.

ipAddr: String

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

ipAddress ⇒ InetAddress

Added in version 5.1

Primary IP address.

isInMaintenanceMode: bool

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

maintenanceInitiator: int

Maintenance initiator user id

mapImage: String

GUID of object image used for representation on the maps.

name: String

Object name.

nameOnMap: String

Object name displayed on map.

parents ⇒ array

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

postcode: String

Postal address - postal code.

primaryZoneProxy: Node

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

primaryZoneProxyId: int

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

region: String

Postal address - region.

responsibleUsers: Array

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

state: int

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

status: int

Current object status.

streetAddress: String

Postal address - street.

type: int

Object type.

Instance methods

bind(childObject): void

Bind childObject to the current object as a child.

Table 1. Parameters

object

NetObj

Object to bind as a child to the current object.

bindTo(parentObject): void

Bind current object to parentObject as a child.

Table 2. Parameters

object

NetObj

Object to bind as a parent to the current object.

calculateDowntime(tag, periodStart, periodEnd): Array

Calculate node downtime

Table 3. Parameters

tag

String

downtime tag

periodStart

Integer

Unix timestamp of the period start

periodEnd

Integer

Unix timestamp of the period end

Return

Array of DowntimeInfo objects.

clearGeoLocation(): void

Clears GeoLocation data from the node

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

Send user agent notification

Table 4. Parameters

message

String

message to be sent

startTime

String

start time of message delivery

endTime

String

end time of message delivery

showOnStartup

String

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

Return

Message id

delete(): void

Deletes current object.

deleteCustomAttribute(name): void

Delete custom attribute.

Table 5. Parameters

name

String

Name of the attribute to delete.

enterMaintenance(): void

Enable maintenance mode for the object.

expandString(string): String

Expand string by replacing macros with their values.

Table 6. Parameters

string

String

String to expand

Return

Formated string

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

Returns value of the custom attribute with the provided name.

Table 7. Parameters

name

String

Name of the attribute to get value from.

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

getResponsibleUsers(tag) ⇒ array

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

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

Table 8. Parameters

level

String

Tag

Return

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

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

isChild(object): bool

If provided object is child of this object

Table 9. Parameters

object

NetObj

Object to check

Return

TRUE if provided object is child of this object

isDirectChild(object): bool

If provided object is direct child of this object

Table 10. Parameters

object

NetObj

Object to check

Return

TRUE if provided object is direct child of this object

isDirectParent(object): bool

If provided object is direct parent of this object

Table 11. Parameters

object

NetObj

Object to check

Return

TRUE if provided object is direct parent of this object

isParent(object): bool

If provided object is parent of this object

Table 12. Parameters

object

NetObj

Object to check

Return

TRUE if provided object is parent of this object

leaveMaintenance(): void

Disable maintenance mode for the object.

manage(): void

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

readMaintenanceJournal(startTime, endTime): Array

Read maintenance entries

Table 13. Parameters

startTime

Integer

Period start

endTime

Integer

Period end

Return

Array with MaintenanceJournalRecord objects

rename(name): void

Rename object.

Table 14. Parameters

name

String

New object name

setAlias(name): void

Set object alias name

Table 15. Parameters

name

String

New alias name

setCategory(idOrName): void

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

Table 16. Parameters

idOrName

String

ID or name of category

setComments(comment, [isMarkdown]): void

Set object comments

Table 17. Parameters

comment

String

Comment to be set

isMarkdown

Boolean

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

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

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

Table 18. Parameters

key

String

Attribute key

value

String

Attribute value

inherit

Boolean

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

setGeoLocation(newLocation): void

Sets node geographical location.

Table 19. Parameters

newLocation

GeoLocation

setMapImage(image): void

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

Table 20. Parameters

image

String

GUID or name of image from image library

setNameOnMap(name): void

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

Table 21. Parameters

name

String

New object’s name on map

setStatusCalculation(type, …​): void

Sets status calculation method.

Table 22. Parameters

type

Integer

Status calculation type. One of Status callculation types

…​

Integer(s)

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

setStatusPropagation(type, …​): void

Sets status propagation method.

Table 23. Parameters

type

Integer

Status propagation type. One of Status propagation types

…​

Integer(s)

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

unbind(object): void

Unbind provided object from the current object.

Table 24. Parameters

object

NetObj

Object to unbind from the current object.

unbindFrom(object): void

Unbind current object from the provided object.

Table 25. Parameters

object

NetObj

Object to unbind from the current object.

unmanage(): void

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

writeMaintenanceJournal(description): void

Add entry to maintenance journal

Table 26. Parameters

description

String

Message to be added

Constants

Table 27. Object Types
Code Description

0

Generic

1

Subnet

2

Node

3

Interface

4

Network

5

Container

6

Zone

7

Service Root

8

Template

9

Template Group

10

Template Root

11

Network Service

12

VPN Connector

13

Condition

14

Cluster

15

Business Service Prototype

16

Asset

17

Asset Group

18

Asset Root

19

Network Map Root

20

Network Map Group

21

Network Map

22

Dashboard Root

23

Dashboard

27

Business Service Root

28

Business Service

29

Collector

31

Mobile Device

32

Rack

33

Access Point

34

Wireless Domain

35

Chassis

36

Dashboard Group

37

Sensor

Table 28. Status callculation types
Code Description

0

Default

1

Most critical

2

Single threshold

3

Multiple thresholds

Table 29. Status propagation types
Code Description

0

Default

1

Unchanged

2

Fixed

3

Relative

4

Translated

Table 30. Status propagation types
Code Description

0

Default

1

Unchanged

2

Fixed

3

Relative

4

Translated