Closed eren-kemer closed 6 years ago
Hello,
output in CMD an PS looks fine for me. So PRTG should process that. Have you checked the PRTG sensor Log? The default parameter of the Script normally work fine. So you don’t need to use the -p switch only for BRhost or set the default in the ps1 file.
If you want to use all parameters you should try it this way: -f="PRTG-VeeamBRStats.ps1" -p="-repoCritical 80 -repoWarn 70 -reportmode Weekly"
Kind regards, Markus
Hello, thanks for the reply!
the default parameter for BRHost in the script has already been modified by me. This is not appropiate for my use case though, as we don't always have the same name for our B&R Servers.
I'd also like to be able to set the warn, critical and reportmode parameters per sensor, like i tried to.
i have set my parameter string in the sensor config to this:
-f="PRTG-VeeamBRStats.ps1" -p="-repoCritical 80 -repoWarn 70 -reportmode Weekly"
Still getting the same XML structural error.
What i have noticed is.. in your powershell script, you mention that reportmode is a string and should be in quotation marks. What is the definitive answer on this?
.EXAMPLE
PRTG-VeeamBRStats.ps1 -BRHost veeam01.lan.local -reportmode "Monthly" -repoCritical 80 -repoWarn 70 -Debug
To me it seems like the script does not take my parameters. When i change the default host in the script to the right host, it works:
[string] $BRHost = "backup01",
C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML>PSx64.exe -f= PRTG-VeeamBRStats.ps1" 0:Starting to Process Connection to backup01 ... Connecting BRHost...
When i keep it to
[string] $BRHost = "blabla01",
and try giving it the BRHost as parameter, it doesn't work:
C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML>PSx64.exe -f="PRTG-VeeamBRStats.ps1" -p="BRHost backup01"
0: Failed to connect to Veeam Backup & Replication server
C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML>
What am i doing wrong here? How can i check whether i'm doing something wrong?
Have you tried the connection via Veeam Console from this server?
Hello @eren-kemer,
Is the problem solved?
Please give me a few days to check with latest commits included.
I have now found the issue with the way i did it. I have to supply the parameters to Psx64.exe like this: -f="PRTG-VeeamBRStats2.ps1" -p="localhost",""Monthly"", "80", "70" This way, i get correct output, even with parameters in the sensor.
You might want to add that to the documentation so people know how to supply parameters. If i do it like i expected to do(as in the docs) the script would try to literally connect to "-BRHost localhost"
So issue is therefore solved. Considering docs get updated.
One question though, how would i go with giving it the Debug switch as well?
Correction:
required syntax is as follows:
-f="PRTG-VeeamBRStats2.ps1" -p="localhost" ""Monthly"" "5" "8"
At least this works for me now.
Please also add to the docs, as the syntax wasn't clear to me, looking at the screenshots on the blog.
Hello,
to me it seems like the powershell script is not picking up my parameters. This is how i set it up in PRTG. Is it the correct way to give PSx64.exe the parameters?
-f="PRTG-VeeamBRStats.ps1" -p="-repoCritical 80 -repoWarn 70 -reportmode "Weekly"
As soon as i put in the -p= part, i get this error:
XML: Structural error in xml file, 1 open items. -- JSON: Das zurückgelieferte JSON entspricht nicht der erwarteten Struktur (Invalid JSON.). (Code: PE231)
I also ran the script on the probe manually. This is the output when running the ps1 script in powershell. I have X'ed the private parts.:
This is what i get when i try to run the script using PSx64.exe:
I'll be glad to provide further logs as required.