We use a script to check if Altaro Backup Works:

For this example we set the variables fix with paramters of the servers

# Altaro Backup Monitoring
#-------------------
# Description: Modified script by Robert
# Original script: (c) 2014 Stephan Linke | Paessler AG
# Parameters:
# -VM: VM Name
# -BackupType: local or offsite
# -MaxAge: Maximum age of the log entry to be considered checking (in hours)
# -LimitEntries:  Maximum number of entries to check
# -Loglevel: The numerical level of the log file
# -ProviderName: Provider of the Log file
# -EventId: The ID of the Event
# ------------------

param(  
#    [string]$VM,
#    [string]$BackupType,
#    [string]$Machine,
    [string]$VM = "GeRN-RadiNETPro",
    [string]$BackupType = "physical",
    [string]$Machine = "GeRN-RadiNETPro",
    [int]$MaxAge        = 24,
    [int]$LimitEntries    = 10,
    [string]$LogName    = "Application",
    [string]$ProviderName      = "Altaro Physical Server Backup"
)

if ($BackupType -eq 'local') { $EventID = 5000 }
elseif ($BackupType -eq 'offsite'){ $EventID    = 5005 }
elseif ($BackupType -eq 'physical'){ $EventID    = 5100 }
else { Write-Host "0:Specified BackupType not local or offsite or physical, quitting"; exit 2; }

try { $Events = (Get-WinEvent -ComputerName $Machine -FilterHashTable @{ProviderName=$ProviderName;LogName=$LogName;ID=$EventID;StartTime=(get-date).AddHours(-$MaxAge)} -MaxEvents $LimitEntries) }
catch [Exception]
{
    Write-Host "0:Can't find anything for $ProviderName in your $LogName eventlog. Please check Log name, Provider, Log ID, EventID, ComputerName and Credentials"
    exit 2;
}

foreach ($i in $Events)
{
    if ($Events.Message -match 'Backup result: Successful') 
        { 
            Write-Host "0:$($BackupType) Backup $VM completed in last $MaxAge hours successfull"; 
            # Write-Host $Events.Message; 
            Exit 0; 
        }
}

Write-Host "2:$($BackupType) Backup $VM failed in last $MaxAge hours"; Exit 2;

Result in Powershell on PRTG-Server:

PS C:\Windows\system32> C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\Altaro-monitor_physical.ps1
0:physical Backup GeRN-RadiNETPro completed in last 24 hours successfull

Result in PRTG:

Systemfehler: Can't find anything for Altaro Physical Server Backup in your Application eventlog. Please check Log name, Provider, Log ID, EventID, ComputerName and Credentials (Code: PE022)

Configuration in PRTG:

Programm/Skript: Altaro-monitor_physical.ps1
Parameter: -VM 'GeRN-RadiNETPro' -BackupType 'physical' -Machine 'GeRN-RadiNETPro'

Why does the Powershellscript on the server works and why does not from PRTG?


Article Comments

Hi RADSERV IT,

Thanks for the post, can you use write-output instead of write host?

Also please enable the option "Store Result" in your Sensor settings. This will create additional log files in the "Logs > Sensors" folder in the PRTG Data Directory of the corresponding Probe(https://helpdesk.paessler.com/en/support/solutions/articles/7600006351163) For example in my server: C:\ProgramData\Paessler\PRTG Network Monitor\Logs\sensors. This should give you a clue at what's happening, if you still need help afterwards please reach out at support@paessler.com


Jul, 2023 - Permalink