What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Program/Skript-Sensor Error PE022

Votes:

0

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?

pe022 program prtg script

Created on Jun 29, 2023 6:38:36 AM

Last change on Jun 29, 2023 2:38:58 PM by  Felix Wiesneth [Paessler Support]



1 Reply

Votes:

0

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://kb.paessler.com/en/topic/463) 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 [email protected]

Created on Jul 1, 2023 12:44:48 AM by  Oscar Chavarria [Paessler Technical Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.