Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RetryCount does not seem to work #290

Open
2 tasks done
xasz opened this issue Jul 5, 2022 · 2 comments
Open
2 tasks done

RetryCount does not seem to work #290

xasz opened this issue Jul 5, 2022 · 2 comments
Labels
question Questions raised by people who don't know how to program or read the wiki :P

Comments

@xasz
Copy link

xasz commented Jul 5, 2022

What's going on?

Hello,

we have a quite large PRTG Installation and sometimes it takes a long time that the prtg api does it thing ;)
No i tried to set RetryCount and RetryDelay higher but it does not seem to work:

I set RetryCount and RetryDelay to 20:
Connect-PrtgServer "https://$($PRTGServer):$($PRTGPort)" (New-Credential $PRTGUser $PRTGPassHash) -PassHash -RetryCount 20 -RetryDelay 20
And now i expected that i see something like Retries remaining 20 instead of 4 ?
image
Am i just doing it wrong?

thank you, best regards
xasz

Due Dilligance

  • It wasn't covered by the wiki, I swear!
  • I have tried doing some basic research on this issue but haven't been able to come up with anything. Please help!
@xasz xasz added the question Questions raised by people who don't know how to program or read the wiki :P label Jul 5, 2022
@lordmilko
Copy link
Owner

I'm unable to reproduce this issue. Are you able to confirm what version of PrtgAPI you're running?

Has the above screenshot been manipulated, or is it the output of a script? (as opposed to raw commands being typed in a PowerShell prompt)

Can you also please provide the output of Get-PrtgClient -Diagnostic

@xasz
Copy link
Author

xasz commented Jul 5, 2022

The screenshot is not manipulated in any form. It was just a half output of the get-prtgclient.

Sure, here we go with some additional informations:

Get-PrtgClient -Diagnostic

PSVersion      : 5.1.17763.2803
PSEdition      : Desktop
OS             : Microsoft Windows Server 2019 Standard
PrtgAPIVersion : 0.9.17
Culture        : de-DE
CLRVersion     : .NET Framework 4.7.2 (461814)
PrtgVersion    : 22.2.76.1705
PrtgLanguage   : german.lng

The "call" of the actual Add-Sensor/Add-Device Sensor is quite complex and i just can't copy paste it in three lines.

This is my Setup:

Script: Update-PRTGDevices.ps1

Import-Module prtghelper.psm1 -force # This is a custom helper module for us internal to share some methods between scripts
Connect-PrtgServer "https://$($PRTGServer):$($PRTGPort)" (New-Credential $PRTGUser $PRTGPassHash) -PassHash -RetryCount 50 -RetryDelay 50
# Gather some devices from the crm
foreach($erpdevice in $erpdevices){
   $myDevice = Set-PRTGDevice -Parent $someParentGroup -ERPDevice $erpdevice
  # now we add / replace some sensors with the "same" method as on the the device.
}

Custom Module: prtghelper.psm1

function Set-PRTGDevice{
   param($Parent, $ERPDevice)
       $device = $Parent | Get-Device -Name $DeviceName 
# Sometimes this just return nothing even if there is a correct device
    if(($device | Measure-Object).Count -gt 0){
        if(($device | Measure-Object).Count -gt 1){
            throw "$DeviceName in $($Parent.Name) not unique"
        }
        $device | Set-ObjectProperty Host $Hostname
    }else{
        $device = $Parent | Add-Device $DeviceName $($Hostname)  
         # THIS will "fail" and take aged on adding multiple devices. and i return a wrong result
    }
    return $device
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions raised by people who don't know how to program or read the wiki :P
Projects
None yet
Development

No branches or pull requests

2 participants