PrtgAPI: Response status code does not indicate success: 556

Describe the bug

Hello,

Using PrtgAPI module v0.9.17, I am trying to add devices and sensors. No issues when adding device but only with add-sensors throwing this error. This error is not consistent even on the same device when added multiple times. Though most of times script is throwing this error sometimes it is working just fine.

Error: Failed CMD Line: $getDevice | Add-Sensor $sensorparams Error message: Response status code does not indicate success: 556 (Unknown Response Code).

Steps to reproduce

$PRTGGroupID = <PRTGGroupID> 
$deviceName = <deviceName> 
$ServerIP = <ServerIP> 
Connect-PrtgServer $prtgURL (New-Credential $prtgUserName $prtgPass) 
$addDevice = Get-Group -id $PRTGGroupID | Add-Device -Name $deviceName -Host $ServerIP 
$addDeviceId = $addDevice.Id 
$getDevice = Get-Device -Id $addDeviceId 
  
$SatSensor = "snmpcpu" 
  
$sensorparams = $getDevice | New-SensorParameters -RawType $SatSensor 
$cpusensor = $getDevice | Add-Sensor $sensorparams 
$cpuchannel = Get-Channel -Sensor $cpusensor 
$cputotal = $cpuchannel | Where {$_.Name -eq "Total"} 
Set-ChannelProperty -Channel $cputotal -Property UpperErrorLimit -Value 90 
Set-ChannelProperty -Channel $cputotal -Property UpperWarningLimit -Value 75

What is the output of ‘Get-PrtgClient -Diagnostic’?

PSVersion      : 5.1.14393.4583
PSEdition      : Desktop
OS             : Microsoft Windows Server 2016 Standard
PrtgAPIVersion : 0.9.17
Culture        : en-US
CLRVersion     : .NET Framework 4.7.2 (461814)
PrtgVersion    : 22.1.74.1869
PrtgLanguage   : english.lng

Additional context

Above sample code has only snmpcpu sensor in it but we are also encountering same with ping and other SNMP sensors. Please let me know if I can provide any further information. Thanks for the help!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 28 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Hi all,

Please be advised I have been able to reproduce this issue and have released a new pre-release build of PrtgAPI which should hopefully include a fix for this issue

Can you please follow the manual installation instructions and advise whether the issue is now resolved? If you’ve successfully followed the manual installation instructions, Get-PrtgClient -Diagnostic should show 0.9.18-preview.4

Hi @lordmilko, This issue has been resolved after we have upgraded our PRTG version. But it is only working with 0.9.18-preview.4 version. Thanks for your help,

@Silex

In regards to your question, if you have a sensor then the best way to get the device is to do Get-Device -Id $sensor.ParentId