Ok, here's a script, but...
...it may not be completely suitable...
...you may need to make some adjustments...
...and I left in an example of an alert being punted out to BMC Patrol, but it's commented out.
...anyway, the script assumes a few things...
1) That 'blat' is pre-configured and working.
2) That the system wide 'path' includes the path to the NetBackup commands.
3) That you will configure a scheduled taks to run it, perhaps once every 10 or 15 or 30 minutes or so.
4) You will need to modify the 'cluster-node1/2' check so that it matches on the name of your master server.
5) You will need to modify the email target addresses.
6) Create a folder for the script to live in: D:\NBU-SCRIPTS\pending-media
7) Save the script as 'pending-media.bat'
8) Create another plain ASCII text file in the same folder, named 'pending-media.med' (use 'notepad') and enter in to this file a list of all of the master, master/media, media servers in this NetBackup domain that have tape drives visible to them - so that the script can query each media server.
HTH
.
@echo off
setlocal enabledelayedexpansion
REM ################################################################################
REM # Script: Check for, and send email alerts, for pending media mount requests.
REM # Author: sdo
REM # Date: 20th February 2006
REM #
REM # Date WHO Description
REM # ---- --- -----------
REM # 20-FEB-2006 sdo Initial version.
REM # 20-FEB-2006 sdo Handle if media server is down.
REM # 8-JAN-2009 sdo For new master.
REM # 2-MAY-2011 sdo Raise Patrol alert.
REM ################################################################################
set z_path=%~dp0
set z_name=%~n0
set z_file_log=!z_path!!z_name!.log
set z_file_med=!z_path!!z_name!.med
set z_file_tmp=!z_path!!z_name!.tmp
call :log ""
call :log "***********************************************"
call :log "Run date: !date!"
REM ####################################################################################
REM ### Are we on the cluster node?
REM ###
if /i not "%computername%"=="cluster-node1" (
if /i not "%computername%"=="cluster-node2" (
call :log "Script cannot run on `!computername!`..."
goto :end
)
)
REM ####################################################################################
REM ### Email the reports...
REM ###
set z_mail_sto=Storage-Team@myfirm.com
set z_mail_ops=Ops-Team@myfirm.com
set z_mail_tst=my.name@my-firm.com
for /f "tokens=*" %%a in ('type "!z_file_med!"') do (
call :log "Checking: %%a"
if exist "!z_file_tmp!" del "!z_file_tmp!"
vmoprcmd -h %%a -d pr > "!z_file_tmp!"
find "PENDING REQUESTS" "!z_file_tmp!" > NUL
if !errorlevel!==0 (
find "<NONE>" "!z_file_tmp!" > NUL
if !errorlevel!==1 (
call :log "Sending email alerts re pending media request..."
blat "!z_file_tmp!" -to !z_mail_sto! -i NetBackup -s "ALERT: Pending media request."
REM blat "!z_file_tmp!" -to !z_mail_ops! -i NetBackup -s "ALERT: Pending media request."
REM blat "!z_file_tmp!" -to !z_mail_tst! -i NetBackup -s "INFO: Pending media request."
set z_bem_level=MINOR
set z_nbu_level=ERROR
set z_bem_message=NetBackup - Media mount required.
REM call :raise-alert
)
)
)
REM ####################################################################################
REM ### The end...
REM ###
:end
if exist "!z_file_tmp!" del "!z_file_tmp!"
call :log ""
call :log "Script completed okay."
echo+
exit /b
REM ####################################################################################
REM ### Display and log to a file...
REM ###
:log
(echo !time:~0,8! %~1)
(echo !time:~0,8! %~1)>>"!z_file_log!"
goto :eof
REM ####################################################################################
REM ### Send a trap to BMC Patrol...
REM ###
:raise-alert
call :log ""
call :log "Alert details..."
call :log " BEM level: !z_bem_level!"
call :log " BEM message: !z_bem_message!
call :log " NBU level: !z_nbu_level!"
call :log ""
call :log "Send alert to Patrol/BEM..."
set z_msend=D:\Program Files\ProactiveNet Agent\Agent\server\bin\msend.exe
if not exist "!z_msend!" (
call :log "Cannot find msend executable..."
) else (
set z_host=!computername!
"!z_msend!" -a MY_MSEND -r !z_bem_level! -n bem-server -m "!z_bem_message!" -b "mc_object_class=NETBACKUP;mc_object=!z_name!;mc_parameter_value=!z_deac!;mc_parameter=!z_name!;mc_host=!z_host!;team=Storage Team" -q
set z_sts=!errorlevel!
if not "!z_sts!"=="0" call :log "Failed to MSEND message to Patrol, status `!z_sts!`..."
)
call :log "Done..."
goto :eof