- Print
- DarkLight
- PDF
Automated Actions: How To Pass Trigger-Related Parameters
- Print
- DarkLight
- PDF
One of the advanced features of triggers is the capability to pass trigger-related parameters to follow-up actions. For example, you can pass crossed threshold values, trigger names, or stress levels to emails or scripts.
Prerequisites
- Version 8.6.5 or higher
How To Use
To pass trigger-related information to a script action, you need to use the Not all properties are supported by every trigger type. To determine which properties are available for a specific trigger, refer to the Trigger Type column.$CUTriggerObject
variable. Find below an overview of available properties, the trigger type for which you can use this property and the parameter name you need to use for each use case.
Property | Description | Trigger Type | Parameter Name |
---|---|---|---|
TriggerName | The name of the trigger, as specified by the user in the Trigger Settings screen | All | $CUTriggerObject.TriggerName |
ReportedBy | The entity that reported the incident | All | $CUTriggerObject.ReportedBy |
Timestamp | The time at which the incident occurred (in the triggering Monitor's timezone) | All | $CUTriggerObject.Timestamp |
UTCTimestamp | The time at which the incident occurred (UTC) | All | $CUTriggerObject.UTCTimestamp |
Timezone | The triggering Monitor's timezone | All | $CUTriggerObject.Timezone |
Column | The name of the column | Advanced, Scheduled, Stress Level | $CUTriggerObject.Columns[index].Column |
ColumnSeverityLevel | Severity Level | Advanced, Scheduled, Stress Level | $CUTriggerObject.Columns[index].ColumnSeverityLevel |
ColumnTimestamp | For Advanced triggers, the time at which the column was changed; for Stress triggers, the time at which the stress on the column began. The time given is for the triggering Monitor's timezone. | Advanced, Scheduled, Stress Level | $CUTriggerObject.Columns[index].ColumnTimestamp |
ColumnUTCTimestamp | For Advanced triggers, the time at which the column was changed; for Stress triggers, the time at which the stress on the column began. The time given is UTC. | Advanced, Scheduled, Stress Level | $CUTriggerObject.Columns[index].ColumnUTCTimestamp |
ColumnCrossedThreshold | For Advanced triggers, the threshold that was set for the column; for Stress triggers, the stress threshold that was set for the trigger | Advanced, Scheduled, Stress Level | $CUTriggerObject.Columns[index].ColumnCrossedThreshold |
ColumnValueBefore | For Advanced triggers, the column's value before it was changed | Advanced, Scheduled | $CUTriggerObject.Columns[index].ColumnValueBefore |
ColumnValueAfter | For Advanced triggers, the column's value after it was changed | Advanced, Scheduled | $CUTriggerObject.Columns[index].ColumnValueAfter |
EventSource | Source field of the event | Advanced, Scheduled | $CUTriggerObject.Event.EventSource |
EventType | Level field of the event in the EventLog | Windows Event | $CUTriggerObject.Event.EventType |
EventID | Event ID | Windows Event | $CUTriggerObject.Event.EventID |
EventFullMsg | Event content | Windows Event | $CUTriggerObject.Event.EventFullMsg |
ValueBefore | Session state before it changed | Advanced, Scheduled | $CUTriggerObject.Session.ValueBefore |
ValueAfter | Session state before it changed | Advanced, Scheduled | $CUTriggerObject.Session.ValueAfter |
Simple Use Case
To put theory into practice and create a trigger that fires when the free space on disk is lower than 50 GB.
The idea behind showing this use case is to trigger an Automated Action (a trigger that runs a script as a follow-up action) that passes information about the trigger to the script.
- Create a script with the following content shown below. What this script does is to write a
CUTriggerObjectValue.txt
in C:\tmp.
$OutputFile = "C:\tmp\CUTriggerObjectValues.txt"
Clear-Content $OutputFile
Add-Content -Path $OutputFile -Value "The CUTriggerObject values:`n"
Add-Content -Path $OutputFile -Value "TriggerName: $($CUTriggerObject.TriggerName)"
Add-Content -Path $OutputFile -Value "ReportedBy: $($CUTriggerObject.ReportedBy)"
Add-Content -Path $OutputFile -Value "Timestamp: $($CUTriggerObject.Timestamp)"
Add-Content -Path $OutputFile -Value "UTCTimestamp: $($CUTriggerObject.UTCTimestamp)"
Add-Content -Path $OutputFile -Value "Timezone: $($CUTriggerObject.Timezone)"
if ($null -ne $CUTriggerObject.Columns) {
for ($i = 0; $i -lt $CUTriggerObject.Columns.Count; $i++) {
Add-Content -Path $OutputFile -Value "Columns.Column: $($CUTriggerObject.Columns[$i].Column)"
Add-Content -Path $OutputFile -Value "Columns.ColumnSeverityLevel: $($CUTriggerObject.Columns[$i].ColumnSeverityLevel)"
Add-Content -Path $OutputFile -Value "Columns.ColumnTimestamp: $($CUTriggerObject.Columns[$i].ColumnTimestamp)"
Add-Content -Path $OutputFile -Value "Columns.ColumnUTCTimestamp: $($CUTriggerObject.Columns[$i].ColumnUTCTimestamp)"
Add-Content -Path $OutputFile -Value "Columns.ColumnCrossedThreshold: $($CUTriggerObject.Columns[$i].ColumnCrossedThreshold)"
Add-Content -Path $OutputFile -Value "Columns.ColumnValueBefore: $($CUTriggerObject.Columns[$i].ColumnValueBefore)"
Add-Content -Path $OutputFile -Value "Columns.ColumnValueAfter: $($CUTriggerObject.Columns[$i].ColumnValueAfter)"
}
} else {
Add-Content -Path $OutputFile -Value "No columns were passed.`n"
}
Create an Advanced Trigger and create a To this state: condition and add the condition as shown in the screenshot below
In our case, the disk space on the system drive of the machine "MONITOR" falls below the trigger condition of "50 GB and below. This immediately triggers the script to run.
Upon examining the text file, we can confirm that the trigger successfully populated the values in it:
What you should take away from this example is how the object $CUTriggerObject
can be used in triggers.