vMarkusK / Advanced-PRTG-Sensors

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

PRTG - Veeam Script #14

Closed HujinoKun closed 7 years ago

HujinoKun commented 7 years ago

Hi,

Your script doesn't work on my PRTG (Windows Server 2016) linked with my Veeam Backup & Replication 9.5.

Veeam port : 9392 (Port used by the Veeam Backup & Replication console to connect to the backup server).

If i put 9392 port, my script given nothing.

But if i put your port i get some error.

Any idea ?

Best regards,

PS : Script name : https://gist.github.com/mycloudrevolution/713b2e4aa767257f84cc#file-prtg-veeam-sessionstats-ps1

vMarkusK commented 7 years ago

Hello,

Veeam Console Connection works on that Server? Have tried the manual execution of the Script, or only in PRTG?

If you have tried the manual execution, what is the Error?

Best Regards, Markus

HujinoKun commented 7 years ago

From memory there is. Currently I launch it manually, as I announced using the port in your script I have error messages but if I use 9392 nothing displayed.

vMarkusK commented 7 years ago

Have you modifed any ports during Veeam B&R Setup? If so you need to modify also the Port in Console Login Window.

Might you please post the error message from PS Console here?

HujinoKun commented 7 years ago

Hello !

With your port i got this :

Invoke-WebRequest : Impossible de se connecter au serveur distant
Au caractère C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\PRTG-VEEAM-SessionStats.ps1:11 : 12
+ $AuthXML = Invoke-WebRequest @Auth
+            ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation : (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExcepti 
   on
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Indexation impossible dans un tableau Null.
Au caractère C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\PRTG-VEEAM-SessionStats.ps1:14 : 1
+ $Sessions = @{uri = "http://X.X.X.X:9399/api/reports/summary/job_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation : (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Invoke-RestMethod : Impossible de valider l'argument sur le paramètre «Uri». L’argument est Null ou vide. Indiquez un 
argument qui n’est pas Null ou vide et réessayez.
Au caractère C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\PRTG-VEEAM-SessionStats.ps1:20 : 39
+ [xml]$SessionsXML = invoke-restmethod @Sessions
+                                       ~~~~~~~~~
    + CategoryInfo          : InvalidData : (:) [Invoke-RestMethod], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Indexation impossible dans un tableau Null.
Au caractère C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\PRTG-VEEAM-SessionStats.ps1:27 : 1
+ $VMs = @{uri = "http://X.X.X.X:9399/api/reports/summary/vms_overv ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation : (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Invoke-RestMethod : Impossible de valider l'argument sur le paramètre «Uri». L’argument est Null ou vide. Indiquez un 
argument qui n’est pas Null ou vide et réessayez.
Au caractère C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\PRTG-VEEAM-SessionStats.ps1:33 : 34
+ [xml]$VMsXML = invoke-restmethod @VMs
+                                  ~~~~
    + CategoryInfo          : InvalidData : (:) [Invoke-RestMethod], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

With 9392 port nothing is happening :

PS C:\Users\Administrateur.WIN-OAANMH1TN57> C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\PRTG-VEEAM-SessionStats.ps1

We didn't change any ports during Veeam B&R setup.

EDIT : With my user for the script, i've access to console by launching it (rights : read only)

vMarkusK commented 7 years ago

Can you access the Veeam Enterprise Manager by Internet Explorer from this Server? Sorry, at first iI thought you are talking about the native Veeam PowerShell Script...

HujinoKun commented 7 years ago

i've just Veeam B&R

vMarkusK commented 7 years ago

This Script only works with veeam ent. Manager. Try this one: https://github.com/mycloudrevolution/Advanced-PRTG-Sensors/blob/master/Veeam/PRTG-VeeamBRStats.ps1

But you need to Install veeam Console on your prtg Server first.

HujinoKun commented 7 years ago

I'll try.

But i prefer your script with manager, my chief will install Veeam ent. Manager

Thank's for your helping

EDIT :

if (!(Get-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue)) {
    if (!(Add-PSSnapin -PassThru VeeamPSSnapIn)) {
        # Error out if loading fails
        Write-Error "`nERROR: Cannot load the VEEAM Snapin."
        Exit
}

doesn't work because my PRTG Server don't have VEEAM.

vMarkusK commented 7 years ago

Thats why i mentioned that you need to install Veeam Console on PRTG Server to use the other Script...

Do you think the issue Can be closed?

HujinoKun commented 7 years ago

Not yet

In case for the users of Windows Server 2016 ;) like that I could give you the new manners.

vMarkusK commented 7 years ago

OK, then might you please be more exact with your Problem description:

HujinoKun commented 7 years ago

At the moment i try this script :

https://gist.github.com/mycloudrevolution/713b2e4aa767257f84cc#file-prtg-veeam-sessionstats-ps1

I using Windows Server 2016 (PS version : 5.1.14393.1480) for my PRTG Server and using Windows Server 2008 R2 for Veeam (PS version : 2.0).

Veeam Version : 9.5

vMarkusK commented 7 years ago

This Script does not require the Veeam PowerShell Module. But you need a Veeam Enterprise Manager and Veeam Ent. Plus License to gather the Stats. I have not verified the Script with Windows 2016 Server and PS Version 5.1.

BTW: This Script is not Part of this Repository...

HujinoKun commented 7 years ago

https://gist.github.com/mycloudrevolution/713b2e4aa767257f84cc#file-prtg-veeam-sessionstats-ps1

working with 9399 port (http) i didn't have error and the script executed successfully.

EDIT :

9080 : working for the WEBUI but doesn't work in the script

9399 : Does not give any results

EDIT 2 :

https://helpcenter.veeam.com/docs/backup/rest/em_web_api_reference.html?ver=95

HujinoKun commented 7 years ago

up ^^

vMarkusK commented 7 years ago

If no Data or Error is returned the possible problem is that no veeam Backup server is configured in ent. Manager. Have you checked that?

HujinoKun commented 7 years ago

2017-08-03 17_48_17-veeam backup enterprise manager

vMarkusK commented 7 years ago

Sorry, then I am not able to do more remote Diag. I have verified the Script a few days ago with the latest version and it has worked fine...

HujinoKun commented 7 years ago

Script working now i have some results.

But in my PRTG Server i have nothing about my GB Size, protected VM, sucessfull

Any idea ?

EDIT :

2017-08-04 13_57_33-job test _ details sur le capteur _ prtg network monitor 2017-08-04 13_58_12-mremoteng - confcons xml - veeam

EDIT 2 :

Adding the parameter -UseBasicParsing after Invoke-WebRequest @Auth = working

Now i'll configurate my probe :D