Preparing a script file
Before creating the configuration report, you will need to write a series of commands in a script file. When you run the Report Configuration Tool, the commands in the script files execute sequentially and then create or delete a configuration report. See Report Configuration Tool command reference (raidinf commands) for a list of commands.
Two examples of scripts are shown below. Refer to these examples as needed to create a script file that suits your needs.
Example script for creating a configuration report
This script logs the user in, deletes a configuration report, creates a configuration report, and logs the user out, using the Report Configuration Tool.
For each command except the logout command, this example performs three retries at intervals of 2 minutes, assuming that communication errors and other errors can occur. In addition, the delete report command is executed with the -fill option before the add report command, so that the script does not terminate when 20 configuration reports accumulate in the service processor.
REM
REM Create Report Script(CreateReport.bat)
REM
SET USER=<Username for Storage Navigator>
SET PASS=<Password for Storage Navigator>
SET SERVER=<Hostname or IP address of service processor>
SET REPORT_NAME=DailyConfigurationReport
SET LOOP=2
REM LOOP:0-2 3Times
SET TIMEOUT=121
REM TIMEOUT 2[minutes]120[s]+ 1[s]
SET RAIDINF_PATH="C:\Program Files\raidinf"
SET /a CNT_LOGIN=0
:LOGIN_RETRY
REM ############################# LOGIN %CNT_LOGIN%
SET /a CNT_LOGIN=%CNT_LOGIN% + 1
%RAIDINF_PATH%\raidinf -login %USER% %PASS% -servername %SERVER%
if ERRORLEVEL 1 (
if %CNT_LOGIN% GTR %LOOP% GOTO :ABEND
CALL :SLEEP
GOTO LOGIN_RETRY
)
SET /a CNT_DEL=0
:DEL_RETRY
REM ############################# DELETE %CNT_DEL%
SET /a CNT_DEL=%CNT_DEL% + 1
%RAIDINF_PATH%\raidinf delete report -servername %SERVER% ^
-report %REPORT_NAME% -fill
if ERRORLEVEL 1 (
IF %CNT_DEL% GTR %LOOP% GOTO :ABEND
CALL :SLEEP
GOTO :DEL_RETRY
)
SET /a CNT_ADD=0
:ADD_RETRY
REM ############################# ADD %CNT_ADD%
SET /a CNT_ADD=%CNT_ADD% + 1
%RAIDINF_PATH%\raidinf add report -servername %SERVER% -report ^
%REPORT_NAME%
if ERRORLEVEL 1 (
IF %CNT_ADD% GTR %LOOP% GOTO :ABEND
CALL :SLEEP
GOTO ADD_RETRY
)
GOTO :END
EXIT /B
:SLEEP
REM
REM ############################# SLEEP with %TIMEOUT% sec
REM
ping 127.0.0.1 -n %TIMEOUT% > NUL
EXIT /B
:ABEND
REM ############################# ABEND
ECHO "Create Report Script was ABEND"
:END
REM ############################# Logout
%RAIDINF_PATH%\raidinf -logout -servername %SERVER%
Example script for downloading a configuration report
This script logs the user in, downloads a configuration report, and logs the user out, using the Report Configuration Tool.
For each commandexcept the logout command, this example performs 3 retries at intervals of 2 minutes, assuming that communication errors and other errors can occur. The downloaded configuration report is accumulated for 3 generations in the C:\Reports folder by names from Report_DailyConfigurationReport_1.tgz to Report_DailyConfigurationReport_3.tgz. In addition, if the script for creating a configuration report fails, generation copy is terminated so that the past configuration reports may not be overwritten.
REM
REM Download Report Script(DownloadReport.bat)
REM
SET USER=<Username for Storage Navigator>
SET PASS=<Password for Storage Navigator>
SET SERVER=<Hostname or IP Address of service processor>
SET REPORT_NAME=DailyConfigurationReport
SET LOOP=2
REM LOOP:0-2 3Times
SET TIMEOUT=121
REM TIMEOUT 2[minutes]=120[s]+1[s]
SET TARGETFOLDER=C:\Reports\tmp
SET REPORTFOLDER=C:\Reports
SET RAIDINF_PATH="C:\Program Files\raidinf"
REM
REM Create Report Folder
REM
IF NOT EXIST %REPORTFOLDER% (
MKDIR %REPORTFOLDER%
IF NOT EXIST %TARGETFOLDER% (
MKDIR %TARGETFOLDER%
)
)
SET /a CNT_LOGIN=0
:LOGIN_RETRY
REM ####################################### Login %CNT_LOGIN%
SET /a CNT_LOGIN=%CNT_LOGIN% + 1
%RAIDINF_PATH%\raidinf -login %USER% %PASS% -servername %SERVER%
if ERRORLEVEL 1 (
IF %CNT_LOGIN% GTR %LOOP% GOTO :ABEND
CALL :SLEEP
GOTO LOGIN_RETRY
)
SET /a CNT_DL=0
:DL_RETRY
REM ####################################### Download %CNT_DL%
SET /a CNT_DL=%CNT_DL% + 1
%RAIDINF_PATH%\raidinf download report -servername %SERVER% ^
-report %REPORT_NAME% -targetfolder %TARGETFOLDER%
if ERRORLEVEL 1 (
IF %CNT_DL% GTR %LOOP% GOTO :ABEND
CALL :SLEEP
GOTO :DL_RETRY
)
REM ####################################### Create Error Check
IF EXIST %REPORTFOLDER%\Report_%REPORT_NAME%_1.tgz (
IF EXIST %TARGETFOLDER%\Report_%REPORT_NAME%.tgz (
GOTO :FC_CHECK
) else (
GOTO :CHECK_END
)
) else (
GOTO :CHECK_END
)
:FC_CHECK
FC /B %REPORTFOLDER%\Report_%REPORT_NAME%_1.tgz ^
%TARGETFOLDER%\Report_%REPORT_NAME%.tgz > NUL
if ERRORLEVEL 1 (
REM
) else (
DEL %TARGETFOLDER%\Report_%REPORT_NAME%.tgz
GOTO :END
)
:CHECK_END
REM ####################################### Migrate Reports
IF EXIST %TARGETFOLDER%\Report_%REPORT_NAME%.tgz (
IF EXIST %REPORTFOLDER%\Report_%REPORT_NAME%_2.tgz (
COPY %REPORTFOLDER%\Report_%REPORT_NAME%_2.tgz ^
%REPORTFOLDER%\Report_%REPORT_NAME%_3.tgz
)
IF EXIST %REPORTFOLDER%\Report_%REPORT_NAME%_1.tgz (
COPY %REPORTFOLDER%\Report_%REPORT_NAME%_1.tgz ^
%REPORTFOLDER%\Report_%REPORT_NAME%_2.tgz
)
IF EXIST %TARGETFOLDER%\Report_%REPORT_NAME%.tgz (
COPY %TARGETFOLDER%\Report_%REPORT_NAME%.tgz ^
%REPORTFOLDER%\Report_%REPORT_NAME%_1.tgz
DEL %TARGETFOLDER%\Report_%REPORT_NAME%.tgz
)
)
GOTO :END
EXIT /B
:SLEEP
REM ####################################### SLEEP with %TIMEOUT%
ping 127.0.0.1 -n %TIMEOUT% > NUL
EXIT /B
:ABEND
REM ####################################### ABEND
ECHO "Download Report Script was ABEND"
:END
REM ####################################### Logout
%RAIDINF_PATH%\raidinf -logout -servername %SERVER%