< Back

Get-Sensor

Sun Jan 19, 2020 5:42 pm

NAME Get-Sensor



SYNOPSIS

Retrieves sensors from a PRTG Server.





SYNTAX

Get-Sensor [[-Name] <string[]>] [[-Filter] <SearchFilter[]>] [-Access {Inherited | None | Read | Write | Full |

Admin}] [-Active <bool[]>] [-BaseType {Sensor | Device | Group | Probe}] [-Comments <string[]>] [-Count <int>]

[-DataCollectedSince <DateTime[]>] [-Dependency <string[]>] [-Device <NameOrObject`1>] [-DownDuration

<TimeSpan[]>] [-Downtime <double[]>] [-Favorite <bool[]>] [-Group <NameOrObject`1>] [-Id <int[]>] [-Interval

<TimeSpan[]>] [-LastCheck <DateTime[]>] [-LastDown <DateTime[]>] [-LastUp <DateTime[]>] [-LastValue <double[]>]

[-Message <string[]>] [-MiniGraph <string[]>] [-ParentId <int[]>] [-Position <int[]>] [-Priority {None | One | Two

| Three | Four | Five}] [-Probe <NameOrObject`1>] [-Recurse <SwitchParameter>] [-Schedule <string[]>] [-Status

{None | Unknown | Collecting | Up | Warning | Down | NoProbe | PausedByUser | PausedByDependency |

PausedBySchedule | Unusual | PausedByLicense | PausedUntil | DownAcknowledged | DownPartial | Paused}] [-Tags

<string[]>] [-TotalDowntime <TimeSpan[]>] [-TotalMonitorTime <TimeSpan[]>] [-TotalUptime <TimeSpan[]>] [-Type

<StringEnum`1[]>] [-UpDuration <TimeSpan[]>] [-Uptime <double[]>] [-Url <string[]>] [<CommonParameters>]



Get-Sensor [[-Name] <string[]>] [[-Filter] <SearchFilter[]>] [-Access {Inherited | None | Read | Write | Full |

Admin}] [-Active <bool[]>] [-BaseType {Sensor | Device | Group | Probe}] [-Comments <string[]>] [-Count <int>]

[-DataCollectedSince <DateTime[]>] [-Dependency <string[]>] [-Device <NameOrObject`1>] [-DownDuration

<TimeSpan[]>] [-Downtime <double[]>] [-Favorite <bool[]>] [-Group <NameOrObject`1>] [-Id <int[]>] [-Interval

<TimeSpan[]>] [-LastCheck <DateTime[]>] [-LastDown <DateTime[]>] [-LastUp <DateTime[]>] [-LastValue <double[]>]

[-Message <string[]>] [-MiniGraph <string[]>] [-ParentId <int[]>] [-Position <int[]>] [-Priority {None | One | Two

| Three | Four | Five}] [-Probe <NameOrObject`1>] [-Recurse <SwitchParameter>] [-Schedule <string[]>] [-Status

{None | Unknown | Collecting | Up | Warning | Down | NoProbe | PausedByUser | PausedByDependency |

PausedBySchedule | Unusual | PausedByLicense | PausedUntil | DownAcknowledged | DownPartial | Paused}] [-Tag

<string[]>] [-TotalDowntime <TimeSpan[]>] [-TotalMonitorTime <TimeSpan[]>] [-TotalUptime <TimeSpan[]>] [-Type

<StringEnum`1[]>] [-UpDuration <TimeSpan[]>] [-Uptime <double[]>] [-Url <string[]>] [<CommonParameters>]





DESCRIPTION

The Get-Sensor cmdlet retrieves sensors from a PRTG Server. Sensors are the fundamental unit of monitoring in

PRTG, and the most populous type of object in the system by far. Get-Sensor provides a variety of methods of

filtering the sensors requested from PRTG, including by sensor name, ID, status and tags as well as parent

probe/group/device. Multiple filters can be used in conjunction to further limit the number of results returned.

Sensor properties that do not contain explicitly defined parameters on Get-Sensor can be specified as dynamic

parameters, allowing one or more values to be specified of the specified type. All string parameters support the

use of wildcards.



For scenarios in which you wish to exert finer grained control over search filters, a custom SearchFilter object

can be created specifying the field name, condition and value to filter upon. For information on properties that

can be filtered on, see New-SearchFilter. When searching for Sensor Factory objects, please note that these

objects do not respond to server side filters by "type". To filter for Sensor Factory sensors, filter by the tag

"factorysensor".



When invoked with no arguments, Get-Sensor will query the number of sensors present on your PRTG Server. If

PrtgAPI detects the number is about a specified threshold, PrtgAPI will split the request up into several smaller

requests which will each be invoked one after the other. Results will then be "streamed" to the pipeline as each

smaller request completes. A progress bar will also be visible up the top indicating the total number of sensors

retrieved/remaining.



Get-Sensor provides two parameter sets for filtering objects by tags. When filtering for sensors that contain one

of several tags, the -Tag parameter can be used, performing a logical OR between all specified operands. For

scenarios in which you wish to filter for sensors containing ALL specified tags, the -Tags parameter can be used,

performing a logical AND between all specified operands.



When requesting sensors belonging to a specified group, PRTG will not return any objects that may be present under

further child groups of the parent group. To work around this, by default Get-Sensor will automatically recurse

child groups if it detects the initial sensor request did not return all items (as evidenced by the parent group's

TotalSensors property. If you do not wish Get-Sensor to recurse child groups, this behavior can be overridden by

specifying -Recurse:$false.



The Sensor objects returned from Get-Sensor can be piped to a variety of other cmdlets for further processing,

including Get-Channel, wherein the ID of the sensor will be used to acquire its underlying channels.





PARAMETERS

-Device <NameOrObject`1>

The parent Device to retrieve sensors for, or a wildcard expression specifying the names of the devices to

retrieve sensors for.



Required? false

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Probe <NameOrObject`1>

The Probe to retrieve sensors for, or a wildcard expression specifying the names of the probes to retrieve

sensors for.



Required? false

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Group <NameOrObject`1>

The group to retrieve sensors for.



Required? false

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Recurse <SwitchParameter>

When piping from a Group, specifies that PrtgAPI should also recursively traverse all subgroups until all

objects that should be returned by this cmdlet have been found. By default this value is true. If this value

is false, PrtgAPI will not return objects from under any subgroups of the target group.



Required? false

Position? named

Default value True

Accept pipeline input? false

Accept wildcard characters? false



-Status <Status[]>

Only retrieve objects that match a specific status.



Possible values: None, Unknown, Collecting, Up, Warning, Down, NoProbe, PausedByUser, PausedByDependency,

PausedBySchedule, Unusual, PausedByLicense, PausedUntil, DownAcknowledged, DownPartial, Paused



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Tags <string[]>

Filter the response to objects with all specified tags. Can include wildcards.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Tag <string[]>

Filter the response to objects with one of several tags. Can include wildcards.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Id <int[]>

Retrieve an object with a specified ID.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Name <string[]>

Filter the response to objects with a certain name. Can include wildcards.



Required? false

Position? 0

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Filter <SearchFilter[]>

Filter the response to objects that match one or more criteria.



Required? false

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Count <int>

Maximum number of results to return. Note: when this parameter is specified wildcard filters such as Name may

behave unexpectedly when wildcard characters are not used and records are being filtered by an additional

property other than ParentId.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Type <StringEnum`1[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Active <bool[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Downtime <double[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TotalDowntime <TimeSpan[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-DownDuration <TimeSpan[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Uptime <double[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TotalUptime <TimeSpan[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-UpDuration <TimeSpan[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TotalMonitorTime <TimeSpan[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-DataCollectedSince <DateTime[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Interval <TimeSpan[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-LastCheck <DateTime[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-LastUp <DateTime[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-LastDown <DateTime[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Access <Access[]>

Possible values: Inherited, None, Read, Write, Full, Admin



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Dependency <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Message <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Priority <Priority[]>

Possible values: None, One, Two, Three, Four, Five



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-LastValue <double[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Favorite <bool[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Schedule <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-MiniGraph <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Comments <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-BaseType <BaseType[]>

Possible values: Sensor, Device, Group, Probe



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Url <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ParentId <int[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Position <int[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

PrtgAPI.PowerShell.NameOrObject`1[[PrtgAPI.Device, PrtgAPI, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null]]

The parent Device to retrieve sensors for, or a wildcard expression specifying the names of the devices to

retrieve sensors for.



PrtgAPI.PowerShell.NameOrObject`1[[PrtgAPI.Probe, PrtgAPI, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null]]

The Probe to retrieve sensors for, or a wildcard expression specifying the names of the probes to retrieve

sensors for.



PrtgAPI.PowerShell.NameOrObject`1[[PrtgAPI.Group, PrtgAPI, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null]]

The group to retrieve sensors for.



PrtgAPI.SearchFilter[]

Filter the response to objects that match one or more criteria.





OUTPUTS

PrtgAPI.Sensor





---------- EXAMPLE 1 ----------



C:\\> Get-Sensor Ping



Get all sensors named "Ping" (case insensitive)



---------- EXAMPLE 2 ----------



C:\\> Get-Sensor *cpu*



Get all sensors whose name contains "cpu" (case insensitive)



---------- EXAMPLE 3 ----------



C:\\> Get-Sensor -Id 2001



Get the sensor with ID 2001



---------- EXAMPLE 4 ----------



C:\\> Get-Sensor -Status Down



Get all sensors in a "Down" status.



---------- EXAMPLE 5 ----------



C:\\> Get-Device *fw* | Get-Sensor Ping



Get all sensors named "Ping" (case insensitive) from all devices whose name contains "fw"



---------- EXAMPLE 6 ----------



C:\\> Get-Sensor -Count 1



Get only 1 sensor from PRTG.



---------- EXAMPLE 7 ----------



C:\\> Get-Sensor -Tag wmicpu*,wmimem*



Get all WMI CPU Load and WMI Memory sensors.



---------- EXAMPLE 8 ----------



C:\\> Get-Sensor -Tags ny,wmicpu*



Get all WMI CPU Load sensors from all New York devices.



---------- EXAMPLE 9 ----------



C:\\> Get-Sensor -Type *snmp*



Get all SNMP sensors using a dynamic parameter.



---------- EXAMPLE 10 ----------



C:\\> flt type contains snmp | Get-Sensor



Get all SNMP sensors using a SearchFilter.



---------- EXAMPLE 11 ----------



C:\\> Get-Group -Id 2001 | Get-Sensor -Recurse:$false



Get all sensors from devices directly under the specified group, ignoring all child groups.



RELATED LINKS

Online version: https://github.com/lordmilko/PrtgAPI/wi ... powershell

Get-Device

Get-Group

Get-Probe

Get-Channel

New-SearchFilter

Add-Sensor