PrtgAPI icon indicating copy to clipboard operation
PrtgAPI copied to clipboard

netappcdotio Sensor param timeout

Open schoenm1 opened this issue 3 years ago • 4 comments

Describe the bug

It is not possible to add a new Sensor 'netappcdotio' with mandatory parameters. If param 'timout' is not given for 'New-sensorParemters' , I see following error: New-SensorParameters : Failed to process request for sensor type 'netappcdotio': sensor query target parameters did not include mandatory parameter 'timeout_'. It 'timeout' parameter ist given, 'New-sensorParemters' is working, but not the 'Add-Sensor'. Do I have to add 'timeout' param as -RawProperty and -RawValue? Not really sure if this is a bug...

Steps to reproduce

missing 'timeout' param -> not possible for New-SensorParameter
----------------------------------------------------------------
$device = Get-Device -id 49472
PS C:\Users\micha.schoenenberger> $device | New-SensorParameters -RawType netappcdotio -qp @{defaultlogin_="1";user_="";password_="";port_="443";;transporttype_="1"}
New-SensorParameters : Failed to process request for sensor type 'netappcdotio': sensor query target parameters did not include mandatory parameter 'timeout_'.
At line:1 char:11
+ $device | New-SensorParameters -RawType netappcdotio -qp @{defaultlog ...
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-SensorParameters], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,PrtgAPI.PowerShell.Cmdlets.NewSensorParametersCommand

'timeout' param given -> possible for New-SensorParameter, but not for Add-Sensor
-----------------------------------------------------------------------------------
$device = Get-Device -id 49472
$sensor = $device | New-SensorParameters -RawType netappcdotio -qp @{defaultlogin_="1";user_="";password_="";port_="443";timeout_="60";transporttype_="1"}
-> 'timout' param given, but no visible in $sensor
$sensor

defaultlogin        : 1
user                :
password            :
port                : 443
transporttype       : 1
cdotnodename        : 1
cdotnodename__check : Node01
anti-csrf-token     : ******
Targets             : {[cdotnodename__check, PrtgAPI.Targets.GenericSensorTarget[]]}
Source              : Netapp - Test mischoe
SensorType          : netappcdotio
Priority            : Three
InheritTriggers     : True
InheritInterval     : True
Interval            : 00:01:00
IntervalErrorMode   : OneWarningThenDown
DynamicType         : False
Name                : NetApp I/O
Tags                : {netapp, cdot, ontap, soap}
Cookie              : False

$device | Add-Sensor $sensor
Add-Sensor : Failed to process request for sensor type 'netappcdotio': sensor query target parameters did not include mandatory parameter 'timeout_'.
At line:1 char:11
+ $device | Add-Sensor $sensor
+           ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-Sensor], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,PrtgAPI.PowerShell.Cmdlets.AddSensor

What is the output of 'Get-PrtgClient -Diagnostic'?

PSVersion      : 5.1.17763.2931
PSEdition      : Desktop
OS             : Microsoft Windows 10 Enterprise LTSC
PrtgAPIVersion : 0.9.17
Culture        : de-CH
CLRVersion     : .NET Framework 4.8 (528049)
PrtgVersion    : 22.3.78.1873
PrtgLanguage   : english.lng

Additional context

No response

schoenm1 avatar Sep 15 '22 12:09 schoenm1

I believe normally the response returned from PRTG will contain any properties required to create the object (including any sensor query parameters you may have specified). Otherwise, you'd expect it to fail when PRTG tries to add the sensor itself

Can you try Unlock the parameters, add the missing parameter and see if it works then?

lordmilko avatar Sep 15 '22 13:09 lordmilko

Hi @lordmilko This one is working

$device | New-SensorParameters -RawType netappcdotio -qp @{defaultlogin_="1";user_="";password_="";port_="443";timeout_="60";transporttype_="1"} -Target *
$sensor.unlock()
$sensor.timeout_="60"
$device | Add-Sensor $sensor

So this is a PRTG 'issue', that the param timout is not in the return value and must be added manually again with the unlock()?

schoenm1 avatar Sep 15 '22 13:09 schoenm1

Based on a quick perusal of the PrtgAPI source code I don't see anywhere where I would be manually adding in the sensor query parameters, however I'll have to check with another sensor type to see how it normally works. In the meantime, the above is certainly a workaround you can use for now

lordmilko avatar Sep 15 '22 13:09 lordmilko

Thanks for you really fast reply! Yes, I can use this workaround. The netapp sensor are the first one I see where the question for credential are mandatory asked for in PRTG UI. I tested with netappcdotio + netappcdotaggr. For both 'timeout' is required for 'New-SensorParameters', but not set in return value.

schoenm1 avatar Sep 15 '22 13:09 schoenm1