Backup Exec 2012

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Backup Exec 2012

Post by slansing »

Is this plugin reading a log file or some text file that lists the backup times? Is the powershell script looking for an old file that may have been rotated?


"nrpe_checkbu_2012 EW"

Is that how the command definition is named in /usr/local/nagios/etc/commands.cfg?
tribbink
Posts: 32
Joined: Tue Mar 06, 2012 8:53 am

Re: Backup Exec 2012

Post by tribbink »

The plugin 'check_backup_exec_backups.ps1' executes a powershell routine that reads a backup exec log file.
I runned for over a year, after updating NagiosXI the pluging went wrong on all servers executing this plugin.

in NSC the is the syntax:

Code: Select all

[NRPE Handlers]
;# COMMAND DEFINITIONS
check_bu2012ew=cmd /c echo scripts\check_backupexec_backups.ps1 "B2D Even Week-B2D Even Week" "7" | powershell.exe -command -


Executing "echo scripts\check_backupexec_backups.ps1 "B2D Even Week-B2D Even Week" "7" | powershell.exe -command -" directly in the powershell on the server 
results in the answer "OK! Backup process of job 'B2D Even Week-B2D Even Week' completed successfully" but nagios reads the result otherwise.
Content of 'check_backup_exec_backups.ps1'

Code: Select all

#################################################################################
#################################################################################
####################  Made by Tytus Kurek on September 2012  ####################
#################################################################################
#################################################################################
###  This is a Nagios Plugin destined to check the last status and last run   ###
###        of Symantec Backup Exec 2012 job passed as an argument.            ###
#################################################################################
#################################################################################

# Adding required SnapIn

Import-Module BEMCLI

# Global variables

$name = $args[0]
$period = $args[1]

# Symantec Backup Exec 2012 job status check

$job = Get-BEJob -Name $name

if ($job -eq $null)
{
	$name = "'" + $name + "'"
	Write-Host "UNKNOWN! No such a job: $name."
	exit 3
}

$status = Get-BEJobHistory -Name $name -FromLastJobRun | Select JobStatus
$status = $status -replace '@{JobStatus=', ''
$status = $status -replace '}', ''
	
if ($status -eq "Error")
{
	$name = "'" + $name + "'"
	Write-Host "CRITICAL! Errors were encountered during the backup process of the following job: $name."
	exit 2
}

if ($status -ne "Succeeded")
{
	$name = "'" + $name + "'"
	Write-Host "WARNING! Job $name didn't fully succeed."
	exit 1
}

# Symantec Backup Exec 2012 job last run check

$now = (Get-Date).AddDays(-$period)
$now = $now.ToString("dd-MM-yyyy")
$last = Get-BEJobHistory -Name $name -FromLastJobRun | Select StartTime
$last = $last -replace '@{StartTime=', ''
$last = $last -replace '}', ''
$last = $last.split(' ')[0]
$name = "'" + $name + "'"

if ($now -gt $last)
{
	Write-Host "CRITICAL! Last run of job: $name more than $period days ago."
	exit 2
} 
else
{
	Write-Host "OK! Backup process of job $name completed successfully."
	exit 0
}
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Backup Exec 2012

Post by sreinhardt »

Well it certainly seems the script is still working as expected, which is good! But its erroring thinking that they date is off or the length of time is longer than what you have specified. Let's look at it this way, when is the last time the nagios check ran, and when is the last time the BE B2D task ran successfully? Unfortunately we don't have BE in house, so it makes it a bit tough to test it internally, but reading through the code, most things look just fine.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
tribbink
Posts: 32
Joined: Tue Mar 06, 2012 8:53 am

Re: Backup Exec 2012

Post by tribbink »

Problem seems to be solved.
I returned the timeschedule settings for check and alerting back to 24x7
On these checks i defined my own timeschedule, which i edited while in use.
I presume that NagiosXi does not like editing data thats in use.
Now i get the correct values back.

Thanks
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Backup Exec 2012

Post by sreinhardt »

requested to be unlocked as issue has returned.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
tribbink
Posts: 32
Joined: Tue Mar 06, 2012 8:53 am

Re: Backup Exec 2012

Post by tribbink »

Same issue returns after a few days, directly testing the check command in services settings gives also wrong value

checked up when directly putting the syntax in powershell, powershell says all is ok.
Nagios says again 7 days ago.

it seems nagios nrpe is mismatching in time. does updating NRPE help?

Ton
tribbink
Posts: 32
Joined: Tue Mar 06, 2012 8:53 am

Re: Backup Exec 2012

Post by tribbink »

Updated NRPE to 2.15 problem stays,

need help!

Ton
tribbink
Posts: 32
Joined: Tue Mar 06, 2012 8:53 am

Re: Backup Exec 2012

Post by tribbink »

Still no solution. I use NSClient++ version 0.3.9
Can that be the problem, all Windows Server have been updated since.
tribbink
Posts: 32
Joined: Tue Mar 06, 2012 8:53 am

Re: Backup Exec 2012

Post by tribbink »

On the server with nsclient 0.3.9 i did a nsclient/test and injected the nrpe-command to it. It gives the correct output.

I did give the correct answer: Backup succesfully Succeeded

retested the command from Nagios, still gives backup more then 7 day ago.

Date on server and Nagios are correct.
:?: :?: :?:
Any help?
Last edited by tribbink on Mon Oct 28, 2013 2:30 pm, edited 1 time in total.
tribbink
Posts: 32
Joined: Tue Mar 06, 2012 8:53 am

Re: Backup Exec 2012

Post by tribbink »

When putting nsclient 0.3.9 in test with nsclient /test and then starting from nagios command line /usr/local/libexec/check_nrpe -c check_bu2012ew -H 192.xx.xx.xx the correct answer is send back.
when putting nsclient in normal start mode "nsclient /start" and starting the same command from the nagios command line i get an incorrect answer from the server.


WEIRD :?: :?:
Locked