The PowerShell Probe executes an arbitrary PowerShell script. It offers carte blanche to check any aspect of system health or performance that may be needed, but it also requires expertise and experimentation to configure.
A PowerShell probe is automatically considered to have failed if any element of the script writes output on the error stream.
Whatever object is written last to the Output stream is assigned as the Value and considered by the Fail Rule. It is strongly recommended to return simple .NET types as the last element (such as boolean, int, or string). This will ensure that serialization errors don't occur in saving the health check.
The PowerShell probe supports remoting, but it is almost always simpler to create a local Panel Service installation.
Settings
- Script – PowerShell script to execute
- Use PS Remoting – Whether to consider the following fields to configure remoting
- Host – Remote host
- User & Password – Optional remoting credentials
- Auth Mechanism – Remoting auth mechanism
- URI – Remoting URI, default /wsman
- Schema URI – Remoting schema URI, default http://schemas.microsoft.com/powershell/Microsoft.PowerShell
- Use SSL – Whether to use SSL for remoting connection
- Port – Remoting Port, default 5985
- Operation Timeout Seconds – Remoting timeout, default 240
- Max Redirect – Remoting redirect limit, default 3
- Fail Rule – Rule to evaluate final object returned by probe
PowerShell Dependency
As of Identity Panel v6, this probe has a dependency on PowerShell Core 7 (required by Panel Service).
See Q&A: PowerShell health check probe creates many temporary files and folders to ensure system compatibility issues do not result in unwanted consumption of available disk space when upgrading Identity Panel.
JSON
The following JSON is a sample PowerShell script to check that the PanelCheck service is running.
$task = $null $task = Get-ScheduledTask -TaskName "PanelCheck" -ErrorAction SilentlyContinue -OutVariable task $task -ne $null -and $task.State -ne "Disabled"
Upload the following JSON to configure a Probe for the above PowerShell script, which can then be coupled with a Service Task Workflow to restart the service if necessary.
{
"Extensions": {
"$type": "SoftwareIDM.PanelModel.Models.Extensions, SoftwareIDM.PanelModel",
"Data": [
{
"$type": "SoftwareIDM.PanelModel.Models.HealthExtension, SoftwareIDM.PanelModel",
"Interval": 60,
"Data": [
{
"$type": "SoftwareIDM.PanelModel.Models.HealthDefinition, SoftwareIDM.PanelModel",
"Name": "Platform Performance",
"PreferredServices": [
"Panel"
],
"Probes": [
{
"$type": "SoftwareIDM.PanelModel.Models.PowerShellProbe, SoftwareIDM.PanelModel",
"Parameters": [],
"Script": "$task = $null\n$task = Get-ScheduledTask -TaskName \"PanelCheck\" -ErrorAction SilentlyContinue -OutVariable task\n$task -ne $null -and $task.State -ne \"Disabled\"\n",
"Connection": {
"UseRemoting": false,
"Host": "",
"User": "",
"Password": "",
"AuthMechanism": "Default",
"Uri": "/wsman",
"SchemaUri": "http://schemas.microsoft.com/powershell/Microsoft.PowerShell",
"UseSSL": false,
"Port": 5985,
"TimeoutSeconds": 240,
"MaxRedirect": 3
},
"Name": "Panel Check",
"ConditionRule": null,
"FailRule": "Not(Value)"
}
]
}
],
"Name": "Health Checks",
"TypeLabel": "Health Check Settings",
"Enabled": true,
"Id": "ef24f490-a798-4f22-88e0-3e4768b30a76"
}
]
}
}
Comments
0 comments
Please sign in to leave a comment.