Releases: lordmilko/PrtgAPI
PrtgAPI 0.8.6
New Features
PowerShell
- Implemented support for specifying a hashtable of
-RawParameters
toSet-ObjectProperty
New Methods
PrtgClient.GetSchedules
: Retrieve all monitoring schedules supported by PRTG
New Cmdlets
Get-PrtgSchedule
: Retrieve all monitoring schedules supported by PRTG
Improvements
General
- Implemented support for retrieving Proxy Settings for HTTP Sensors, Scanning Intervals and Schedules, Dependencies and Maintenance Window settings from devices, groups and probes
PowerShell
New-SearchFilter
now accepts a-Value
of typeobject
rather thanstring
- Implemented support for opening notification actions and schedules via
Open-PrtgObject
- Removed unnecessary call to
PrtgClient.GetGroups
inGet-Sensor
when specifying-Resolve:$false
Bugfixes
General
- Fixed an issue wherein
NotificationAction
objects returned as part of aNotificationTrigger
did not lazily deserialize all of their properties - Probe parameters now prevent filtering by a
ParentId
other than0
- PrtgAPI now correctly serializes
DateTime
andTimeSpan
objects specified in search filters - A more descriptive error message is now thrown when attempting to filter by a
Status
of0
PowerShell
- Fixed several instances of cmdlets not properly unwrapping
PSObject
values - Fixed a bug wherein
Channel
parameter ofSet-ChannelProperty
was not mandatory on Default and Dynamic parameter sets - PrtgAPI now consistently displays all results when performing queries like
Get-Sensor ping -Count 1
. For more information, see Case Sensitive Filtering below
Case Sensitive Filtering
When filtering on a table cmdlet using FilterOperator.Equals
PRTG can become case sensitive when multiple filters are used together (such as Name + Tags). Since the common parlance of PowerShell is to be case insensitive, PrtgAPI circumvents this by filtering using FilterOperator.Contains
even if a wildcard is not specified.
If a -Count
is used in conjunction with a literal -Name
(e.g. Get-Sensor ping -Count 1
) query's results may contain items whose names do not actually match (e.g. SSH Ping
). As PrtgAPI will automatically remove any non-matching items, fewer results than expected may be displayed.
In order to accommodate the common case of Get-Sensor <name> -Count <count>
, when PrtgAPI detects that -Name
and no other filter besides ParentId
has been specified, the Name
filter operator will be changed to FilterOperator.Equals
.
PrtgAPI 0.8.5
Bugfixes
- Fixed an issue wherein
DynamicSensorParameters
prohibit assigning non-sensor target enumerable values to custom parameters
PrtgAPI 0.8.4
New Methods
PrtgClient.GetDeviceTemplates
: Retrieves all device templates supported for use in an auto-discovery
New Cmdlets
Get-DeviceTemplate
: Retrieves all device templates supported for use in an auto-discovery
Improvements
- Device templates can now be specified to
NewDeviceParameters
. Specifying one or more templates will automatically set theAutoDiscoveryMode
toAutomaticTemplate
(#11) - Manual auto-discoveries performed by
AutoDiscover
/Start-AutoDiscovery
can now specify one or more device templates to limit the scope to the discovery - Implemented new property
Is64Bit
onServerStatus
returned byGetStatus
/Get-PrtgStatus
CustomParameter
objects can now specify aParameterType
to indicate whether their values should be treated a single values (name=val
), multi values (name=val1,val2
) or multi parameters (name=val1&name=val2
)- Custom parameters used by
RawSensorParameters
/DynamicSensorParameters
now useParameterType.MultiParameter
by default (#12)
PowerShell
- Added new parameter
-Template
toAdd-Device
. When used in conjunction with-AutoDiscover
, retrieves all device templates that match one or more specified wildcards - Implemented new parameter
-Downtime
onGet-SensorHistory
. When-Average
is not specified, sets the average based on the scanning interval of the sensor, allowing theDowntime
column to be included in response. For more information see the wiki - Implemented new parameter
-ProbeStatus
onGet-Probe
. Allows filtering for probes with a specifiedProbeStatus
Set-ObjectProperty
now allows specifying multiple raw values at once for use with a single raw property
Bugfixes
- Results returned by
GetSensorTypes
/Get-SensorType
no longer include duplicate types returned by PRTG - Raw settings that allow for multiple selections (such as Traffic Mode of SNMP Traffic sensors) returned by
GetObjectPropertiesRaw
/Get-ObjectProperty -Raw
now display correctly
PowerShell
- Fixed a bug wherein
Get-SensorHistory
would not stream properly when an-EndDate
is specified - Fixed an issue wherein several cmdlets would perform their actions before displaying initial progress
- Fixed an issue wherein sensor target resolution would crash when PRTG did not include an error message in its error response (such as when its Host value has changed)
Breaking Changes
- Renamed
Probe
propertyCondition
toProbeStatus
PrtgAPI 0.8.3
Improvements
- Improved
-Verbose
log messages when executing recurse cmdlets
Bugfixes
- Fixed a bug wherein
Get-Sensor
would retrieve all sensors within PRTG when piping from a group with no immediate child devices that has the same name as another group with-Recurse:$true
Get-Sensor
,Get-Device
andGet-Group
will now revert any changes made toSearchFilter
objects if an exception is thrown while recursing
PrtgAPI 0.8.2
New Features
- PrtgAPI can now generate dynamic sensor parameters for almost any sensor type, allowing almost all sensor types to be programatically created. Parameters for sensor types that require additional information before device interrogation (such as Oracle Tablespace) cannot be dynamically generated.
- Sensor Targets can now be retrieved for unsupported sensor types. Supports all sensor types excluding types that require additional information prior to device interrogation (such as Oracle Tablespace)
- Multiple object and channel properties can now be modified in a single request
Improvements
General
NewSensorParameters
now include properties for common sensor parameters, includingName
,Interval
,Priority
, etc- Common sensor parameters that are not specified will not be included in the parameter set, allowing PRTG to instantiate these fields with their default values
RawSensorParameters
now have an indexer, allowing instances to be accessed like aDictionary
SensorType
onRawSensorParameters
can now be modified- Implemented native support for creating new HTTP sensors via
HttpSensorParameters
- Sensor history records returned by
GetSensorHistory
/Get-SensorHistory
are now ordered from newest to oldest
C#
- Multiple object properties can now be modified in a single request by specifying a collection of
PropertyParameter
,ChannelParameter
orCustomParameter
objects toSetObjectProperty
/SetObjectPropertyRaw
GetSensorHistory
now supports specifying acount
, limiting the number of results returned within the specified timespan
PowerShell
RawSensorParameeters
now presents as a hybridPSObject
, allowing values to be modified and retrieved from real property namesNew-SensorParameters
now have an-Empty
parameter. Allows constructing a completely empty set ofRawSensorParameters
for allowing instantiation without constructing a hashtableSet-ObjectProperty
/Set-ChannelProperty
now support specifying object property names as parameters, allowing multiple properties to be modified in a single requestGet-ObjectProperty
now supports specifying multiple individual properties to retrieveGet-SensorHistory
will now stream records from PRTG when an-EndDate
is specified- Implemented
-Count
parameter onGet-SensorHistory
. Allows limiting the number of results returned within the specified timespan
New Methods
PrtgClient.GetDynamicSensorParameters
: Create sensor parameters for a specified sensor typePrtgClient.Targets.GetSensorTargets
: Retrieve sensor targets for unsupported sensor typesPrtgClient.StreamSensorHistory
: Stream large collections of sensor history records from a PRTG Server
New Cmdlets
Get-SensorType
: Retrieve sensor types supported by PRTG
Bugfixes
PowerShell
- Fixed a bug wherein
Get-ObjectLog
would fail to retrieve records-Since AllTime
against certain objects
Breaking Changes
General
- Switched meaning of start date and end date when used with
GetSensorHistory
/Get-SensorHistory
for consistency withGetLogs
/Get-ObjectLog
.StartDate
now refers to the point in time closest to now, whereasEndDate
now refers to the point in time furthest from now
C#
- Sensor parameters no longer accept
Priority
andInheritTriggers
in their constructors - All
enum
andbool
properties onNewSensorParameters
are now nullable
PrtgAPI 0.8.1
Improvements
C#
- Implemented support for resolving objects created via
AddSensor
,AddDevice
,AddGroup
andAddNotificationTrigger
. Can be disabled by setting optional parameterresolve
tofalse
- Installing PrtgAPI from NuGet no longer imports PowerShell Help files into solution
- PrtgAPI.cmd is now included in NuGet, allowing a PrtgAPI PowerShell prompt to be easily opened from your NuGet packages folder
PowerShell
Get-Sensor
,Get-Device
,Get-Group
andGet-Probe
can now filter for objects that contain all specified tags via-Tags
parameter. Filtering for objects that contain any specified tag (previous-Tags
behavior) can now be performed with new-Tag
parameter- PrtgAPI.cmd can now be used regardless of the folder name the PrtgAPI module is installed in
General
NotificationAction
objects now include enhanced properties detailing the specifics of each notification type they perform and the users these alerts are sent to
Bugfixes
C#
- Implemented missing call to
ConfigureAwait(false)
on several methods
PowerShell
- Fixed a bug wherein progress did not complete when an exception is thrown by a multi operation cmdlet
General
- Resolved an issue wherein
ErrorLimitMessage
andWarningLimitMessage
cannot be modified andLimitsEnabled
cannot be set totrue
viaSetObjectProperty
/Set-ChannelProperty
on PRTG 18.1.38+. Attempting to modify these properties when a limit value has not been set on theUpperErrorLimit
,LowerErrorLimit
,UpperWarningLimit
orLowerWarningLimit
of a channel will now generate anInvalidOperationException
specifying the IDs of the sensors that require a limit - Fixed a bug wherein
PrtgUrl
construction would crash when the search filters of a request have been explicitly set tonull
Breaking Changes
PowerShell
-Tags
parameter ofGet-Sensor
,Get-Device
,Get-Group
andGet-Probe
now performs logical AND instead of logical OR. Previous-Tags
behavior can be attained via new-Tag
parameter
PrtgAPI 0.8.0
New Features
General
- Compatible operations now support specifying multiple Object IDs in a single request (e.g. acknowledging, pausing, modifying properties, etc). Cmdlets of operations that now support specifying multiple Object IDs will now execute in Batch Mode by default, queuing all records received from the pipeline so they can be processed at once via a single API call. All operations that support Batch Mode now execute infinitely faster. Batch Mode can be disabled by specifying
-Batch:$false
- Sensor Targets used for creating new sensors including EXE/Advanced Script files, WMI Services and Microsoft SQLv2 database queries can now be resolved from PRTG. Sensor Targets resolved from one object can then be passed assigned to sensor parameter objects and assigned to any device within PRTG.
- Implemented support for retrieving all raw properties (settings) of an object. In C#, these are returned as a dictionary, whereas in PowerShell these are returned as a
PSObject
PowerShell
- Implemented new
-PassThru
parameter on all operation cmdlets that take pipeline input. When specified, the input object to the cmdlet will also be emitted after executing the cmdlet's operation, allowing for mutiple operations to be chained together in a single pipeline - Implemented new
-SourceId
parameter toClone-Object
, allowing a single object to be cloned to multiple objects passed in through the pipeline - PrtgAPI will now automatically resolve any new objects that are created by PrtgAPI cmdlets by default (including
Add-Sensor
,Add-Device
,Add-Group
,Add-NotificationTrigger
andClone-Object
). Resolution of created objects can be disabled by specifying-Resolve:$false
- PrtgAPI will now show progress when executing a pipeline containing
Select-Object
surrounded by PrtgAPI cmdlets. PrtgAPI will only show progress whenSelect-Object
is used as the first or second cmdlet in the pipeline. IfSelect-Object
is used at any point beyond the second cmdlet, progress will be disabled for the entirety of the pipeline - When piping
Get-Sensor
,Get-Device
orGet-Group
from parent groups returned byGet-Group
, PrtgAPI will now recurse all child groups under the parent group, returning all target objects under the entire object hierarchy. Resolution of objects only under the parent group can be performed by specifying-Recurse:$false
New Methods
PrtgClient.AddDevice
: create a new device from a set of device parametersPrtgClient.AddGroup
:: create a new group from a set of group parametersPrtgClient.Targets.GetExeXmlFiles
: list all files under the Custom Sensors\EXEXML folder of a device's PRTG ProbePrtgClient.GetObjectPropertiesRaw
: Retrieves all raw properties defined on an objectPrtgClient.GetObjectProperty
: Retrieves a property from a PRTG object as an object of its true typePrtgClient.GetObjectProperty<T>
: Retrieves a property from a PRTG object cast to its true typePrtgClient.Targets.GetWmiServices
: list all WMI Services installed on the target devicePrtgClient.Targets.GetSqlServerQueries
: list all files under the Custom Sensors\sql\mssql folder of a device's PRTG Probe
New Cmdlets
Add-Device
: create a new device from a set of device parametersAdd-Group
: create a new group from a set of group parametersNew-DeviceParameters
: create a set of parameters for creating a new deviceNew-GroupParameters
: create a set of parameters for creating a new groupGet-SensorTarget
: resolve sensor targets (such as WMI Services or EXE/Script files) that can be used for creating a new sensor
Improvements
General
- Improved deserialization performance by 100%
- PrtgAPI will now throw much more informative exception messages when failing to deserialize enum members
RestartCore
/RestartProbe
(C#) andRestartPrtgCore
/RestartProbe
(PowerShell) now support waiting for the specified targets to restart before completing. C# methods provide a progress callback to allow monitoring or aborting the wait request- Implemented support for creating WMI Service sensors
- PrtgAPI will now automatically resolve any
DescriptionAttribute
defined on an enum used in a set of custom request parameters - If an
IEnumerable
is assigned to aSearchFilter
, PrtgAPI will now iterate over the collection constructing a filter for each item - Increased default maximum number of items returned by
ContentParameters
from 50,000 to unlimited ContainerSettings
andSensorSettings ToString
now returns the object'sName
Object Properties
- Implemented support for retrieving and modifying
Hostv4
,Hostv6
,ServiceUrl
,AutoDiscoveryMode
,AutoDiscoverySchedule
andComments
- Implemented
Host
property alias forHostv4
- Implemented support for modifying and retrieving Microsoft SQL v2 sensor properties
- Implemented support for retrieving a device's
IPVersion
.IPVersion
is automatically updated upon settingHostv4
orHostv6
- Implemented support for modifying all password related fields. Settings objects now contain
Has-
properties (HasWindowsPassword
,HasLinuxPassword
, etc) to indicate whether these values have explicitly been set on the target object Get-ObjectProperty
parameter-RawProperty
can now take multiple property names. If a single property is specified, its value is returned as a string. If multiple properties are specified, aPSObject
containing all property values is returned- Implemented new
-Raw
parameter forGet-ObjectProperty
. If specified,Get-ObjectProperty
will return all raw properties defined on the object - Implemented new
-Property
parameter onGet-ObjectProperty
. Allows specifying a single property to retrieve.
C#
- Implemented support for specifying a
SortDirection
onTableParameters
- Methods that support streaming (and do not do any filtering) now take an optional argument specifying whether the request should be executed serially
PowerShell
- Probes will now show their
Condition
(Connected
/Disconnected
) by default when shown in table view instead of theirStatus
(Up
/Paused
) - Devices will now show their
Host
by default when shown in table view - Sensors, Devices, Groups and Probes now order their output according to their position under their parent object as shown in the PRTG UI
Get-Channel
now supports filtering based on an array of Channel IDs- PrtgAPI objects now show their
Name
property in progress records displayed by inter-cmdlet progress - Implemented support for cloning
NotificationTrigger
objects withClone-Object. Equivalent to piping to
New-TriggerParametersfollowed by
Add-Trigger` - When adding a new sensor
Add-Sensor
will now automatically remove any spaces PRTG erroneously adds around the new sensor name - Cmdlets will now show inter-cmdlet progress when piping from a single variable inside a nested pipeline
Bugfixes
General
- PrtgAPI will now validate the response returned from PRTG when attempting to resolve an address for use with
ObjectProperty.Location
C#
- Fixed a bug wherein
RenameObject
did not rename probes properly - Fixed
Parameter.SortBy
not working due to a missingParameterTypeAttribute
PowerShell
- Fixed several scenarios wherein progress records would not complete after the execution of multiple PrtgAPI cmdlets chained together
Install-GoPrtgServer
no longer emits output when creating the PowerShell profile when it did not previously exist- Fixed a bug wherein
-Status
parameter did not properly work when attempting to filter devices, groups and probes - Fixed
New-SensorParameters
including the sensor type in theCustomParameters
list, resulting in the sensor type being specified twice in the API request - Fixed
Set-ChannelProperty
Manual parameter set not displaying cmdlet target properly when invoked with-WhatIf
- Fixed a bug wherein inter-cmdlet progress would not be enabled by default after updating your GoPrtg credential with
Update-GoPrtgCredential
Breaking Changes
General
- Renamed
ExeName
object property toExeFile
on both enumObjectProperty
andExeXmlSensorParameters
- Split settings property
SSHElevationUser
intoSSHElevationSuUser
andSSHElevationSudoUser
properties - Changed
SensorSettings.DependentObjectId
fromstring
toint?
C#
- Moved
Priority
property to baseNewSensorParameters
class.NewSensorParameters
constructor now requires aPriority
be specified, withRawSensorParameters
includingPriority
as an optional argument. IfPriority
is not specified toRawSensorParameters
, a default priority ofThree
will be used
PowerShell
- Combined
Clone-Sensor
,Clone-Device
andClone-Group
into singleClone-Object
cmdlet - Renamed
-StartIndex
parameter of New-SensorFactoryDefinition to-StartId
- Renamed
-Name
and-Value
properties ofNew-SensorParameters
to-First
and-Second
. Meaning of these parameters is dependent on the type of sensor parameters being generated - Renamed
-Item
parameter ofNew-SensorFactoryDefinition
to-Sensor
PrtgAPI 0.7.3
New Methods
- C#:
BackupConfigDatabase
: Create a backup of your PRTG Configuration Database - C#:
ClearSystemCache
: Clear Geo Map, Active Directory and Graph Data caches - C#:
LoadConfigFiles
: Reload sensor lookups, device icons and report templates from disk - C#:
RestartProbe
: Restart the PRTG Probe Service of a PRTG Probe - C#:
RestartCore
: Restart the PRTG Core Service
New Cmdlets
- PS:
Backup-PrtgConfig
: Create a backup of your PRTG Configuration Database - PS:
Clear-PrtgCache
: Clear Geo Map, Active Directory and Graph Data caches - PS:
Load-PrtgConfigFile
: Reload sensor lookups, device icons and report templates from disk - PS:
Restart-Probe
: Restart the PRTG Probe Service of a PRTG Probe - PS:
Restart-PrtgCore
: Restart the PRTG Core Service
Improvements
- PS:
Get-Sensor
,Get-Device
,Get-Group
andGet-Probe
-Tags
and-Name
parameters now properly parse wildcards containing asterisks in the middle of the pattern
Bugfixes
- C#: Fixed a bug wherein logs would not properly filter by status
Breaking Changes
- C#: Renamed
PrtgClient.DeleteObject
toPrtgClient.RemoveObject
PrtgAPI 0.7.2
New Features
- Sensors can now be created from scratch. For sensor types supported by PrtgAPI, a sensor parameters type can be used to specify all the settings that will be used for the sensor, with PrtgAPI validating that all required fields have values. For sensor types currently unsupported by PrtgAPI, facilities are provided for constructing a set of custom parameters, optionally including full levels of type safety
- PRTG event logs can now be retrieved from any object. If no object is specified, PrtgAPI automatically retrieves logs for today from the root node. Logs can be retrieved from a specific time frame, with a specific status, and can also be limited so that only a certain number of logs are retrieved
New Methods
- C#:
AddSensor
: Create a new sensor from a set of sensor parameters - C#:
GetLogs
: Retrieve event logs for a PRTG object - C#:
GetSensorTypes
: List all sensor types supported by PRTG - C#:
GetStatus
: retrieve the status, configuration and version info of a PRTG Server
New Cmdlets
Add-Sensor
: create a new sensor from a set of sensor parametersNew-SensorParameters
: create a new set of sensor parameters of a specified typeGet-SensorFactorySource
: retrieve the source sensors or channels of a Sensor Factory sensorGet-ObjectLog
: retrieve event logs for a PRTG object (or if no object is specified, for the whole server)Get-PrtgStatus
: retrieve the status, configuration and version info of a PRTG Server
Improvements
- PS:
Move-Object
,Set-ObjectPosition
,Simulate-ErrorStatus
,Sort-PrtgObject
andStart-AutoDiscovery
now support-WhatIf
- PS:
Clone-Sensor
,Clone-Group
andClone-Device
now only make 4 retries when the new object can't be resolved instead of 5 - PS: Implemented
Get-ObjectSetting
alias forGet-ObjectProperty
- PS: Cmdlets that perform streaming now only calculate the total number of objects needed to retrieve once instead of twice
ExeName
of EXE/XML sensors can now be retrieved and modifiedInheritTriggers
property of objects can now be modified- If PrtgAPI detects more than 20,000 objects will need to be streamed, PrtgAPI will instead stream objects "serially" (500 items at a time)
- If PrtgAPI fails to deserialize an enum value due to it posessessing a value unknown to PrtgAPI, an exception will now be thrown describing the value that was missing
Bugfixes
- C#: Fixed a bug in
GetObjectTotals
wherein totals for probe objects would not be properly calculated - C#: Fixed a bug wherein
AddNotificationTriggersAsync
andSetNotificationTriggersAsync
were validating arguments with a synchronous method instead of an async one - PS:
Edit-NotificationTriggerProperty
now throws an an exception when the specified property does not exist on the target trigger parameter type - PS: Fixed an issue wherein
New-SearchFilter
would not work when specifying enum properties whose values require serialization SetObjectProperty
now properly validates values for numeric types- Fixed a bug wherein
PrtgUrl
construction would crash when an array of zeroSearchFilter
objects is specified - Fixed a bug wherein
NotificationTypes
property of sensors, devices, groups and probes did not properly report when sensors aren't inherited - Fixed a bug wherein PrtgAPI would crash attempting to parse a webpage containing an empty dropdown list
- Fixed an issue wherein progress would fail when performing variable progress on a chain containing Action -> Action or Action -> Object -> Action
- Fixed incorrect
XmlEnum
values forAccess.None
andAccess.Inherited
types
Breaking Changes
- C#: Renamed
SensorParameters.StatusFilter
toSensorParameters.Status
- PS: Renamed
New-NotificationTriggerParameter
toNew-NotificationTriggerParameters
- Renamed
NotificationTypes.TriggerInheritance
toNotificationTypes.InheritTriggers
SearchFilter
objects now prevent specifyingnull
as a value. If you wish to specify no value, specify an empty string- Moved
Comments
property from base typeObjectTable
to more derived typeSensorOrDeviceOrGroupOrProbe
- Moved property
Status
fromSensorOrDeviceOrGroupOrProbeOrMessageOrTicket
to more derived typeSensorOrDeviceOrGroupOrProbe
PrtgAPI 0.7.1
Improvements
- PS: Improved error message when attempting to modify a GoPrtg server you are connected to under a different username
- An exception will now be thrown if you attempt to create a
TriggerParameters
object from an inheritedNotificationTrigger
object
Bugfixes
- PS: Fixed a bug wherein
Edit-NotificationTriggerProperty
would fail to parse enum values
Breaking Changes
- C#: Implemented new trigger parameter constructors for creating trigger parameters from existing
NotificationTrigger
objects - C#: Removed redundant
ModifyAction
parameter from existing trigger parameter constructors takingNotificationTrigger
objects. This constructor is now solely for creating brand new notification triggers