How the plugin works
Normal operation of the plugin is ensured when the output of the PowerShell command has the following structure:
- a column with the name of the value to be processed
- a column with the value to be compared to the thresholds
If, in the output of the PowerShell command, there is only the column with the value. the control point will be in UNKNOWN.
Example
PowerShell control
Here we want to calculate how long the file has not been modified.
We check the number of days since the last modification.
- Command:
((Get-Date)- ((Get-ItemProperty -Path $filePath).LastWriteTime)) | select-object -Property Days
- Ouput:
The information is not enough. The checkpoint will be in UNKNOWN.
The column with the name of the value is missing.
We'll generate it in the PowerShell output:
- Command:
((Get-Date)- ((Get-ItemProperty -Path $filePath).LastWriteTime)) | select-object -Property @{Name="$columnName"; Expression = {"$content"}}}, Days
- For example:
((Get-Date)- ((Get-ItemProperty -Path C:UserskerraesDesktopo365.txt).LastWriteTime)) | select-object -Property @{Name="Name"; Expression = {"AntivirusBaseIsLate"}}}, Days
- Output :
In the order, the part:
{{Name="Name"; Expression = {"AntivirusBaseIsLate"}}
allows you to create a column with the content "Expression" in the output.
Control Point Configuration
The GLOBAL-PS-Values service model is used.
In the " Name Property " parameter: the name of the column where the name of the value is located. If the control is Warning or Critical, this value will be the plugin output.
In the "Property to control" parameter: the name of the column where the value is located.