Benutzer-Werkzeuge

Webseiten-Werkzeuge


prtg

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
prtg [2024/07/26 16:33]
admin [PrtgAPI]
prtg [2024/07/27 22:46] (aktuell)
jango
Zeile 8: Zeile 8:
 </code> </code>
  
 +Verbindung mit Anmeldeinformationen aufbauen
 <code powershell> <code powershell>
 # Verbindung mit Anmeldeinformationen # Verbindung mit Anmeldeinformationen
Zeile 16: Zeile 17:
 </code> </code>
  
 +Verbindung mit Passhash aufbauen
 <code powershell> <code powershell>
 # Verbindung mit PassHash herstellen # Verbindung mit PassHash herstellen
Zeile 25: Zeile 27:
 </code> </code>
  
 +Verbindung trennen
 <code powershell> <code powershell>
 # Verbindung trennen # Verbindung trennen
Zeile 30: Zeile 33:
 </code> </code>
  
 +<code powershell>
 +Get-Probe
 +
 +Get-Device | where-object { $_.Name -like "vie-t-*" }
 +
 +Get-Sensor | where-object { $_.Name -like "Commvault Backup Status*" }
 +Get-Sensor -Id 22243 | Get-ObjectProperty -Raw
 +Get-Sensor -Id 22243 | Set-ObjectProperty -interval (60*60*6)
 +Get-SensorHistory -Sensor (Get-Sensor -Id 22243)
 +</code>
 +
 +Sensoren suchen
 <code powershell> <code powershell>
 # Sensoren suchen # Sensoren suchen
Zeile 35: Zeile 50:
 </code> </code>
  
 +Deviced suchen
 <code powershell> <code powershell>
 # Devices suchen # Devices suchen
Zeile 40: Zeile 56:
 </code> </code>
  
 +Custom Sensor erstellen
 <code powershell> <code powershell>
-# Sensor erstellen+Custom Sensor erstellen
 $raw = @{ $raw = @{
     name_ = "my test sensor"     name_ = "my test sensor"
Zeile 64: Zeile 81:
 </code> </code>
  
 +Schedule zu Device hinzufügen
 +<code powershell>
 +# Custom method
 +function Set-PRTGSchedule {
 +    [CmdletBinding(SupportsShouldProcess)]
 +    param (
 +        [Parameter(Mandatory,ValueFromPipeline)][prtgapi.deviceorgrouporprobe]$Object,
 +        [Parameter(Mandatory)][prtgapi.schedule]$Schedule
 +    )
 +
 +    begin {
 +        if (-not (Get-PrtgClient)) {Connect-PrtgServer}
 +    }
 +
 +    process {
 +        if (-not $Object.id) {
 +            write-error "Could not find valid ID on schedule object $schedule"
 +            continue
 +        }
 +
 +        [string]$scheduleValue = ($Schedule.id,$schedule.name -join '|') + '|'
 +        if ($PSCmdlet.ShouldProcess($Object.name,"Set Schedule to $($Schedule.name)")) {
 +            Set-ObjectProperty -Force -Object $Object -RawParameters @{
 +                scheduledependency = 0
 +                schedule_ = $scheduleValue
 +            }
 +        }
 +    }
 +}
 +
 +$schedule = Get-PRTGSchedule "Sonntags*" | select -first 1
 +Get-Device "vie-p-srv-fdb01*" | Set-PRTGSchedule -Schedule $schedule
 +</code>
 +
 +Schedule zu Sensor hinzufügen
 +<code powershell>
 +Get-Sensor -Id 22243 | Set-ObjectProperty -RawParameters @{
 +    "scheduledependency" = 0
 +    "schedule_" = Get-PrtgSchedule "Sonntag*" | select -first 1
 +} -Force
 +</code>
 +
 +Schedule zu Probe hinzufügen
 +<code powershell>
 +Get-Probe -Id 17834 | Set-ObjectProperty -RawParameters @{
 +    "scheduledependency" = 0
 +    "schedule_" = Get-PrtgSchedule "Sonntag*"
 +} -Force
 +</code>
 =====Custom Sensor===== =====Custom Sensor=====
  
Zeile 69: Zeile 135:
  
 XML und JSON Beispiel mit Powershell XML und JSON Beispiel mit Powershell
-<code>+<code powershell>
 $ProcessCount = (Get-Process).Count $ProcessCount = (Get-Process).Count
 $UserCount = (query user | Measure-Object).Count - 1 $UserCount = (query user | Measure-Object).Count - 1
prtg.1722004427.txt.gz · Zuletzt geändert: 2024/07/26 16:33 von admin