New Cmdlets
New-Sensor
: Allows creating supported sensor types via dynamic PowerShell parameters# Create a new ExeXml sensor Get-Device -Id 1001 | New-Sensor -ExeXml "Veeam Backups" "Get-VeeamBackupStatus.ps1" -Mutex "veeam1" # Create a new sensor factory Get-Sensor -Tags wmicpu* | New-Sensor -Factory "CPU Overview" { $_.Device } -sn "Average Usage" -se Average -DestinationId 1001 -FactoryErrorMode WarnOnError
Improvements
General
- All
NewSensorParameters
types now automatically initialize theirPriority
,InheritTriggers
,InheritInterval
,Interval
andIntervalErrorMode
properties to the default values used by all sensor types - Implemented new type
FactorySensorParameters
. Provides native support for creating new sensor factory objects - Implemented support for specifying raw GPS location coordinates to
SetObjectProperty
- Implemented support for specifying a custom location label/name for devices, groups and probes when setting an
ObjectProperty.Location
(#60)- If the specified location contains multiple lines, the first line will be treated as a label (unless doing so causes the rest of the address to become invalid)
- A custom label can also be explicitly specified by specifying the
ObjectProperty.LocationName
parameter in conjunction withObjectProperty.Location
SetChannelProperty
now considers the unit of a channel when modifying channel properties that require a unit factor (#63)- If only a sensor ID or channel ID is specified, PrtgAPI will automatically retrieve the appropriate
Channel
objects
- If only a sensor ID or channel ID is specified, PrtgAPI will automatically retrieve the appropriate
SetObjectProperty
/SetChannelProperty
no longer overrides explicitly defined parameters that conflict with dependent values. For example, specifyingUpperErrorLimit
withLimitsEnabled = false
will now setLimitsEnabled
to false instead of flipping it totrue
- All exception messages should now end in a period or question mark
AddSensor
now validates that the sensor type is actually supported before trying to add a sensor
C#
- All
PrtgClient
methods that operate on a single object now support accept an argument of typeEither<,>
, allowing you to specify anIPrtgObject
orint
for the ID parameter//Manipulate an object without having to access its ID! client.PauseObject(sensor); //Specify an ID explicitly client.PauseObject(1001);
- All
TriggerParameters
constructors now support specifying a value of typeEither<IPrtgObject, int>
- Implemented new property
ConstructorScope
for use with customRawSensorParameters
types. When wrapped withusing
in the constructor, instructs PrtgAPI not to set the dependencies of any properties defined within its scope. Once the scope has been disposed, dependencies will become settable - All
PrtgClient
methods now perform proper input validations - Implemented new
SetChannelProperty
overloads that support specifying a channel directly
PowerShell
- Implemented support for viewing online PowerShell help. Invoking
Get-Help <cmdlet> -online
against any PrtgAPI cmdlet will now open the corresponding wiki page in your web browser Get-Sensor
,Get-Device
,Get-Group
,Get-Probe
,Set-ObjectProperty
andSet-ChannelProperty
now show their dynamic parameters underGet-Help
Get-SensorTarget
now supports filtering by a list of values- Implemented PowerShell table format for
ModificationEvent
objects
New-SensorFactoryDefinition
- Implemented new
fdef
alias forNew-SensorFactoryDefinition
-ChannelId
is now an optional parameter. If no-ChannelId
is specified, defaults to0
- Implemented new Summary parameter set. Allows generating a leading summary channel
Get-Sensor -Tags wmicpu* | fdef { $_.Device } -sn "Average Usage" -se Average
-Aggregator
parameter now allows specifying either a customScriptBlock
or one of several well known summary types (e.g.Sum
,Min
,Max
,Average
)
Breaking Changes
C#
- Renamed
PrtgClient.SetObjectProperty
overloads that operate on channels toPrtgClient.SetChannelProperty
ScanningInterval
andTriggerChannel
now throw anArgumentException
instead of anInvalidCastException
when a value cannot be parsed- Removed
tags
parameter fromExeXmlSensorParameters
,HttpSensorParameters
andWmiServiceSensorParameters
constructors - Removed
inheritInterval
,interval
,intervalErrorMode
parameters fromExeXmlSensorParameters
constructor - Changed
ExeXmlSensorParameters
propertiesSetExeEnvironmentVariables
andUseWindowsAuthentication
frombool?
tobool
- Changed
HttpSensorParameters
propertiesUseCustomPostContent
andUseSNIFromUrl
frombool?
tobool
Bugfixes
- Fixed SSL certificate errors not being ignored properly when a server protocol or port is explicitly specified (#67)
- Fixed input tags not being identified correctly when the input name or value contained "radio" or "checkbox" (#59)
- Fixed the
PrtgWebClient
throwing aNullReferenceException
when theWebRequest.DefaultWebProxy
isnull
(#62) - Fixed many instances where PrtgAPI did not validate input parameters properly, typically resulting in a
NullReferenceException
- Fixed incorrect
XmlEnum
values onWmiServiceStatus.StopPending
,ContinuePending
andPausePending
(#64) - Fixed
AddSensor
not validating sensors were created successfully in PRTG 18.1+. If a sensor cannot be created under a given device, PrtgAPI will now throw an exception specifying the reason for the failure - Fixed
CloneObject
failing to parse ID of created sensors in PRTG 19.1. Note: due to a known issue in PRTG 19.1, devices and groups will not return their ID after they have been created, which will result in aPrtgRequestException
. This issue has been reported to Paessler, who have confirmed this behavior is not expected