Using the Generic Powershell Template – Global-PS-Values

How the plugin works

Successful operation of the plugin is assured 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 checkpoint will return the UNKNOWN status.

Example

PowerShell command

Here we want to calculate how long since a file was last 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 and the check status will be in UNKNOWN.

The column is missing with the name of the value.

Instead we will generate it in PowerShell:

Command:

((Get-Date) – ((Get-ItemProperty -Path $ filePath) .LastWriteTime)) | select-object -Property @ {Name = “$ columnName”; Expression = {“$ content”}}, Days

Example:

((Get-Date) – ((Get-ItemProperty -Path C: \ Users \ kerraes \ Desktop \ o365.txt) .LastWriteTime)) | select-object -Property @ {Name = “Name”; Expression = {“AntivirusBaseIsLate”}}, Days

Output:

In the command…

@ {Name = “Name”; Expression = {“AntivirusBaseIsLate”}}

allows us to create the needed column with the content “Expression” in the output.

 

Template configuration

We use the ‘GLOBAL-PS-Values’ service template

In the “Property Name” filed: enter the name of the column containing the metric name

(If the check is Warning or Critical, this value will be shown in the plugin output)

In the “Property to check” field: enter the name of the column holding the value.

 

 

 

UK ServiceNav Product Development Manager; my priority is to be needful of the particular requirements of all ‘English-speaking’ markets where ServiceNav is sold. I have over 20 years experience of the IT monitoring field - covering a wide variety of products and technologies.