lordmilko / PrtgAPI

C#/PowerShell interface for PRTG Network Monitor
MIT License
301 stars 37 forks source link

`Port` property for sensors of type port/portrange #286

Closed Ash258 closed 2 years ago

Ash258 commented 2 years ago

What are you trying to do, and to what extent does PrtgAPI provide existing functionality around this?

I would like to get property Port/PortList of sensor types Port, Port Range for reports mainly. Or rather verification if everything is configured properly. In inventory I have the ports listed and want to programmatically check this port.

When invoking Get-Sensor -Type port -Count 1 | Get-ObjectProperty in returned processed object these properties are not available even though they are available in the HTML of request controls/objectdata.htm?id=2343&objecttype=sensor

Would be possible to add these properties to the object returned from Get-ObjectProperties?

I hope I did not overlooked some cmdlet or object, which could hold this property, but I believe it is not processed intentionally right now. portrange, port are not valid for Get-ObjectProperty -Property paramter

This is result of the object property gathering:

Get-ObjectProperty properties ```txt InheritAccess : True ParentTags : DebugMode : Url : HttpRequestMethod : PostData : UseCustomPostContent : PostContentType : UseSNIFromUrl : Timeout : 5 PingPacketSize : PingMode : PingCount : PingDelay : 0 AutoAcknowledge : PrimaryChannel : Open Ports GraphType : Independent ExeFile : ExeParameters : SetExeEnvironmentVariables : UseWindowsAuthentication : Mutex : WmiMode : Target : PingRemotePacketSize : ChannelDefinition : FactoryErrorMode : FactoryErrorFormula : FactoryMissingDataMode : StartStopped : NotifyChanged : False MonitorPerformance : ServiceName : Database : UseCustomInstance : InstanceName : SqlEncryptionMode : UseSqlInputParameter : SqlInputParameter : SqlTransactionMode : Name : Traefik Proxy (80, 443, 8080) Tags : {portrangesensor} Priority : Three InheritProxy : ProxyAddress : ProxyPort : ProxyUser : HasProxyPassword : False InheritInterval : True Interval : 00:01:00 IntervalErrorMode : OneWarningThenDown InheritDependency : True Schedule : None MaintenanceEnabled : False MaintenanceStart : 25/09/2021 12:19:00 MaintenanceEnd : 25/09/2021 12:20:00 DependencyType : Parent DependentObjectId : 0 DependencyDelay : 0 InheritChannelUnit : BandwidthVolumeUnit : BandwidthSpeedUnit : BandwidthTimeUnit : MemoryUsageUnit : DiskSizeUnit : FileSizeUnit : ```
Port range HTML ```html Basic Sensor Settings
```
Port HTML ```html Basic Sensor Settings
```

Is this something that has some sort of parallel in the PRTG UI? If so where do you go/how do you normally do it?

Go to sensor settings and see it in Port/Port Range specific sensor settings.

PRTG info:

Server     : https://prtg.ash258.com
UserName   : prtgadmin
Version    : 22.2.76.1705
RetryCount : 1
RetryDelay : 3
LogLevel   : Trace, Request

PSVersion      : 7.3.0-preview.4
PSEdition      : Core
OS             : Microsoft Windows 10.0.19043
PrtgAPIVersion : 0.9.17
Culture        : en-GB
CLRVersion     : .NETCoreApp,Version=v7.0
PrtgVersion    : 22.2.76.1705
PrtgLanguage   : english.lng

Due Dilligance

lordmilko commented 2 years ago

PrtgAPI defines a type safe wrapper around a limited subset of properties (as seen in the default output of Get-ObjectProperty)

Properties not natively supported by PrtgAPI can be retrieved by specifying Get-ObjectProperty -Raw

For more information please see the wiki