Closed Kipjr closed 3 years ago
Hi @Kipjr,
PRTG nor PrtgAPI currently provide a mechanism for migrating objects between servers. You'll see from the roadmap that implementing this functionality is something I'm working on (literally as I received notification of your message! :P) however there's still quite a large number of outstanding items that need to be resolved before this ships as a usable product.
If your new PRTG server doesn't actually have any config on it yet your best bet might be to simply copy the entire PRTG configuration over to the new server (simply copying PRTG Configuration.dat
is fine, but I would recommend to copy the entire C:\ProgramData\Paessler\PRTG Network Monitor
folder)
Regards, lordmilko
The issue is that I dont have access to the target core-server machine, however I'm able to perform administrative tasks using prtgAPI. Is there any workaround using prtgAPI?
Unfortunately not at this time
If you're really really desperate you can roll your own migration system using PrtgAPI's tree model
By creating a PrtgNodeWalker like so
using namespace PrtgAPI.Tree
$tree = Get-PrtgTree -Options All
class Applier : PrtgNodeWalker
{
[void]VisitGroup([GroupNode]$node)
{
# Create the group from the $node.Value if it doesn't already exist under the parent that $node.Parent.Value maps to in your lookup CSV log
foreach($child in $node.Children)
{
$this.Visit($child)
}
}
[void]VisitDevice([DeviceNode]$node)
{
# Create the device from the $node.Value if it doesn't already exist under the parent that $node.Parent.Value maps to in your lookup CSV log
Write-Host "Pretend we're creating a device here"
foreach($child in $node.Children)
{
$this.Visit($child)
}
}
[void]VisitSensor([SensorNode]$node)
{
Write-Host "Pretend we're checking this is a type of sensor we want to recreate here"
# The $node.Parent.Value won't actually exist on the new PRTG server, so you need to create a log that maps the old parents to the new parents as you create them for future child nodes
$parameters = $node.Parent.Value | New-SensorParameters -rt $node.Value.Type.StringValue
$parameters.Unlock()
$properties = $node.Properties.Children.Value
foreach($prop in $properties)
{
$parameters.($prop.Name) = $prop.Value
}
Write-Host "Pretend we're creating a sensor here"
}
}
$applier = [Applier]::new()
$applier.Visit($tree)
you can augment this to add each node using Add-Group
/ Add-Device
/ Add-Sensor
if the node hasn't been added already.
In order to run this script you'll want to first have imported PrtgAPI in your PowerShell session (otherwise PowerShell will complain that the types referenced within aren't loaded). While we don't know what parameters are truly required to recreate the sensor, we are assuming that the raw properties found on the sensor should be everything we need. PrtgAPI will provide the tree traversal framework for you, but at this time the rest will be all up to you
What are you trying to do, and to what extent does PrtgAPI provide existing functionality around this?
Connect-PrtgServer -Server $sourcePRTG -Credential $credSource
$source = get-probe |where {$_.name -like "name of the source probe"} | get-prtgtree -options all
Disconnect-PrtgServer
Connect-PrtgServer -Server $targetPRTG -Credential $credTarget
$source
object and create groups, devices and then we are stuck.SensorFactoryDefinition
orSensorParameters
.Is this something that has some sort of parallel in the PRTG UI? If so where do you go/how do you normally do it?
Due Dilligance Please enter an 'x' between the brackets to indicate you have done these