uCosminexus Application Server, Operation, Monitoring, and Linkage Guide
You can code the commands to be executed as Management actions in the command files (batch files or shell script files). Create command files as required. Note that for batch servers, you cannot use request scheduling by CTM, and therefore, CTM- related description is not applicable.
The following are the environment variables that can be used in the command files and samples of command files:
The following table lists the environment variables that you can use in the command files:
Table 9-5 Environment variables that can be used in the command files of the management action execution commands
Environment variable | Description |
---|---|
COSMI_MNG_MACT_LSNAME | Logical server name from where the Management event is issued. |
COSMI_MNG_MACT_HOST | Host name of a logical server from where the Management event is issued. |
COSMI_MNG_MACT_MSG_ID | Message ID issued by the Management event. |
COSMI_MNG_MACT_MSG_TEXT | Message text issued by the Management event. |
COSMI_MNG_MACT_CTM | Logical CTM name specified for the logical server from where the management event is issued. |
COSMI_MNG_MACT_WEBSYSTEM | Web system name to which the logical server, from where the Management event is issued, belongs. |
COSMI_MNG_MACT_UNIT | Service unit name to which the logical server, from where the Management event is issued, belongs. |
COSMI_MNG_MACT_TIER | Physical tier type to which the logical server, from where the Management event is issued, belongs. |
COSMI_MNG_MACT_OPTN | An option string notified by the Management event. The embedded characters of the message are used as option string. N is an integer from 0 and above, and the environment variable expressing the first option string is COSMI_MNG_MACT_OPT0. For details on the set strings, see the information displayed in the variable values of the message text of messages that issue Management events. |
COSMI_MNG_MACT_MNGSVR_PORT | HTTP port number of a Management Server. |
COSMI_MNG_MACT_RNAME | Actual server name of the logical server from where the Management event is issued. |
COSMI_MNG_MACT_NS_HOSTPORT | Host name and port number of the naming service used by the logical server from where the Management event is issued. For example: HostA:900, when the host name is HostA and the port number is 900. |
Reference the provided samples of command files and create a command file. The samples are stored in the following location:
For using a sample, change the arguments of the mngsvrutil command (such as -m, -u, and -p options), and the storage destination of a log file in conformity with the environment.
The sample to restart the server from where the Management event is issued is described below:
(Omitted) ... rem Management action sample for restart server. setlocal set LSNAME=%COSMI_MNG_MACT_LSNAME% set MSGID=%COSMI_MNG_MACT_MSG_ID% set CJCLDELLOG=%COSMINEXUS_HOME%\CC\client\bin\cjcldellog.bat set LOG_ROOT_DIR=%SystemDrive%\<MyLogDir> if not exist "%LOG_ROOT_DIR%" mkdir "%LOG_ROOT_DIR%" call "%CJCLDELLOG%" -t 30d -f "%LOG_ROOT_DIR%" set LOG_DIR=%LOG_ROOT_DIR%\%date:/=% if not exist "%LOG_DIR%" mkdir "%LOG_DIR%" set LOG=%LOG_DIR%\%time::=%_%LSNAME%_%MSGID%.txt echo %0 > "%LOG%" set MNGSVR=localhost:%COSMI_MNG_MACT_MNGSVR_PORT% set UID=<User-id> set PWD=<Password> echo mngsvrutil.exe -m %MNGSVR% -u %UID% -p %PWD% -t %LSNAME% -s stop server >> "%LOG%" 2>&1 mngsvrutil.exe -m %MNGSVR% -u %UID% -p %PWD% -t %LSNAME% -s stop server >> "%LOG%" 2>&1 set RET=%ERRORLEVEL% echo %RET% >> "%LOG%" if not %RET% == 0 goto END echo mngsvrutil.exe -m %MNGSVR% -u %UID% -p %PWD% -t %LSNAME% -s start server >> "%LOG%" 2>&1 mngsvrutil.exe -m %MNGSVR% -u %UID% -p %PWD% -t %LSNAME% -s start server >> "%LOG%" 2>&1 set RET=%ERRORLEVEL% echo %RET% >> "%LOG%" :END exit %RET% |
(Omitted) ... # Management action sample for restart server. LSNAME=${COSMI_MNG_MACT_LSNAME} MSGID=${COSMI_MNG_MACT_MSG_ID} LOG_ROOT_DIR=/tmp/<MyLogDir> if [ ! -d ${LOG_ROOT_DIR} ]; then /bin/mkdir ${LOG_ROOT_DIR} fi /usr/bin/find ${LOG_ROOT_DIR}/* -depth -mtime +30 | /usr/bin/xargs /bin/rm -fr LOG_DIR=${LOG_ROOT_DIR}/`/bin/date +%y%m%d` if [ ! -d ${LOG_DIR} ]; then /bin/mkdir ${LOG_DIR} fi LOG=${LOG_DIR}/`/bin/date +%H%M%S`_${LSNAME}_${MSGID}.txt echo $0 > "${LOG}" MNGSVR=localhost:${COSMI_MNG_MACT_MNGSVR_PORT} USERID=<User-id> PASSWD=<Password> echo ./mngsvrutil -m ${MNGSVR} -u ${USERID} -p ${PASSWD} -t ${LSNAME} -s stop server >> "${LOG}" 2>&1 ./mngsvrutil -m ${MNGSVR} -u ${USERID} -p ${PASSWD} -t ${LSNAME} -s stop server >> "${LOG}" 2>&1 RET=$? echo ${RET} >> "${LOG}" if [ $RET -eq 0 ]; then echo ./mngsvrutil -m ${MNGSVR} -u ${USERID} -p ${PASSWD} -t ${LSNAME} -s start server >> "${LOG}" 2>&1 ./mngsvrutil -m ${MNGSVR} -u ${USERID} -p ${PASSWD} -t ${LSNAME} -s start server >> "${LOG}" 2>&1 RET=$? echo ${RET} >> "${LOG}" fi exit ${RET} |
Reference the sample provided for blocking the service units belonging to the server from where the management event is issued, and create a sample. The sample file name and operations are as follows:
The sample for blocking service units belonging to the server from where the Management event is issued is described below:
(Omitted) ... rem Management action sample for close unit. setlocal set LSNAME=%COSMI_MNG_MACT_LSNAME% set MSGID=%COSMI_MNG_MACT_MSG_ID% set WEBSYSTEM=%COSMI_MNG_MACT_WEBSYSTEM% set UNIT=%COSMI_MNG_MACT_UNIT% set CJCLDELLOG=%COSMINEXUS_HOME%\CC\client\bin\cjcldellog.bat set LOG_ROOT_DIR=%SystemDrive%\<MyLogDir> if not exist "%LOG_ROOT_DIR%" mkdir "%LOG_ROOT_DIR%" call "%CJCLDELLOG%" -t 30d -f "%LOG_ROOT_DIR%" set LOG_DIR=%LOG_ROOT_DIR%\%date:/=% if not exist "%LOG_DIR%" mkdir "%LOG_DIR%" set LOG=%LOG_DIR%\%time::=%_%LSNAME%_%MSGID%.txt echo %0 > "%LOG%" if "%WEBSYSTEM%" == "" goto :ERR if "%UNIT%" == "" goto :ERR set MNGSVR=localhost:%COSMI_MNG_MACT_MNGSVR_PORT% set UID=<User-id> set PWD=<Password> echo cmx_stop_target.exe -m %MNGSVR% -u %UID% -p %PWD% -mode ALL -s %WEBSYSTEM% -unit %UNIT% >> "%LOG%" 2>&1 cmx_stop_target.exe -m %MNGSVR% -u %UID% -p %PWD% -mode ALL -s %WEBSYSTEM% -unit %UNIT% >> "%LOG%" 2>&1 set RET=%ERRORLEVEL% echo %RET% >> "%LOG%" goto :END :ERR set RET=2 :END exit %RET% |
(Omitted) ... # Management action sample for close unit. LSNAME=${COSMI_MNG_MACT_LSNAME} MSGID=${COSMI_MNG_MACT_MSG_ID} WEBSYSTEM=${COSMI_MNG_MACT_WEBSYSTEM} UNIT=${COSMI_MNG_MACT_UNIT} LOG_ROOT_DIR=/tmp/<MyLogDir> if [ ! -d ${LOG_ROOT_DIR} ]; then /bin/mkdir ${LOG_ROOT_DIR} fi /usr/bin/find ${LOG_ROOT_DIR} -depth -mtime +30 -mindepth 1 -exec /bin/rm -fr {} \; LOG_DIR=${LOG_ROOT_DIR}/`/bin/date +%y%m%d` if [ ! -d ${LOG_DIR} ]; then /bin/mkdir ${LOG_DIR} fi LOG=${LOG_DIR}/`/bin/date +%H%M%S`_${LSNAME}_${MSGID}.txt echo $0 > "${LOG}" if [ "${WEBSYSTEM}" = "" -o "${UNIT}" = "" ]; then exit 2 fi MNGSVR=localhost:${COSMI_MNG_MACT_MNGSVR_PORT} USERID=<User-id> PASSWD=<Password> echo ./cmx_stop_target -m ${MNGSVR} -u ${USERID} -p ${PASSWD} -mode ALL -s ${WEBSYSTEM} -unit ${UNIT} >> "${LOG}" 2>&1 ./cmx_stop_target -m ${MNGSVR} -u ${USERID} -p ${PASSWD} -mode ALL -s ${WEBSYSTEM} -unit ${UNIT} >> "${LOG}" 2>&1 RET=$? echo ${RET} >> "${LOG}" exit ${RET} |
The following section describes the operation of management action execution commands:
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.