| Hi,
I have included all of the information I obtained around getting the script
alarm to work in batch mode but the important key to this was specifying
a /NOPRINT qualifier on the submit command. That is what made all the
difference between it working and not working.
Thanks,
Walt McGaw
Digital Network Services Unit
CSC/CS
PROBLEM:
The customer was having problems getting an alarm rule that was testing a
script condition to work in batch mode. The alarm would work fine from the
Iconic map or FCL but when he enabled it via a batch procedure, it would
give the message no information returned from script.
SOLUTION:
The following information is the Script .MS and .COM files along with an
alarm rule command procedure and batch rule enable procedure. Also
included, is instructions on how to load the .MS file and create the script
that the alarm rule tests against and the command to use for submitting the
alarm rule enable command to batch. The important key here is to use the
/NOPRINT qualifier on the submit command string.
Instructions:
The script included here is considered a "moderately integrated" script.
This means that the following management specification file must be loaded
into the DECmcc dictionary to support returned datatypes other then the
Latin1String type. To load the included .MS file into the dictionary, use
the following commands. More information on this can be found in the
Polycenter Framework and Applications Script Access Module Use guide
chapter 2.
$ MANAGE/TOOLKIT/SPEC MCC_SCRIPT_LOOPBACK_SRVC_IF.MS
$ MANAGE/TOOLKIT/DICTIONARY
DECmcc Dictionary Administrator Program Version Vn.n
DAP> LOAD FROM MCC_SCRIPT_LOOPBACK_SRVC_IF.COM
.
.
Time delay during rebuild
.
.
DAP> EXIT
NOTE:
The following MCC_SCRIPT_LOOPBACK_SRVC_IF.MS file should be placed in the
directory pointed to by the MCC_SCRIPTS: logical.
**** BEGIN MCC_SCRIPT_LOOPBACK_SRVC_IF.MS
(************************************************************************
* *
* mcc_script_loopback_srvc_if.ms *
* *
************************************************************************
* ******************************************************************** *
* * * *
* * ************************************************************ * *
* * * * * *
* * * This management specification allow for reading of * * *
* * * the loopback response and returns the state of the node * * *
* * * * * *
* * * * * *
* * ************************************************************ * *
* * * *
* ******************************************************************** *
************************************************************************)
(************************************************************************
* *
* FACILITY: *
* *
* DECmcc Script Access Module *
* *
* ABSTRACT: *
* *
* This is a MSL file, used when adding Moderately Intergrated *
* Scripts into the DECmcc Script AM. *
* *
* This MS file works with the Script AM Script, LOOPBACK, *
* and returns state of a specific node. *
* *
* Attributes synthesized from this MSL specification: *
* *
* o STATE *
* *
* AUTHOR: *
* *
* <removed> *
* *
* EDIT HISTORY: *
* *
* 01-JUL-93 v1.0-001 Created *
* 21-JUL-93 v1.0-002 Edited
************************************************************************)
MANAGEMENT SPECIFICATION loopback; (* <<< Edit >>> *)
VERSION = V1.0.0;
SYMBOL-PREFIX = MCC_;
CHILD ENTITY loopback = 800 : (* <<< Edit >>> *)
PARENT = ( SCRIPT ),
IDENTIFIER = ( Node Name ),
DYNAMIC = TRUE,
IDENTIFIER ATTRIBUTES
ATTRIBUTE Node Name = 200 : SimpleName
ACCESS = NONSETABLE,
DISPLAY = TRUE,
CATEGORIES = ( CONFIGURATION )
END ATTRIBUTE Node Name;
END ATTRIBUTES; (* IDENTIFIER *)
(************************************************************************
* *
* Status Attributes <<< Edit >>> *
* *
************************************************************************
* *
* These are the Status Attributes supported by your Script Entity. *
* *
* o The 'Command Executed' attribute must NOT be changed. *
* o The remaining attributes may be changed as needed. *
* *
* The Script AM extracts output data (written to the Standard Output *
* file by your Script) into columns. Columns are seperated by *
* non-printing characters, such as a space or tab. Your Attribute *
* Code values are dependent on the position in which they appear in *
* your Script output file; that is: *
* *
* o The Attribute from column 1 should have a code number of 1, *
* o The Attribute from column 2 should have a code number of 2, *
* o etc ... *
* *
* You are allowed 32 Status Attributes. *
* *
* You must select the Datatype which best represents that data for *
* the Attribute returned by your Script. Available Datatypes are: *
* *
* o Integer32, or *
* o Latin1String, or *
* o Real *
* *
************************************************************************)
STATUS ATTRIBUTES
ATTRIBUTE Command Executed = 300 : Latin1String
ACCESS = NONSETABLE,
DISPLAY = TRUE,
CATEGORIES = ( CONFIGURATION )
END ATTRIBUTE Command Executed;
ATTRIBUTE State = 001 : Latin1String
ACCESS = NONSETABLE,
DISPLAY = TRUE,
CATEGORIES = ( CONFIGURATION )
END ATTRIBUTE Version;
END ATTRIBUTES; (* STATUS *)
(*
* Include the Script AM standard directives
*)
INCLUDE mcc_script_am_directives.ms;
END ENTITY loopback; (* <<< Edit >>> *)
END SPECIFICATION loopback; (* <<< Edit >>> *)
**** END MCC_SCRIPT_LOOPBACK_SRVC_IF.MS
Instructions:
The following command procedure is referenced by the script that gets
created in DECmcc. To create the script, perform the following
operations. First make sure the Management Specification file has been
loaded. Next, select the desired domain in the DECmcc iconic map window.
Unlock the map and bring up the DECmcc Toolbox. Select the Script icon and
enter the desired name for the script. In this example, miscellaneous was
used. Click on OK and fill in any of the fields yuo wish on the add entity
information box that appears. None of the fields are required. Again,
click OK and then move the pointer to the map window and click MB2 as
instructed. Once the script icon appears, double click on it to see the
list of categories available. Exit the DECmcc Toolbox window and invoke it
again to access the Script Toolbox. Click on Loopback and then enter a
name for the Loopback you are creating. Since the .COM procedure being
called expects a p1 parameter of a valid nodename to be passed to it, you
might want to call it LOOPBACK_<nodename>. Click on OK after entering the
name and fill in the fields in the enter entity information box that
appears. Only the command field is required. You should enter the
following command there.
@MCC_SCRIPTS:MCC_LOOPBACK.COM <nodename>
NOTE:
The following MCC_LOOPBACK.COM procedure should be placed in the directory
pointed to by the MCC_SCRIPTS: logical.
Once the form is complete, click on OK and move the pointer to the map
window and click MB2 as instructed. This completes the setup of the script
and at this point, you can select the script with a single click and
perform an operations show status command to see if it works.
**** BEGIN MCC_LOOPBACK.COM
$! **********************************************************************
$! * ****************************************************************** *
$! * * * *
$! * * ************************************************************ * *
$! * * * * * *
$! * * * * * *
$! * * * This DCL Command File is written by <removed> * * *
$! * * * * * *
$! * * * July 1st, 1993 * * *
$! * * * * * *
$! * * * This Command file will allow DECmcc to check on the * * *
$! * * * reachability to any DECnet nodes. * * *
$! * * * * * *
$! * * ************************************************************ * *
$! * * * *
$! * ****************************************************************** *
$! **********************************************************************
$!
$! **********************************************************************
$! * *
$! * FACILITY: *
$! * *
$! * DECmcc Script Access Module *
$! * *
$! * ABSTRACT: *
$! * *
$! * mcc_loopback.com *
$! * *
$! * This is an Script AM for checking reachability of DECnet Nodes *
$! * *
$! * 1. Node name is input through p1 *
$! * 2. Check if Node name is in the Volatile NCP database *
$! * 3. If not in database *
$! * then STATE = ERROR *
$! * 4. else check if Node is reachable *
$! * 5. then STATE = Up *
$! * else STATE = Down *
$! * 6. Write to Screen value of STATE *
$! * *
$! * This script will list certain directory information: *
$! * *
$! * o Status of node *
$! * *
$! * INPUT DATA: *
$! * *
$! * P1 = DECnet node *
$! * *
$! * AUTHOR: *
$! * *
$! * <removed> *
$! * *
$! * EDIT HISTORY: *
$! * *
$! * 01-JUL-93 v1.0-001 Created *
$! * *
$! **********************************************************************
$!
$ SET NOVERIFY
$ ON ERROR THEN GOTO END
$!
$ state = "Error"
$ if (p1 .EQS. "")
$ then
$ p1 = "BLANK"
$ goto END
$ endif
$!
$ Start:
$!
$ DEFINE/USER_MODE SYS$OUTPUT NL:
$ DEFINE/USER_MODE SYS$ERROR NL:
$!
$ mc ncp loop node 'p1'
$!
$ if ($STATUS .NE. "%X10000001")
$ then
$ state = "Down"
$ else
$ state = "Up"
$ endif
$!
$ END:
$!
$ write sys$output "''p1' ''state'"
$!
$ exit
$!
**** END MCC_LOOPBACK.COM
Use the following alarm rule command procedure as a template and customize
it to fit your environment by changing the nodename involved. To submit
either of the following procedures to batch for alarm purposes, you MUST
use the /NOPRINT qualifier for them to work.
EG:
$ SUBMIT/NOPRINT/QUEUE=SYS$BATCH RULE_EMAWIZ_STATE_DOWN_LOOPBACK.COM
**** BEGIN RULE_EMAWIZ_STATE_DOWN_LOOPBACK.COM
$!
$! MCC Alarm Rule
$!
$! NAME: RULE_EMAWIZ_STATE_DOWN_LOOPBACK.COM
$!
$! This rule uses the script "loopback" to check for the attribute state
$! every 5 minutes. Each time the rule is executed the script is executed
$! and the result is checked to decide whether to fire the alarm. If the
$! state is = Down, then the alarm fires.
$!
$!
$ manage/enter
Create Domain LOCAL_NS:.walts_cube Rule EMAWIZ_STATE_Down -
Expression = (Script LOCAL_NS:.miscellaneous -
loopback EMAWIZ State = Down, -
at every=00:05:00), -
Severity = Major, -
Category = "Device Status", -
Description = "Node4 EMAWIZ is NOT reachable"
show domain walts_cube rule EMAWIZ_STATE_DOWN all status, at start=(+0-00:10:00)
!
! The above command will cause the rule to stay active for 10 minutes
! after the rule is submitted to batch. Alternatively, you can use the
! procedure following this text to submit to batch and enable the rule
! after it has already been created.
!
!
!
!
! To keep the alarm rule active for a longer period of time, use the
! following example procedure and customize it to fit your environment.
! In this case, the alarm rule must have already been created.
!
$!
$! ENABLE_RULE_EMAWIZ_STATE_DOWN_LOOPBACK.COM
$!
$ MANAGE/ENTER
ENABLE DOMAIN walts_cube RULE EMAWIZ_STATE_Down
SHOW DOMAIN walts_cube RULE EMAWIZ_STATE_Down ALL Characteristics, -
AT START=(+999-00:00:00)
EXIT
**** END RULE_EMAWIZ_STATE_DOWN_LOOPBACK.COM
|