diff --git a/PRTG/Custom Sensors/EXEXML/Get-AcronisJobResults.ps1 b/PRTG/Custom Sensors/EXEXML/Get-AcronisJobResults.ps1
index ddeb9dc..041f592 100644
--- a/PRTG/Custom Sensors/EXEXML/Get-AcronisJobResults.ps1
+++ b/PRTG/Custom Sensors/EXEXML/Get-AcronisJobResults.ps1
@@ -3,10 +3,8 @@
PRTG Acronis Backup Statusreport
.DESCRIPTION
- Dieses Script wertet den Status der Windows Server Sicherung aus
- und versendet auf Basis der Daten eine Mail im HTML-Format über den
- Status der letzten Sicherung. Zusätzlich werden Informationen über das
- Sicherungsmedium und den freien Speicher übermittelt.
+ Dieses Script wertet den Status der Acronis Sicherung aus
+ und übergibt den Status der eingerichteten Jobs an PRTG.
.PARAMETER Server
The IP or DNS of the Server running Acronis. You can use the %host parameter of PRTG.
@@ -59,41 +57,60 @@ function Build-XML($Job, $LastResult)
write-host "0"
- write-host "ps.acronis.jobState"
+ write-host "ps.veeam.jobState"
write-host ""
}
-function Test-XMLFile
-{
- [CmdletBinding()]
+# Test the validity of an XML file
+function Test-XMLFile {
+ [CmdletBinding()]
param (
[parameter(mandatory=$true)][ValidateNotNullorEmpty()][string]$xmlFilePath
)
- if(!(Test-Path -Path $xmlFilePath))
+ # Check the file exists
+ if (!(Test-Path -Path $xmlFilePath))
{
- throw "$xmlFilePath is not valid. Please provide a valid path to the .xml file"
+ throw "$xmlFilePath is not valid. Please provide a valid path to the .xml fileh"
}
+ # Check for Load or Parse errors when loading the XML file
$xml = New-Object System.Xml.XmlDocument
- try
- {
+ try {
$xml.Load((Get-ChildItem -Path $xmlFilePath).FullName)
return $true
}
- catch [System.Xml.XmlException]
- {
- Write-Verbose "$xmlFilePath : $($_.toString())"
- return $false
+ catch [System.Xml.XmlException] {
+ Write-Verbose "$xmlFilePath : $($_.toString())"
+ return $false
}
}
+& 'C:\Program Files\Acronis\CommandLineTool\acrocmd.exe' list plans --host=$Server --credentials=$User,$Password --log=c:\tmp\AcronisBackupStatus.xml >$null | write-host
+
+$Data = New-Object xml
+$Data.psbase.PreserveWhitespace = $false
+
+while ((Test-XMLFile "c:\tmp\AcronisBackupStatus.xml") -eq $false ) {
+ $null = Invoke-Expression -Command:$command
+}
+
+$Data.Load("c:\tmp\AcronisBackupStatus.xml")
write-host ""
-Build-XML Server1 ok
-Build-XML Server2 Error
+ForEach( $Plan in $Data.list_plans.output_data.list.plan ) {
+ # check ist backup plan enabled
+ if($Plan.enabled.Replace("`r`n",""))
+ {
+ $Plan.Name = $Plan.Name.Replace("`r`n","")
+ $Plan.Name = $Plan.Name.Replace(" ","")
+ $Plan.Status = $Plan.Status.Replace("`r`n","")
+ $Plan.Status = $Plan.Status.Replace(" ","")
+ $Plan.Status = $Plan.Status.ToLower()
+ Build-XML $Plan.Name $Plan.Status.ToString()
+ }
+}
write-host ""
-