vMarkusK / Advanced-PRTG-Sensors

Collection of my Advanced PRTG Sensors
https://mycloudrevolution.com/
Apache License 2.0
69 stars 29 forks source link

Exception thrown when Cloud Repository not connected #18

Closed eren-kemer closed 7 years ago

eren-kemer commented 7 years ago

When cloud repository is added to VBR Console but not connected(see image), the powershell script shows an exception, just before PRTG output.

image

image

Doesn't affect prtg output directly, but i assume this should be an error in PRTG.


Ausnahme beim Aufrufen von "SyncSpaceInfoToDb" mit 2 Argument(en):  "Failed to establish connect to the service provider"
In C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\PRTG-VeeamBRStats2.ps1:78 Zeichen:6
+                     [Veeam.Backup.Core.CBackupRepositoryEx]::SyncSpaceInfoToDb($r, $true)
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : Exception
eren-kemer commented 7 years ago

Don't know how(didn't find any way to) but perhasp you could check if the repository is connected. Otherwise, maybe catch the exception and turn the sensor red?

vMarkusK commented 7 years ago

I think the problem is not cloud Repo specific. All unailable Repositories should be effected (Server disconnected for example ).

Have you tried a simple Try / Catch around '[Veeam.Backup.Core.CBackupRepositoryEx]::SyncSpaceInfoToDb($r, $true)'?

I will try to create a test scenario inside my Lab for that Situationen.

eren-kemer commented 7 years ago

I'm not too familiar with powershell. Just tried to fiddle around to find the issue here. I can test for you though, if needed.

vMarkusK commented 7 years ago

Might you please check this Version: https://github.com/mycloudrevolution/Advanced-PRTG-Sensors/pull/21

in Debug Mode you should see the message: "SyncSpaceInfoToDb Failed" but no error should occure.

eren-kemer commented 7 years ago

Works as expected.