Skip to content

Instantly share code, notes, and snippets.

@theinventor
Created December 1, 2017 16:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theinventor/0c42b8f2d2c33989634f1b299d311f64 to your computer and use it in GitHub Desktop.
Save theinventor/0c42b8f2d2c33989634f1b299d311f64 to your computer and use it in GitHub Desktop.
Import-Module $env:SyncroModule
# this depends on bemcli being installed!
#Setting default CLI
import-module bemcli
#Getting Alerts
$Alerts = Get-BEAlert
#Looping through the alerts and setting them.
foreach($Alert in $Alerts){
write-host "Alert: $Alert.Message"
switch ($Alert.Category)
{JobWarning{$JobWarning = "TRUE - $($Alert.Message)" }
JobFailure{$JobFailure = "TRUE - $($Alert.Message)"}
JobCancellation{$JobCancellation = "TRUE - $($Alert.Message)" }
CatalogError{$CatalogError = "TRUE - $($Alert.Message)"}
SoftwareUpdateWarning{$SoftwareUpdateWarning = "TRUE - $($Alert.Message)"}
SoftwareUpdateError{$SoftwareUpdateError = "TRUE - $($Alert.Message)" }
DatabaseMaintenanceFailure{$DatabaseMaintenanceFailure = "TRUE - $($Alert.Message)"}
IdrCopyFailed{$IdrCopyFailed = "TRUE - $($Alert.Message)"}
BackupJobContainsNoData{$BackupJobContainsNoData = "TRUE - $($Alert.Message)" }
JobCompletedWithExceptions{$JobCompletedWithExceptions = "TRUE - $($Alert.Message)"}
JobStart{$JobStart = "TRUE - $($Alert.Message)"}
ServiceStart{$ServiceStart = "TRUE - $($Alert.Message)"}
ServiceStop{$ServiceStop = "TRUE - $($Alert.Message)"}
DeviceError{$DeviceError = "TRUE - $($Alert.Message)"}
DeviceWarning{$DeviceWarning = "TRUE - $($Alert.Message)"}
DeviceIntervention{$DeviceIntervention = "TRUE - $($Alert.Message)"}
MediaError{$MediaError = "TRUE - $($Alert.Message)"}
MediaWarning{$MediaWarning = "TRUE - $($Alert.Message)" }
MediaIntervention{$MediaIntervention = "TRUE - $($Alert.Message)"}
MediaInsert{$MediaInsert = "TRUE - $($Alert.Message)"}
MediaOverwrite{$MediaOverwrite = "TRUE - $($Alert.Message)"}
MediaRemove{$MediaRemove = "TRUE - $($Alert.Message)"}
LibraryInsert{$LibraryInsert = "TRUE - $($Alert.Message)"}
TapeAlertWarning{$TapeAlertWarning = "TRUE - $($Alert.Message)"}
TapeAlertError{$TapeAlertError = "TRUE - $($Alert.Message)" }
IdrFullBackupSuccessWarning{$IdrFullBackupSuccessWarning = "TRUE - $($Alert.Message)"}
LicenseAndMaintenanceWarning{$LicenseAndMaintenanceWarning = "TRUE - $($Alert.Message)"}
default{$OtherErr = "TRUE - $($Alert.Message)" }
}
}
if($JobFailure){
Rmm-Alert -Category "backup_exec_job_failure" -Body "BackupExec says a job failed $JobFailure"
} elsif ($JobCancellation){
Rmm-Alert -Category "backup_exec_job_cancellation" -Body "BackupExec says a job was cancelled $JobCancellation"
} elsif ($DatabaseMaintenanceFailure) {
Rmm-Alert -Category "backup_exec_maintenance" -Body "BackupExec says DB Maintenance had issue $DatabaseMaintenanceFailure"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment