vMarkusK / Advanced-PRTG-Sensors

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

Problem using remote probe #106

Open enea1111 opened 1 year ago

enea1111 commented 1 year ago

Hallo! I am using a Remote Probe from Prtg to access Veeam installed on the remote network. Veeam is not installed on the same server where the Remote Probe is installed. Prtg's sensor is set up like this: EXE/Script: PSx64.exe Parameters -f="PRTG-VeeamBRStats.ps1" -p="192.168.1.21"

Prtg returns the following error: \Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\PRTG-VeeamBRStats.ps1 : The term 'Disconnect-VBRServer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + &'C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\PRTG ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Disconnect-VBRServer:String) [PRTG-VeeamBRStats.ps1], CommandNotFoundEx ception + FullyQualifiedErrorId : CommandNotFoundException,PRTG-VeeamBRStats.ps1 No Veeam Modules found, Fallback to SnapIn.

I have found a similar issue, but I can't solve. I do not understand what I am doing wrong...

enea1111 commented 1 year ago

Others info, may be it can help:

PS C:\Users\Administrator> Get-PSSnapin -Registered | fl *
PS C:\Users\Administrator> Add-PSSnapin VeeamPSSnapin
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.
At line:1 char:1
+ Add-PSSnapin VeeamPSSnapin
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (VeeamPSSnapin:String) [Add-PSSnapin], PSArgumentException
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
enea1111 commented 1 year ago

Last test, if can help more:

PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE> .\PRTG-VeeamBRStats-v3.ps1 -BRHost 192.168.1.21 -debug

No Veeam Modules found, Fallback to SnapIn.
C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\PRTG-VeeamBRStats-v3.ps1 : The term
'Disconnect-VBRServer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ .\PRTG-VeeamBRStats-v3.ps1 -BRHost 1192.168.1.21 -debug
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Disconnect-VBRServer:String) [PRTG-VeeamBRStats-v3.ps1], CommandNotFoun
   dException
    + FullyQualifiedErrorId : CommandNotFoundException,PRTG-VeeamBRStats-v3.ps1
vMarkusK commented 1 year ago

You need at least install the Veeam Console on the probe device that executes the script.

Otherwise use the httppush feature from the VBR server to the probe.

enea1111 commented 1 year ago

Thanks for you reply! On the probe is already installed another Veeam Console (Community Edition).

vMarkusK commented 1 year ago

Does the console connection to 192.168.1.21 work?

enea1111 commented 1 year ago

Yes, consolle can ping it.

Il Mer 29 Nov 2023, 17:26 Markus Kraus @.***> ha scritto:

Does the console connection to 192.168.1.21 work?

— Reply to this email directly, view it on GitHub https://github.com/vMarkusK/Advanced-PRTG-Sensors/issues/106#issuecomment-1832272183, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEKUCI7GH5TMHV7G3FL6UELYG5O3TAVCNFSM6AAAAAA77GETAKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZSGI3TEMJYGM . You are receiving this because you authored the thread.Message ID: @.***>

enea1111 commented 1 year ago

The console of the probe can also connect to the target Veeam Backup Server.

Really I don't understand what I'm doing wrong...

enea1111 commented 1 year ago

I have different result if I use Powershell launched from Veeam Console:

immagine

This:

PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE> .\PRTG-VeeamBRStats-v3.ps1 -BRHost 192.168.1.21 -debug

DEBUG: Starting to Process Connection to '192.168.1.21' with user 'prtg' ...

DEBUG: Connecting BRHost '192.168.1.21' with user 'prtg'...

C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\PRTG-VeeamBRStats-v3.ps1 : Failed to connect to Veeam
BR Host '192.168.1.21' with user 'prtg'
At line:1 char:1
+ .\PRTG-VeeamBRStats-v3.ps1 -BRHost 192.168.1.21 -debug
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,PRTG-VeeamBRStats-v3.ps1

[really confused] It's possible tu use different user to connect?

enea1111 commented 1 year ago

UPDATE. I added user "prtg" to remote Veeam server: now debug run!!!!!!!!

RESULT!!

.\PRTG-VeeamBRStats-v3.ps1 -BRHost 192.168.1.21
<prtg><result>
                <channel>Successful-Backups</channel>
                <value>0</value>
                <showChart>1</showChart>
                <showTable>1</showTable>
                </result><result>
                <channel>Warning-Backups</channel>
                <value>2</value>
                <showChart>1</showChart>
               etc....

Now Prtg has an different error:

\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\PRTG-VeeamBRStats-v3.ps1 : Failed to connect to Veeam BR Host '192.168.1.21' with user 'DESKTOP-LUS909N$' At line:1 char:1 + &'C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\PRTG ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,PRTG-VeeamBRStats-v3.ps1

"DESKTOP-LUS909N$" is NOT the user, but the computer name of the probe. May be can I use a specific user from PRTG Probe to connect to Veeam server?

enea1111 commented 1 year ago

If it can help... I tested following configurazion on a new sensor without PSx64.exe:

immagine

and with this return this error:

immagine

enea1111 commented 1 year ago

Last test with XML Custom EXE/Script Sensor Advanced:

immagine

retun a format error:

immagine

BUT return of script (attached) is like suggest on: https://www.paessler.com/manuals/prtg/custom_sensors#exe_script

OK, no more ideas... I feel frustrated

ATTACH: script-out.zip

vMarkusK commented 1 year ago

Just reconfigure the PRTG PROBE service to run as a service account with at least read permissions in VBR.

enea1111 commented 1 year ago

Thanks @vMarkusK .

Unfortunately, the situation is unchanged. I have no more error on user, but error on "not well-formed" output or XML output as per previous messages. :(

enea1111 commented 11 months ago

When the script is launched locally it produces the correct XML output, no errors. To work with PRTG, I now save the output to an XML file using a scheduler which is then passed to the Prtg sensor and it works.

Strange... I'll opent a ticket in Paessler.

vMarkusK commented 11 months ago

You can do a few more diagnostic steps:

  1. Run Script in Debug mode and Share the Results PRTG-VeeamBRStats-v3.ps1 -Debug
  2. Start a PowerShell Session as the PRTG Probe User (Context of the Probe Service) and run the Script
  3. Enable logging for the Sensor and share the Output (Result Handling)

Store result: Store the last sensor result in the \Logs\sensors subfolder of the PRTG data directory on the probe system. The file names are Result of Sensor [ID].txt and Result of Sensor [ID].Data.txt. This setting is for debugging purposes. PRTG overwrites these files with each scanning interval.