>Care to share your scripts?

Most of the scripts are rather site specific, but here
are some relevant parts (In this script, I let the passive
check deduce the failure, others I send a CRITICAL update,
just test for $LastExitCode -ne "0"):


$NTBackupDest = 'C:\Temp\Remote_SystemState.bkf'
$NTBackupList = 'C:\Scripts\Backup\rsyncd\SystemState.bks'
$NTBackupParam = 'backup' + ' ' + '"@' + $NTBackupList + '"' +
                 ' /n "DC - SystemState" /d "DC - SytemState" /v:yes /r:no 
/rs:no /hc:off /m normal /j "DC - SystemState" /l:f /f ' +
                 '"' + $NTBackupDest + '"'

$NagiosSrv = '10.0.0.21'
$TrapGenDef = 'Daily Backup - System State'

Write-Host "*** Informing Nagios a backup has begun ***" -foregroundcolor 
Yellow -backgroundcolor Black
$TrapParam = '-d' + ' ' + $NagiosSrv + ':162' + ' ' + '-c public -g 5 -s 23 -v 
1.3.6.1.4.1.1824.1.0.0.1 STRING' + ' ' +
             '"' + $TrapGenDef + '"' + ' ' + '-v 1.3.6.1.4.1.1824.1.0.0.2 
STRING WARNING -v 1.3.6.1.4.1.1824.1.0.0.3 STRING' +
                     ' ' + '"' + "Running Backup - $(Get-Date)" + '"'
cmd /c "TrapGen.exe $TrapParam"

cmd /c "ntbackup.exe $NTBackupParam"
If ($LASTEXITCODE -ne "0") { Write-Host "NTBackup Failed, LastExitCode: 
$LastExitCode"  -foregroundcolor Red -backgroundcolor Black; Exit $LASTEXITCODE 
}


My trap parsing script is a super hacked up version of this script:
http://www.frank4dd.com/howto/nagios/windows-reboot-monitoring-nagios.htm


Hth,
jlc

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to