Others

check_veeam_backups

Description:

This is a Nagios Plugin destined to check the last status and last run of Veeam Backup & Replication job passed as an argument.

Current Version

1.0

Last Release Date

2012-11-13

Compatible With

  • Nagios 3.x
  • Nagios XI

Owner

License

GPL


Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Project Files
Project Notes
Powershell needs to be installed on the Nagios box. The plugin takes 2 arguments: - Veeam Backup & Replication job name - Number of days that have to elapse since the last job run before it's assumed to be in critical state It checks both last job status and last job run date. If the number of days that have elapsed since the last job run date is greater than the second argument the job is assumed to be in critical state. If no, last job status is checked. Based on the status then plugin returns the following exit codes: Error - 2: critical non Error / non Success - 1: warning Success - 0: ok It has been successfully tested on Veeam Backup & Replication 6.0.0.153 Usage: check_veeam_backups.ps1 [job name] [number of days]
Reviews (9) Add a Review
Rework Project
by rich568117, July 31, 2020
Great script, helped quite a bit here. I am using VBR 9, so I haven't attempted to work anything on v10 yet. I did however fork the project and create a separate script for backup copies. Both are working in my environment. Feedback is appreciated.

https://github.com/rich568117/check_veeam_backup_copy
1 of 1 found this review helpful.
Helpful? Yes 1 No 0
Veeam B&R v10
by martinh, March 31, 2020
Hi,

Here are some edits to be compatible with v10.0. Get-VBRJobSchedule and also GetScheduleOptions() returns data from an outdated location.



Replace
---
if ($status -eq "None"){
$status = (Get-VBRBackupSession -Name $job.name | sort -Descending)[1].Result
}
---

by
---
if ($status -eq "None"){
$status = (Get-VBRBackupSession -Name ($job.name.ToString()+'*') | sort -Descending)[1].Result
}
---

In v10 the BackupSession's name parameter includes the type of run (incremental / Full).



Replace
---
$last = $job.GetScheduleOptions()
$last = $last -replace '.*Latest run time: [', ''
$last = $last -replace '], Next run time: .*', ''
$last = $last.split(' ')[0]
---

by
---
$last = $job.LatestRunLocal.ToString()
$last.Split(' ')[0]
---
Helpful? Yes  No 
Super
by narfight, September 30, 2017
to be compatible with the jobs "backup copy"

Add this after "$status = $job.GetLastResult()" :
if ($status -eq "None")
{
$status = (Get-VBRBackupSession -Name $job.name | sort -Descending)[1].Result
}



(Source : https://forums.veeam.com/powershell-f26/result-value-from-backup-copy-jobs-is-always-none-t20512.html#p186505)
Helpful? Yes  No 
SnapIn
by diego.quaglio, May 31, 2017
Hi
script return me this error: Snap-in not installed...
instead "asnp VeeamPSSnapin" i use "Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue" and it works.
Thanks
Diego
Helpful? Yes  No 
After Upgrade to Veeam 9
by Twibow, May 31, 2016
If you upgrade your Veeam to V9, you have a little action to enable powershell console-in :

Reference : helpcenter.veeam.com/backup/powershell/getting_started.html

Enable Powershell :
PS C:check_nagios> Add-PSSnapin VeeamPSSnapin

Exec Powershell command :
PS C:check_nagios> Get-VBRJob -Name *Citrix* FreeBackupImpl : IsFree : False UserCryptoKey : Id : ab7b260e-699f-47dc-916c-xxxxxxxxxxx Info : Veeam.Backup.Model.CDbBackupJobInfo JobType : Backup SourceType : VDDK JobTargetType : Backup TargetType : Other TypeToString : VMware Backup Description : Created by XXXXXXXXXX at 27/11/2015 15:39. Name : Citrix_XXXXX BackupPlatform : EVmware TargetHostId : 00000000-0000-0000-0000-000000000000 TargetDir : 10.xx.xx.xxXXXXXX TargetFile : Citrix_XXXXX
Helpful? Yes  No 
Missing Bracket
by pitw, February 28, 2015
There's a missing bracket in Line 61.

This one works perfectly - also with B&R 8:

if((Get-Date $now) -gt (Get-Date $last))
Helpful? Yes  No 
Two problems fixed
by ladinek, January 31, 2015
Excellent script. During attemps to get it up and running, I encountered two problems.
1. There is a bug at line 56 - missing opening bracket.
Good:
if((Get-Date $now) -gt (Get-Date $last))
Wrong:
if(Get-Date $now) -gt (Get-Date $last))

Second, I have Windows 2012 server as my Veeam box. Locales are Czech. From some unknown reason, all functions like Get-Date return date in English format (even more confusing, when you try the same from command line, the locales _are_ taken into account). However, the GetScheduleOptions call returns date with proper locale, so after this attempt to convert it to date results in format error. Even I don“t understand exact nature of this problem, I found fix (this is for Czech format date):
The section of the code looks like this:
...
$last = $last -replace '], Next run time: .*', ''

$fmt="d. M. yyyy H:mm:ss"
$last = [datetime]::ParseExact($last,$fmt, $null)

if((Get-Date $now) -gt (Get-Date $last))
...

Hope this will somebody save some time.
Helpful? Yes  No 
Mostly works, just needs tweaks
by cmot-weasel, May 31, 2013
Mostly works out the box, cheers. I found a couple of bugs which might help someone else:

Firstly line 13 threw an error about the SnapIn already being added - fix was to comment it out:

13: #asnp VeeamPSSnapin

Secondly, the date comparison really didn't work, so I changed it from:

56: if ($now -gt $last)

to

56: if(Get-Date $now) -gt (Get-Date $last))

Which seemed to do the job quite nicely. :-)

If that inadvertently cocks up something else, then whoops - this is the first and hopefully only time I've had to deal with powershell. Give me bash any day...

Thanks
Helpful? Yes  No 
Problem with that script
by fgranat, December 31, 2012
Hi,
I tested that script on my Veaam Backup server and nothing seems to happen as you can see below :

PS C:Program FilesNSClient++scripts> cmd /c echo check_veeam_backups.ps1 "[BKUP]-SALAG" 3; exit($lastexitcode) | powershell.exe -command -
check_veeam_backups.ps1 [BKUP]-SALAG 3

The job [BKUP]-SALAG ended successfuly yesterday evening.
Do you have any explanation ?

Rgds,

Frederic
Owner's Reply:

@fragnat:

What exact version of Veeam Backup & Replication do you use? Please, try to download my latest update of the plugin.

Also, please try double quotation of job name as on an example below:

check_veeam_backups1 = cmd /c echo scriptscheck_veeam_backups.ps1 ""0 - CRITICAL - backup level"" 1; exit $LastExitCode | powershell.exe -command -


Helpful? Yes  No 
Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.3 (11)
Favorites
1
Views
85,070