KBI 311910 Documentation For PSPlayer Usage In PowerShell Rules
Version
Argent Guardian Ultra – All versions
Date
Friday, 5 February 2021
Summary
PowerShell Documentation For Argent Guardian Ultra Rules
Technical Background
N/A
Resolution
System PowerShell Rules
PowerShell Rules permit extremely flexible monitoring, since it is done through a custom PowerShell script.
What makes PowerShell Rules so powerful and useful is their obvious ability to run any PowerShell script.
To tightly integrate with PowerShell technology, Argent provides a set of Properties and Methods by extending the PowerShell script naming space.
They are conveniently available through the drop down menu by clicking the specific buttons.
Properties
Use this drop-down to select the name of the server that the Rule is run against.
The following read-only variables can be used
$PSPlayer.TargetServer The name of server that the rule is run against
$PSPlayer.AGClusterName Cluster name
$PSPlayer.AGClusterObject Cluster Object internal name
$PSPlayer.AGNodeAlias Node Alias
$PSPlayer.RuleName Rule Name
$PSPlayer.UsedRelatorInterval Relator Interval
Methods
Use this drop-down to select from the available options.
FireAlert
This method fires an Event in the Argent Console. It causes the Rule to be broken and an alert to be fired.
Syntax:
$PSPlayer.FireEvent(message, summary, comparison_string)
The parameter message is a string type, and is the event detail.
The parameter summary is a string type, and is the event summary.
comparison_string is used to uniquely identify the event.
It affects the calculation of event occurrence.
DoMessage
This method generates a network message.
The Messenger service must be running in order to get the message generated.
Syntax:
$PSPlayer.DoMessage(message)
The parameter message is string type. It is the actual message text shown on the desktop.
WriteStatus Message
This method writes text into the service log.
Syntax:
$PSPlayer.WriteStatus(message)
The parameter message is a string type. It is the actual message written to the service log.
SavePredictor
This method saves the Argent Predictor data into the database, allowing for later trend analysis.
Syntax:
$PSPlayer.SavePredictor(object, counter, instance, metric)
The parameter object is a string type and it is performance data object name.
counter is a string type and it is the performance data counter name.
instance is a string type and it is the performance data instance name.
metric is a numeric type and it is performance data itself.
IsCancelled
This method returns TRUE if execution of the Rule is cancelled.
This method makes the Rule more responsive, especially when the Rule runs in some sort of loop.
Syntax:
if $PSPlayer.IsCancelled(wait_ms){…} else {…}
The parameter wait_ms is the sleep time in milliseconds.
The method returns TRUE immediately if the cancel event is detected, or returns FALSE in wait_ms milliseconds.
GetNodeParam
This method retrieves Node parameters.
Syntax:
$PSPlayer.GetNodeParam(“var_name”)
The parameter var_name is a string type, and node property.
GetParam
This method retrieves parameters.
Syntax:
$PSPlayer.GetParam(“var_name”)
The parameter var_name is a string type.