You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently struggling to find the right way to accomplish a bulk creation of devices and a ssl certificate sensor.
In generel I've used the script provided here #13 and modified it to my needs. It works pretty fine when it is executed without the sensor creation.
My csv file is pretty simple:
Name, Domain
domain.company.com, company.com
and my script looks like this:
if(!(Get-PrtgClient))
{
Connect-PrtgServer prtg.company.com
}
# Import the CSV
$csv = Import-Csv "C:\Users\user\a-records.csv"
# Group each record by its Domain
$domains = $csv | group Domain
# Get this state's PRTG Probe
$probe = Get-Probe "prtg-probe"
function ProcessDomains($probe, $domains) {
foreach($domain in $domains)
{
Write-Host " Processing Domain $($domain.Name)"
# Get this domain's PRTG Group
$domainGroup = $probe | Get-Group $domain.Name
if(!$domainGroup)
{
# If no such group exists, create one
$domainGroup = $probe | Add-Group $domain.Name
}
ProcessArecords $domain $domainGroup
}
}
function ProcessArecords($domain, $domainGroup) {
foreach($arecord in $domain.Group)
{
# Get this office's server
$device = $domaingroup | Get-Device $arecord.Name
if(!$device)
{
Write-Host " Adding device $($arecord.Name)"
# Add the device using a Host of <hostname>.<domain>
$device = $domainGroup | Add-Device $arecord.Name "$($arecord.Name).$env:userdnsdomain".ToLower()
}
}
}
ProcessDomains $probe $domains
so basically this script works well.
Let's assume I want to add the HTTP sensor I adjusted the command for the device creation to include the New-Sensor after a pipe:
# Add the device using a Host of <hostname>.<domain> including HTTP sensor
$device = $domainGroup | Add-Device $arecord.Name "$($arecord.Name)" | New-Sensor -http
This works also fine. Great.
Now There's the point where I'm struggeling. The sslcertificate sensor type.
I digged into the wiki but It seems I'm not able to find the right syntax to create the sslcertificate sensor on all newly created devices.
I appreciate any suggestion that helps me to solve this.
What's going on?
Hello,
I'm currently struggling to find the right way to accomplish a bulk creation of devices and a ssl certificate sensor.
In generel I've used the script provided here #13 and modified it to my needs. It works pretty fine when it is executed without the sensor creation.
My csv file is pretty simple:
and my script looks like this:
so basically this script works well.
Let's assume I want to add the HTTP sensor I adjusted the command for the device creation to include the New-Sensor after a pipe:
This works also fine. Great.
Now There's the point where I'm struggeling. The sslcertificate sensor type.
I digged into the wiki but It seems I'm not able to find the right syntax to create the sslcertificate sensor on all newly created devices.
I appreciate any suggestion that helps me to solve this.
Due Dilligance
The text was updated successfully, but these errors were encountered: