How to pass parameter to script

Started by Lostavar, October 14, 2008, 07:21:45 PM

Previous topic - Next topic

Lostavar

How can I pass parameters to user-defined scripts?
How can I pass instance parameter (parameter %6 which is DCI's instance attribute) from action-definition to user-defined script (because calling user-defined script is in format %[scriptname])?

Thanks in advance.

Victor Kirhenshtein

In the script, you have access to all event attributes via $event variable, which is an object of class NetXMS_Event with the following attributes:
code - event code
id - event id
severity - event severity (as number)
timestamp - event timestamp (as UNIX timestamp)
message - event message text
userTag - user tag associated with event
parameters[] - array with event parameters

So, to access event's parameter 6, you should use


$event->parameters[6]


Best regards,
Victor