A.1 Agent_CreateEvent

This function raises an AppManager event. The arguments to this function are listed below in the order they should be passed to the function.

Required arguments:

  • $severity defines the severity of the event, from 1 to 40. The lower the severity value, the more severe the event.

  • $event_msg defines the text of the short event message. The short event message should be identical for all instances of the same event. Include details that might differ between instances in the detail message, such as the value of a measurement that exceeded a threshold.

  • $detail_msg defines the text of the event detail message. This can be either plain text or an XML string that describes how the message should be formatted into a table (see Agent_BuildDetailTableXML). To create an event without a detail message, pass $null or an empty string ("").

  • $resource defines the type and name of the resource object with which this event is associated. For scripts or commands executed using the PowerShell_RunCommand script, specify this value as "NT_PowerShellFolder = $NT_PowerShellFolder".

Optional arguments:

  • $action defines the IDs of the actions you want to execute when the event is raised. To trigger the actions that are associated with the PowerShell_RunCommand job, specify $AKPID for this argument. To disable action triggering, omit this argument or pass $null as the argument value.

Returns:

  • This function returns no value.

Example usage:

  • To create an informational event with an event detail message without triggering actions:

    Agent_CreateEvent 40 "This is an informational event" "These are the event details" "NT_PowerShellFolder = $NT_PowerShellFolder"

  • To create an error event with no detail message, which triggers the actions associated with the job:

    Agent_CreateEvent 1 "This is a severe error event" $null "NT_PowerShellFolder = $NT_PowerShellFolder" $AKPID