Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_veeam_bkp

Rating
1 vote
Favoured:
0
Last Release Date
2018-08-27
Compatible With
  • Nagios 4.x
License
GPL
Hits
14952
Files:
FileDescription
check_veeam_bkp.ps1check_veeam_bkp.ps1
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!
This is a Nagios Plugin that checks the last status of last run of all veeam jobs, not including Replication (BackupSync) jobs (which is a continues jobs that for behaving differently).
- Powershell needs to be installed on the Nagios box.
- NSClient++ needs to be installed on the windosn Veeam server

It is based on another plugin from 'Nagios Exchange'

The plugin takes 2 arguments:
- Veeam Backup job name ('all' can be used)
- Number of days that have to elapse since the last job run before it's assumed to be in critical state

It checks the job type, in case of 'Backup' type it checks last run status and number of days since 'last run'.
- In case status is Failed it exit with CRITICAL (2).
- In case last run is greater then expected (value passed as argument) is exit with CRITICAL (2).
- No Success in job status exit with WARNING (3).
- Unknown jobs and jobs that are not of type 'Backup' exit with WARNING (3).
- Otherwise the script exit with SUCCESS (0).

It has been successfully tested on Veeam Backup & Replication 9.5.0.1922

Usage:
check_veeam_bkp.ps1 [job name all] [number of days]
This is a Nagios Plugin that checks the last status of last run of all veeam jobs, not including Replication (BackupSync) jobs (which is a continues jobs that for behaving differently).
1) Powershell needs to be installed on the Nagios box.
2) NSClient++ needs to be installed on the windows Veeam server
3) nsclient.ini file editing to enable powershell execution, add and edit this lines (be aware of this last minus [-] sign):
;The NRPE options
[/settings/NRPE/server]
allow arguments = true
port = 5666

; Undocumented key
verify mode = none

; Undocumented key
insecure = true

; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
; use ssl = true

; EXTENDED RESPONSE - Send more then 1 return packet to allow response to go beyond payload size (requires modified client if legacy is true this defaults to false).
extended response = false

; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"[]{}) characters in arguments.
allow nasty characters = false


; The relevant external script to enable
[/settings/external scripts]
allow arguments = true

; Command timeout - The maximum time in seconds that a command can execute. (if more then this execution will be aborted). NOTICE this only affects external commands not internal ones.
; timeout = 60

; Load all scripts in a given folder - Load all scripts in a given directory and use them as commands.
; script path = UNKNOWN

; Allow certain potentially dangerous characters in arguments - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"[]{}) characters in arguments.
; allow nasty characters = false

; Script root folder - Root path where all scripts are contained (You can not upload/download scripts outside this folder).
script root = ${scripts}


; A list of templates for wrapped scripts.
[/settings/external scripts/wrappings]

; POWERSHELL WRAPPING -
ps1 = cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -

; BATCH FILE WRAPPING -
bat = scripts\%SCRIPT% %ARGS%

; VISUAL BASIC WRAPPING -
vbs = cscript.exe //T:30 //NoLogo scripts\lib\wrapper.vbs %SCRIPT% %ARGS%


[/settings/external scripts/scripts]

check_veeamBck=cmd /c echo scriptsveeam_alljobstatus_check.ps1 "$ARG1$" "$ARG2$"; exit($lastexitcode) | powershell.exe -command –

4) make sure your veeam windows server is enabled to execute not digitally signed powershell scripts (uou can easily find it on the web)
5) on the nagios box edit commands.cfg file (/[nagios directory]/etc/objects/) to add the script command:
define command{
command_name check_veeam
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 40 -c check_veeamBck -a $ARG1$
}

6) on the nagios box edit windows.cfg file (/[nagios directory]/etc/objects/) to monitore your veeam server.
define host{
use windows-server
host_name veeam-bkp
alias veeam-bkp
address 1.1.1.1
contact_groups admins
hostgroups windows-servers24
}

define service{
use generic-service
host_name veeam-bkp
service_description Veeam Last Backup status
check_command check_veeam!all 1
max_check_attempts 3
normal_check_interval 180
retry_check_interval 10
}

The plugin takes 2 arguments:
- Veeam Backup job name ('all' can be used)
- Number of days that have to elapse since the last job run before it's assumed to be in critical state

It checks the job type, in case of 'Backup' type it checks last run status and number of days since 'last run'.
- In case status is Failed it exit with CRITICAL (2).
- In case last run is greater then expected (value passed as argument) is exit with CRITICAL (2).
- No Success in job status exit with WARNING (3).
- Unknown jobs and jobs that are not of type 'Backup' exit with WARNING (3).
- Otherwise the script exit with SUCCESS (0).

It has been successfully tested on Veeam Backup & Replication 9.5.0.1922

Usage:
check_veeam_bkp.ps1 [job name all] [number of days]
Reviews (1)
Hi,
when I run the script on the host, it works.

In Nagios I receive the following error:
"asnp: No Snap-In registered for Windows Powershell Version 5.
Get-VBRJob [...]
UNKNOWN! 'Backup Job 2 Nas': No such job"
My Command Line the nsclient.ini looks like this:
"check_veeam=cmd /c echo \scripts\check_veeam.ps1 "Backup Job 2 Nas"; exit $LastExitCode | powershell.exe -command -"

Can you help me?