Closed LKus95 closed 4 years ago
Hi @LKus95,
In order to figure out what is going on here I think we should reduce this code to a minimal example that reproduces the issue.
For example, does the following create the device on every probe
Get-Probe -Id 1 | Add-Device dc-1
while the following creates the device on only a single probe?
Get-Probe "Local Probe" | Add-Device dc-2
If you can potentially figure out what code exactly is required, without Read-Host
user inputs, loops, if-statements and CSVs, this will allow us to cut straight to the heart of the issue
Regards, lordmilko
Good morning lordmilko,
thanks for the quick reply. I tested it with your examples and both create a single device under my first probe (master).
PS C:\WINDOWS\system32> Get-Probe -Id 1 | Add-Device dc-1
Name Id Status Host Sensors Group Probe
---- -- ------ ---- ------- ----- -----
dc-1 6167 Up dc-1 0 Netmon24_TestLK Netmon24_TestLK
PS C:\WINDOWS\system32> Get-Probe "Netmon24_TestLK" | Add-Device dc-2
Name Id Status Host Sensors Group Probe
---- -- ------ ---- ------- ----- -----
dc-2 6169 Up dc-2 0 Netmon24_TestLK Netmon24_TestLK
Regards, Lukas
EDIT: In the Meantime i've split my Script in one creating Groups and one creating Devices, which both produce the same Results from above; Tested with ID and Name.
Hi @LKus95,
If you specify the -Verbose
parameter to any PrtgAPI cmdlet you can see the exact API requests that are executed for any given command. For more information on this please see the wiki
Regardless of whether you retrieve probes by ID or name, the resultant probe's ID is what is actually used to specify what the parent of the newly created device should be.
Based on the results above I would say the behavior you were initially seeing with devices being created across all of your probes is due to a bug in your script. If you can successfully reduce your script to a minimal example that still exhibits issue we can revisit this; otherwise for now I would say this issue is resolved
Please let me know if you have any further issues
Regards, lordmilko
Describe the bug Clearly and concisely describe what you were trying to do, what happened and what you were expecting to happen I'm trying to add Groups and Devices to a PRTG Cluster (1 Master, 1 Slave, 3 RP's) which was newly created. From the old PRTG Server i've exported my relevant Data like Group Name, Device Name, Device Host and Probe. Now when i'm running my Script with the Probe Name as input for creating Groups and Devices it gets correctly created under that Probe, but when i want to use the Probe ID (1) as input, it creates the Groups and Devices under every Probe of the Cluster.
It basically works like i want it to, as it creates the Groups and Devices from my .csv-Files, but i'm just wondering why it behaves differently with the Probe ID and the Probe Name. The Powershell output with ID and Name seem to be exactly the same.
Steps to reproduce Put the relevant code from your application that caused the issue to happen in the code block below
What is the output of
Get-PrtgClient -Diagnostic
?Additional context Anything else I should know to help solve the issue? I attached the .csv files i'm using with some information redacted, but i hope you get the general layout.
PRTG_Export_Devices_example.zip PRTG_Export_Groups_example.zip