21. 04. 2023 Alessandro Romboli Business Service Monitoring, NetEye, Unified Monitoring

Monitoring Veritas Backup Exec

Scenario

Veritas Backup Exec is widely used for the backup of physical machines through local installed agents both on Windows and Linux hosts. It also supports application backup for Microsoft Exchange, SharePoint and several different Database engines, with the option of a granular application data restore.

The product additionally supports virtual backup through Hyper-V and vSphere, but it’s less often used than Veeam backup on these infrastructures.

It’s very important to keep backup status monitored – and wouldn’t it be nice to get backup status through the Icinga2 agent in an easy way?

PowerShell scripting

Fortunately, Veritas has provided us with a powerful PowerShell interface and a huge set of commands which can be used to control jobs and to get the actual status: the PowerShell suite is named BEMCLI and it’s installed by default along with the Backup Exec server installation.

Here’s the command reference:

https://www.veritas.com/content/support/en_US/article.100046001

Our main goal is to write a script which will get the overall backup job status, possibly without specifying a particular job name.

First of all, there’s the command Get-BEJob which returns information about all existing Backup Exec jobs. In our monitoring script we must limit the query to the Scheduled or Superseded jobs (jobs which didn’t run due to lack of resources), so we can pass a filter to the command:

Get-BEJob -Status Scheduled,Superseded

The result will be the list of the scheduled jobs with all their related details.

For example, each job object will be something like:

Name                  : SQL-FullDaily
JobType               : Backup
TaskType              : Full
TaskName              : FullDaily
IsActive              : False
Status                : Scheduled
SubStatus             : Ok
SelectionSummary      : Microsoft SQL Server Instances
Storage               : DataDomain2
Schedule              : Monday, Tuesday, Wednesday, Thursday, Friday, Saturday every 1 week(s) at 23:00 effective on 1/10/2023.
IsBackupDefinitionJob : True

Veritas keeps the history of all jobs which run at least once, so we can limit the analysis of the job status to the last record in its history.

The PowerShell command would be:

Get-BEJobHistory -Name $job.Name -FromLastJobRun

The object returned has the attribute JobStatus which can be: Succeeded, Warning, or Error.

Here’s an example of a job status record:

Name                 : SQL-FullDaily
BackupExecServerName : BEServer
AgentServer          : {SQL}
JobType              : Backup
JobStatus            : Succeeded
ErrorCode            : 0x0
ErrorMessage         :
ErrorCategoryType    :
StartTime            : 4/1/2023 11:00:03 PM
EndTime              : 4/2/2023 12:03:35 AM
ElapsedTime          : 01:03:32
PercentComplete      : 100
StorageName          : DataDomain2
TotalDataSizeBytes   : 100203013386
JobRateMBPerMinute   : 4504

In the case of a Superseded job, the notice is set instead in the job Status attribute.

It’s important to trap this condition because a job could have been executed successfully during the last run, but it might’ve hung and was then superseded due to lack of resources.

Using a variable $globalstatus to store the worst-case status of the backup jobs (0 success, 1 warning, 2 failure) and a variable $globaljobs to store the list of the job names not completed successfully, a PowerShell check routine could look like this:

# Adding required SnapIn

Import-Module BEMCLI

# Global variables
[int]$globalstatus = 0
[string]$globaljobs = ""
#$ErrorActionPreference = 'SilentlyContinue'

# Veritas job status check

$jobs = Get-BEJob -Status Scheduled,Superseded

foreach ($job in $jobs)
{
	$lastjob = Get-BEJobHistory -Name $job.Name -FromLastJobRun
	if ($lastjob)
	{
		$status = $lastjob.JobStatus
		if ($status -eq "Error")
		{
			$globalstatus = 2
			$globaljobs += $job.Name
			$globaljobs += " "
			continue
		}
		if (($status -ne "Succeeded") -or ($job.Status -eq "Superseded"))
		{
			if (-not ($globalstatus)) { $globalstatus = 1 }
			$globaljobs += $job.Name
			$globaljobs += " "
		}
	}
}
if($globalstatus -eq 2)
{
	Write-Host "CRITICAL! At least one backup job in error: $globaljobs"
} 
else
{
	if($globalstatus)
	{
		Write-Host "WARNING! At least one backup job in warning: $globaljobs"
	}
	else
	{
		Write-Host "OK! All backup jobs completed successfully."
	}
}

exit ($globalstatus)

This check routine can be called directly by the Icinga2 agent as an external script.

These Solutions are Engineered by Humans

Did you like this article? Does it reflect your skills? We often get interesting questions straight from our customers who need customized solutions. In fact, we’re currently hiring for roles just like this and others here at Würth Phoenix.

Alessandro Romboli

Alessandro Romboli

Site Reliability Engineer at Würth Phoenix
My name is Alessandro and I joined Würth-Phoenix early in 2013. I have over 20 years of experience in the IT sector: For a long time I've worked for a big Italian bank in a very complex environment, managing the software provisioning for all the branch offices. Then I've worked as a system administrator for an international IT provider supporting several big companies in their infrastructures, providing high availability solutions and disaster recovery implementations. I've joined the VMware virtual infrastructure in early stage, since version 2: it was one of the first productive Server Farms in Italy. I always like to study and compare different technologies: I work with Linux, MAC OSX, Windows and VMWare. Since I joined Würth Phoenix, I could also expand my experience on Firewalls, Storage Area Networks, Local Area Networks, designing and implementing complete solutions for our customers. Primarily, I'm a system administrator and solution designer, certified as VMware VCP6 DCV, Microsoft MCP for Windows Server, Hyper-V and System Center Virtual Machine Manager, SQL Server, SharePoint. Besides computers, I also like photography, sport and trekking in the mountains.

Author

Alessandro Romboli

My name is Alessandro and I joined Würth-Phoenix early in 2013. I have over 20 years of experience in the IT sector: For a long time I've worked for a big Italian bank in a very complex environment, managing the software provisioning for all the branch offices. Then I've worked as a system administrator for an international IT provider supporting several big companies in their infrastructures, providing high availability solutions and disaster recovery implementations. I've joined the VMware virtual infrastructure in early stage, since version 2: it was one of the first productive Server Farms in Italy. I always like to study and compare different technologies: I work with Linux, MAC OSX, Windows and VMWare. Since I joined Würth Phoenix, I could also expand my experience on Firewalls, Storage Area Networks, Local Area Networks, designing and implementing complete solutions for our customers. Primarily, I'm a system administrator and solution designer, certified as VMware VCP6 DCV, Microsoft MCP for Windows Server, Hyper-V and System Center Virtual Machine Manager, SQL Server, SharePoint. Besides computers, I also like photography, sport and trekking in the mountains.

Leave a Reply

Your email address will not be published. Required fields are marked *

Archive