github lordmilko/PrtgAPI v0.9.7
PrtgAPI 0.9.7

latest releases: v0.9.19, v0.9.18, v0.9.17...
4 years ago

New Features

  • It is now possible to theoretically create any type of sensor supported by PRTG via dynamic parameters using PrtgAPI. Sensor types that require additional information be provided prior to retrieving their parameters can now specify a SensorQueryTarget value or set of SensorQueryTargetParameters. For more information, please see the wiki (#69)

New Cmdlets

  • New-Trigger: create a new notification trigger via PowerShell style, via dynamic cmdlet parameters (rather than constructing a parameter "object" C# style). Implemented under existing Add-Trigger cmdlet, allowing cmdlet names to be used interchangably
    Get-Probe | New-Trigger -Type State -OnNotificationAction *ticket* -Latency 40
  • Set-TriggerProperty: modify properties of Notification Trigger objects. Functions identically to Set-ObjectProperty and Set-ChannelProperty. Allows either a single -Property and -Value to be specified, or allows multiple properties to be modified at once via dynamic cmdlet parameters. Replaces existing Edit-TriggerProperty cmdlet

New Methods

  • PrtgClient.SetTriggerProperty: modify properties of Notification Trigger objects. Functions identically to SetObjectProperty and SetChannelProperty

Improvements

General

  • SetObjectProperty / Set-ObjectProperty now considers a standalone \r to be a valid newline character when setting a label as part of an ObjectProperty.Location
  • Implemented support for overriding the default name used for typed properties on NewObjectParameters. Name overrides can now be manipulated via new AddNameOverride, GetNameOverrides, ContainsNameOverride and RemoveNameOverride methods
    • DynamicSensorParameters will automatically apply any required name overrides based on the dynamic parameter values it retrieves from PRTG

C#

  • Implemented new Value property on ChannelHistoryRecord. Displays the numeric raw value of the channel, expressed in the lowest possible unit. Previous Value property has been renamed to DisplayValue (#71)
  • Implemented new Threshold property on NotificationTrigger. Displays the numeric threshold of the trigger, if applicable. Previous Threshold property has been renamed to DisplayThreshold
  • NotificationTrigger properties State, UnitSize, UnitTime and Period are now public
  • Implemented ObjectId property on ISubObject interface. Identifies the object the subobject is a child of
  • Implemented ParentId property on IPrtgObject interface and moved ParentId property from SensorOrDeviceOrGroupOrProbe to PrtgObject

PowerShell

  • Implemented support for filtering by all NotificationTrigger properties on Get-NotificationTrigger
  • Implemented support for specifying an -Id to Get-SensorType rather than piping in a Device

Breaking Changes

General

  • Renamed TriggerSensorState.PartialDown to DownPartial to reflect new name within PRTG and maintain consistency with value Status.DownPartial

C#

  • Renamed SensorHistoryData to SensorHistoryRecord
  • Renamed ChannelHistoryRecord.Value to DisplayValue
  • Renamed NotificationTrigger.Threshold to DisplayThreshold
  • Changed VolumeTriggerParameters.UnitSize from DataVolumeUnit to DataUnit. Attempting to assign a DataUnit that does not exist in DataVolumeUnit will trigger an InvalidOperationException
  • Removed all setters on interfaces derived from IObject
  • Renamed base class SensorOrDeviceOrGroupOrProbeOrTicketOrTicketDataOrHistory to SensorOrDeviceOrGroupOrProbeOrTicketOrTicketData
  • GetDynamicSensorParameters / GetSensorTargets, etc now include a new queryParameters parameter. Any method invocations specifying the CancellationToken that do not wish to modify the query target parameters should ensure the token is specified as a named parameter, e.g.
    client.GetDynamicSensorParameters(1001, "exexml", token: cts.Token)

PowerShell

  • Replaced Edit-TriggerProperty cmdlet with Set-TriggerProperty cmdlet. Set-TriggerProperty is fully compatible with Edit-TriggerProperty syntax; simply rename from Edit to Set

Bugfixes

General

  • Fixed PrtgAPI not throwing an InvalidOperationException upon trying to create a new object containing a mandatory array consisting solely of empty values
  • Fixed StringEnum values incorrectly considering "split" values (such as Sensor (ping)) as being equal based solely on their enum value.
    • Two split StringEnum values are now only considered equal if both their Value and StringValue properties are the same (such that Sensor (ping) != Sensor (wmiservice))
    • Otherwise any other set of StringEnum values are considered equal either their Value or StringValue is the same (such that Sensor (ping) == Sensor || Sensor (ping) == ping)
  • Fixed SetChannelProperty / Set-ChannelProperty not serializing ValueLookup property values properly (#76)
  • Fixed DynamicSensorParameters failing to parse PRTG response properly when non-hidden input field is added before hidden input field of a different type (such as in the case of WMI Share sensor parameters)

PowerShell

  • Resolved an issue wherein New-Sensor would throw a NotImplementedException when piped from an empty list of devices
  • Fixed PrtgAPI throwing a NullReferenceException when trying to view progress in PowerShell Core
  • Fixed Set-ChannelProperty not throwing when no parameters are specified
  • Fixed Get-SensorHistory failing to load custom formats when your username contains a space
  • Fixed Get-SensorHistory showing an empty pair of brackets on a channel column when a channel unit is an empty string

Project

Quality

  • All exception messages should now properly end in a period or question mark

Cross Platform

  • PrtgAPI now uses Environment.NewLine everywhere it needs to refer to a newline
  • Replaced all TEMP environment variable references with Path.GetTempPath()

Don't miss a new PrtgAPI release

NewReleases is sending notifications on new releases.