Skip to content

Latest commit

 

History

History
260 lines (221 loc) · 5.57 KB

File metadata and controls

260 lines (221 loc) · 5.57 KB

Event

Represents NetXMS event object.

Instance attributes

code: int

Event code

customMessage: String

Custom message set in event processing policy by calling setMessage. Deprecated and will be removed in a future version.

dci: [class-dci]

DCI object of class [class-dci] that is source for this event or NULL if generated not by threshold

dciId: int

DCI id that is source for this event or 0 if generated not by threshold

id: int

Unique event identifier.

lastAlarmId: int

ID of the last alarm associated with this event, or 0 if none.

Added in version 6.0

lastAlarmKey: String

Key for last generated alarm for this event or null.

Added in version 6.0

lastAlarmMessage: String

Message of the last alarm associated with this event, or null if none.

Added in version 6.0

message: String

Event message. Get/set attribute.

name: String

Event name.

origin: int

Origin of the event

  • 0 - SYSTEM

  • 1 - AGENT

  • 2 - CLIENT

  • 3 - SYSLOG

  • 4 - SNMP

  • 5 - NXSL

  • 6 - REMOTE_SERVER

originTimestamp: int

The time when the event was generated in the origin.

parameters: Array

List of event parameters. Starting index is 1.

parameterNames: Array

List of named event parameters (e.g. "dciId"), which can be accessed by object.parameterName.

rootId: int64

Id of event that is root cause of this event or 0 if there is no such event.

severity: int

Event severity code. Get/set attribute.

source: [class-netobj]

Source object (inherited from [class-netobj], exact type can be checked with [func-classof] function) for the event.

sourceId: int

ID of the source object for the event.

tags: Array

Event tags as an array of strings.

tagList: String

Event tags as a comma separated list.

timestamp: int

Unix timestamp of the event.

$1…$n

Shortcut for parameters[n] (e.g. "$event.parameters[3]" can be replaced with "$event.$3").

$…

Named event parameters can be accessed directly by the name (e.g $event.dciId). List of available named parameters can be accessed with parameterNames attribute. Get/set attribute.

Instance methods

addParameter(name, value): void

Set event parameter

Table 1. Parameters

name

String

Parameter name. Optional parameter.

value

String

Parameter value.

addTag(tag): void

Set event tag, which can be later accessed via tags attribute.

Table 2. Parameters

tag

String tag

correlateTo(eventId): void

Sets root cause id for the event

Table 3. Parameters

eventId

Root cause event id

expandString(string): String

Expand string by replacing macros with their values.

Table 4. Parameters

string

String to expand

Return

Formated string

>>> $event.expandString("%N")
SYS_THRESHOLD_REACHED
getParameter(name): void

Get parameter value by name or by index

Table 5. Parameters

name

Parameter name or index

Return

Parameter value or null

hasTag(tag): bool

Return if event has specific tag.

Table 6. Parameters

tag

String tag

removeTag(tag): void

Remove tag from event tag list

Table 7. Parameters

tag

String tag

setMessage(message): void

Set event message to message.

Table 8. Parameters

message

Message string

setNamedParameter(name, value): void

Set named parameter or change value of existing named parameter

Table 9. Parameters

name

String name of parameter

value

String value of parameter

setParameter(index, value): void

Set value of parameter or change value of existing parameter. If index corresponds to existing parameter, the value will be set. If index is higher then existing number of parameters, new parameter(s) will be added (if needed, parameters with empty values will be added to reach the number of parameters indicated by index).

Table 10. Parameters

index

Integer index of parameter

value

String value of parameter

setSeverity(severityCode): void

Change event severity to severityCode.

Table 11. Parameters

severityCode

Numeric severity code

toJson(): String

Serialize object to JSON.

Return

String representation of the object in JSON format.