New Features
General
-
PrtgAPI can now be instructed to ignore SSL errors with your PRTG Server. Affects all requests to your PRTG Server for the life of your process. Configured by specifying
ignoreSSL
in thePrtgClient
constructor, or by specifying-IgnoreSSL
toConnect-PrtgServer
/Set-PrtgClient
//C# var client = new PrtgClient("prtg.example.com", "prtgadmin", "prtgadmin", ignoreSSL: true);
#PowerShell Connect-PrtgServer prtg.example.com -IgnoreSSL
C#
-
Implemented a custom
IQueryProvider
for writing LINQ queries viaIQueryable
expression trees. Supports parsing any type of expression, regardless of whether or not it can be evaluated server side. For more information see Queryclient.QuerySensors(s => s.Name == "Ping").Take(3).Select(s => s.Name)
PowerShell
-
Get-Sensor
,Get-Device
,Get-Group
andGet-Probe
now allow specifying dynamic parameters. Any property present on the cmdlet's respective object type can now be used as a parameter. All dynamic parameters allow specifying an array of valuesGet-Sensor -Position 1,2 -ParentId 1001,1002 -Type ping
-
Get-Sensor
,Get-Device
,Get-Group
andGet-Probe
now support using theirValueFromPipeline
properties as name filters as well. A single name can be specified. May contain wildcardsGet-Sensor -Device dc-1
New Methods
PrtgClient.GetSensor
/Device
/Group
/Probe
/NotificationAction
/Schedule
/Channel
: retrieves and validates that a single sensor, device, group, probe, notification action, schedule or channel with a specified object ID exists. If the specified object does not exist or an ambiguous match is found, anInvalidOperationException
is thrownPrtgClient.GetChannel
/NotificationAction
/Schedule
: retrieves and validates that single channel, notification action or schedule exists with a specified name. If an object with the specified name does not exist or an ambiguous match is found, anInvalidOperationException
is thrownPrtgClient.GetObjects
: Retrieves uniquely identifiable objects of any type present within the PRTG Configuration File. Includes multiple overloads for synchronous, asynchronous and streaming request methodsPrtgClient.QuerySensors
/Devices
/Groups
/Probes
/Logs
: Retrieves sensors, devices, groups, probes and logs viaIQueryable
LINQ expressions- Implemented several new
PrtgClient.GetLogs
overloads that do not require specifying anobjectId
, as well as several new overloads that allow specifying a custom set ofLogParameters
- Implemented new
RestartProbe
overload. Allows specifying multiple probe IDs
New Cmdlets
Get-Object
: retrieves uniquely identifiable objects of any type present within the PRTG Configuration File, including internal system configuration nodesSet-PrtgClient
: modifiesPrtgClient
/ PrtgAPI Session properties after a session has been created
Improvements
Object Model
- PRTG objects modelled by PrtgAPI are now divided into three types:
IPrtgObject
,ISubObject
andIEventObject
, all deriving from a base typeIObject
. For information see Object Model SensorHistoryData
,ChannelHistoryRecord
,ModificationEvent
andLog
now implementIEventObject
NotificationTrigger
andChannel
now implementISubObject
- Implemented new
LastValue
property onSensor
. Displays the last raw numeric value of the sensor's primary channel Schedule
objects now display their entire timetables, providing multiple views for inspecting the weekly scheduleGet-ObjectProperty
/Set-ObjectProperty
can now pipe from anyPrtgObject
rather than sensors, devices, groups and probes exclusively- It is now possible to modify and retrieve Channel Unit properties from sensors, devices, groups and probes
ContainerSettings
now include aCoordinates
property that displays the latitude and longitude of the object'sLocation
, if one is setScanningInterval
,TriggerChannel
andNotificationTypes
now implementIEquatable
ScanningInterval
andTriggerChannel
now specify aTryParse
methodGetObjectPropertyRaw
/Get-ObjectProperty
now support specifying to use text mode, allowing option properties to return their setting labels rather than their internal values
Performance
NotificationAction
,NotificationTrigger
andTableSettings
objects now loadSchedule
objects lazily when retrieved synchronously. When retrieved asynchronously, PrtgAPI will resolve all schedules immediately, in parallel- Expanded reflection cache to all instances of property/attribute reflection
- Reduced allocations in XML deserialization engine
GetChannelsAsync
andGetNotificationActionsAsync
now execute their secondary request methods in parallel, rather than serially
Search Filters
SearchFilter
objects can now specify a customFilterMode
which specifies the extent to which PrtgAPI should perform additional transformations on the specified value to ensure it is formatted according to the requirements of the specifiedProperty
. For more information please see FiltersNew-SearchFilter
now has-Illegal
and-Raw
parameters for specifying theFilterMode
. For more information please see Filters
Streaming
- When streaming serially with a
Start
of 0, PrtgAPI no longer retrieves the total number of objects that exist before starting streaming. This is now extracted from the initial response - When specifying a
-Count
in conjunction with a search filter on any kind of table cmdlet, PrtgAPI will now wrap the request in a newTakeIterator
, ensuring as many results are returned as possible, regardless of how the server interprets the expression. For example, the expressionGet-Device dc* -Count 2
may return the device "xap-dc-1". This record will be ignored and replaced with another
Parameters
TableParameters
now have newAddFilters
/RemoveFilters
records. Allows specifying aparams
of search filtersTableParameters.SearchFilters
is now self initializing. Attempting to performparameters.SearchFilters.Add(filter)
will automatically create the underlying listSensor
/Device
/Group
/Probe
/NotificationAction
/ScheduleParameters
now have a new constructor that takes aparams
ofSearchFilter
- Objects are now ordered by
Id
andName
by default, rather thanProbe
Cmdlets
Get-Device
now explicitly defines a-Host
parameter. Allows filtering by one or moreHost
properties of a deviceNew-TriggerParameters
now supports piping from a sensor, device, group or probe rather than manually specifying an-Id
Get-NotificationTrigger
now supports specifying an array of-OnNotificationAction
or-Type
Get-ObjectLog
now specifies an-Id
parameter. Allows filtering by a single specified object IDGet-ObjectProperty
now specifies a-Text
parameter. When specified in conjunction with a-RawProperty
, allows returning the label of an option property, rather than its internal numeric value- If a
-Count
is specified toGet-SensorHistory
without specifying an-EndDate
,Get-SensorHistory
will dynamically calculate the required end date to retrieve the specified number of items, based on the object'sInterval
or the specified-Average
Connect-PrtgServer
now allows specifying a-LogLevel
Get-Sensor
no longer streams in parallel. Cancelling a largeGet-Sensor
request no longer causes a delay in executing the next API request
Debugging
PrtgClient
now defines aLogLevel
property, allowing one or moreLogLevel
flags to be specified indicating the types of records that should be emitted to theLogVerbose
event handler. Supported log levels includeRequest
,Trace
andResponse
Bugfixes
Object Model
ScanningInterval
now considers two objects equal if they are both convertable to the sameScanningInterval
, regardless of their underlying typeTriggerChannel
now considers two objects equal if they are both convertable to the sameTriggerChannel
, regardless of their underlying typeNotificationTypes
now considers two objects equal if they are both of the same type, have the same number of triggers of each type and have the same inheritance- Fixed
TriggerChannel
objects containing aChannel
incorrectly being converted to aStandardTriggerEnum
(Fix #27) - Fixed Notification Triggers failing to resolve channels containing the same name as
StandardTriggerChannel
values (such as "Total") toChannel
objects - Fixed sensor history records treating speed/volume channels in traffic sensors as having the being channels containing value lookups, resulting in multiple
ChannelHistoryRecord
objects containing the same name - Fixed
Get-SensorHistory
not displaying speed channels of traffic sensors at all - Fixed
DeviceTemplate.GetHashCode
not beingunchecked
Targets
ExeFileTarget
/SqlServerQueryTarget
now returnnull
upon attempting to instantiate a new sensor target fromnull
, instead of returning a new sensor target encapsulating the null valueExeFileTarget
/SqlServerQueryTarget
will now throw upon being instantiated withstring.Empty
- Fixed an issue wherein
ExeFileTarget.Parse
/SqlServerQueryTarget.Parse
failed to parse unserialized strings (e.g.ExeFileTarget.Parse("test.ps1")
)
Search Filters / Requests
- Fixed
bool
not serializing properly in search filters - Fixed
bool
not serializing property when used as aParameter
value - Fixed
Active
,Downtime
,TotalDowntime
,DownDuration
,Favorite
,Uptime
,TotalUptime
,UpDuration
,TotalMonitorTime
,Interval
,LastValue
,UpSensors
,DownSensors
,DownAcknowledgedSensors
,PartialDownSensors
,WarningSensors
,PausedSensors
,UnusualSensors
,UnknownSensors
,TotalSensors
,Url
,Collapsed
,TotalGroups
,TotalDevices
andPosition
not filtering properly when used with certainFilterOperator
values Favorite
,NotificationTypes
and properties of typestring
will now prevent you from filtering by certainFilterOperator
values by default that PRTG
is incapable of evaluating. This can be overridden by specifying a customFilterMode
value- Fixed an issue wherein PrtgAPI would crash when attempting to filter by
string.Empty
due to PrtgAPI expecting the server version to be included in the response - Fixed an issue wherein table cmdlets failed to process search filters properly when both specified via
-Filter
and a parameter that takes pipeline input - Fixed an issue with geographic lookups no longer resolving in PrtgAPI 18.2.41+ due to a change in how the request must be formatted
- Fixed an issue with
GetObjectProperty
/Get-ObjectProperty
failing to retrieve single properties that include invalid XML characters (Fix #33) - Fixed several
GetDevices
/Groups
/Probes
overloads filtering bystring
values only instead of allowing filters of any type
Streaming
Stream
methods now clone the source parameters and as such no longer modify
theCount
andStart
properties of the original parameters object- PrtgAPI now supports streaming objects that do not start their indexes at position 0, which would otherwise result in duplicates being returned between the first and second pages of the response
LogParameters
now stipulate that logs start at index 1, rather than index 0PageableParameters
now report aPage
of 0 whenCount
is 0, instead of crashing- Fixed an issue wherein specifying a
Start
offset and a large or unlimitedCount
would cause PrtgAPI to retrieve too many records, cutting into the records that should have been skipped - When retrieving the total number of objects that PrtgAPI will stream, PrtgAPI now uses any
SearchFilters
that have been specified on the parameters, ensuring a more accurate result is calculated
Parameters
- Fixed a bug wherein
SensorParameters.Status
did not return allStatus
objects when multiple objects were stored in a single search filter SensorParameters.Status
no longer crashes if an object not of typePrtgAPI.Status
is stored in a filter onProperty.Status
- Fixed an issue wherein
DynamicSensorParameters
would crash upon retrieving no sensor targets for a property that supports targets (such as because the device's probe is disconnected)
Cmdlets
- Fixed an issue wherein
Connect-PrtgServer -Progress:$true
did not enable progress where it would otherwise be disabled - Fixed
-Count
not working properly onGet-Sensor
,Get-Device
andGet-Group
used in conjunction with-Recurse:$true
when piping from groups - Fixed
Get-Group
not working properly when piping from another group with-Recurse:$true
and specifying one or more search filters. i.e.Get-Group -Id 1001 | Get-Group Servers
would not find any grandchildren under any children not named "Servers" - Fixed an issue wherein
-Count
was sometimes incorrectly handled byGet-SensorHistory
when used in conjunction with an-EndDate
- Fixed an issue wherein
Get-ObjectLog
did not filter properly when specifying a-Count
in conjunction with a client side search filter (such as-Name
) - Fixed an issue wherein
Restart-PrtgCore
did not wait properly with-Wait:$true
Breaking Changes
Object Model
Channel
andLog
no longer derive fromPrtgObject
- Renamed
Log
andPrtgObject
propertyType
toDisplayType
and propertyRawType
toType
- The raw type of a
Log
/PrtgObject
(propertyType
) is now aStringEnum<ObjectType>
capable of modelling well known and unknown types - Renamed
DeviceOrGroup
property andProperty
enum valueUndefinedSensors
toUnknownSensors
- Renamed
SensorOrDeviceOrGroupOrProbe
propertyIntervalInherited
toInheritInterval
- It is no longer possible to filter by
InheritInterval
- Merged type
ObjectTable
withPrtgObject
- Renamed property
LastValue
toDisplayLastValue
on bothChannel
andSensor
- Renamed
Channel
propertyLastValueNumeric
toLastValue
Sensor
propertiesDowntime
andUptime
now store their values as nullable doubles instead of stringsChannel
propertyUnit
now correctly displays when the PRTG Server language is a language other than English- Renamed
TriggerUnitSize
,TriggerVolumeUnitSize
andTriggerUnitTime
toDataUnit
,DataVolumeUnit
andTimeUnit
respectively ContainerSettings
propertiesSSHEngine
andVMwareSessionMode
are now nullable for compatibility with older versions of PRTG- Renamed
RecordAge.AllTime
toRecordAge.All
TriggerParameters.SubId
is now anint?
instead of astring
- Renamed
RestartProbeProgress
toProbeRestartProgress
- The callback specified to
RestartProbe
now takes an immutable array ofProbeRestartProgress
instead of aList<ProbeRestartProgress>
- The
RestartProbe
overload taking a single probe ID now only sends a singleProbeRestartProgress
object to its callback
Search Filters
- It is no longer possible to filter by
string.Empty
. This can be overridden by specifying a customFilterMode
Parameters
- Renamed base
Parameters
type toBaseParameters
IParameters.GetParameters()
now returns anIDictionary
rather than aDictionary
ContentParameters.Properties
setter is now internal- Renamed
TableParameters.SearchFilter
toTableParameters.SearchFilters
TableParameters.SearchFilters
is now aList<SearchFilter>
rather than an array. If you attempt to interact with this property before it has been initialized, it will now automatically instantiate, store and return a new list for you
Cmdlets
Connect-PrtgServer
parameter-Progress
is now aSwitchParameter
rather than abool
. Progress can now be disabled by specifying-Progress:$false
rather than-Progress $false
- Renamed
Get-ObjectLog
parameter-Since
to-Period
Accessibility
ParallelObjectGenerator
,SerialObjectGenerator
,SensorTypeInternal
,CategoryAttribute
,ObjectPropertyCategory
,Output
andProcessingOption
are nowinternal
- Deleted unused exception type
UnknownTypeException
Namespaces
- Moved all sensor targets to namespace
PrtgAPI.Targets