Creating multiple objects by using the sample script

You can create multiple objects by using a script.

Each section in a script corresponds to one object (such as one SLC duration schedule). Each script is used to create multiples of only one type of object. For example, create one script to create multiple standard SLCs, one script to create multiple wildcard SLCs, and one script to create multiple rules. Each section of a script contains the following information:

  • A copy command that specifies the template name to be copied.
  • The variables and values you want to substitute.
  • A final statement that defines the object you are adding to IBM® Sterling Control Center Monitor.

If the final statement for each section has the text “UPDATE” appended to it, for example, RULEUPDATE , then instead of creating an object, the object is assumed to exist. An update to that object is attempted.

To create multiple objects by using the sample script:

  1. Use a text editor such as WordPad to open the provided sample script file.
    # Sample script to build SLCs, schedules, rules, actions, servers, and other configuration objects.
    #
    # To build your own templates, complete the following steps:
    #
    # Use the IBM Control Center console to build the SLC group, SLC wildcard group, schedule, time-schedule,
    # rule, action, server, and other configuration objects that you need.
    #
    # Run exportConfig.sh and go to conf-exported/<timestamp>/conf/ to retrieve the XML definition file
    # for the object that was created.
    #
    # Copy the new configuration objects into the conf/templates subdirectory and change the file extension from .xml to .tmp.
    #
    # SLC Groups are in conf/slcs/groups and conf/slcs/groups/visibilityGroups
    # SLC Schedules are in conf/slcs/schedules
    # Rules are in conf/rules and conf/rules/visibilityGroups
    # Actions are in conf/actions
    # Servers are in conf/services/nodes
    # Metadata rules are in conf/metadataRules
    # Metadata actions are in conf/metadataActions
    # Rule and Metadata rule schedules are in conf/ruleSchedules
    # Data Visibility Groups are in conf/dataVisibilityGroups
    # Calendars are in conf/calendars
    # Roles are in conf/roles
    # Users are in conf/users
    # Message Lists are in conf/slcs/messageLists
    #
    # Edit the template and substitute variable names where appropriate.  Be sure to end each variable name with
    # a semicolon. For example, the variable name is  &name;.
    #
    # Write a script to copy your template and substitute the appropriate variables. The following scripts
    # are examples.
    #
    # The last statement for each section indicates what type of configuration object you are adding to IBM Control Center:
    #
    # SLCGROUP             - SLC Group
    # SLCWCGROUP           - Wildcard SLC Group
    # SLCWFGROUP           - Workflow SLC Group
    # SLCSCHEDULE          - SLC Time Schedule
    # RULE                 - IBM Control Center Rule
    # RULESCHEDULE         - IBM Control Center Rule
    # REPORTSCHEDULE       - IBM Control Center Report Schedule
    # CALENDAR             - IBM Control Center Calendar
    # AUTOMATEDREPORTGROUP – IBM Control Center Automated Report Group
    # EMAILLIST            - IBM Control Center EMail List
    # ACTION               - IBM Control Center Action
    # SERVER               - Create a new Server/Node definition
    # SERVERGROUP          - Create a new Server/Node definition
    # METADATARULE         - Create a new Metadata Rule
    # METADATASCHEDULE     - Create a new Metadata Rule Schedule
    # DVG                  - IBM Control Center Data Visibility Group
    # ROLE                 - IBM Control Center Role
    # USER                 - IBM Control Center User
    # MESSAGELIST          - IBM Control Center Data Message List
    #
    # Note if the last statement for each section has the text "UPDATE" appended to it such as RULEUPDATE or ACTIONUPDATE, then
    # instead of creating a IBM Control Center configuration object, the object is assumed to exist and an update is attempted.
    #
    # Note Server updates are typically performed for batch password changes.
    #
    # Then run the "runBatch.bat" or "runBatch.sh" from the bin directory:
    #
    #  runBatch <ccenter ip address> <ccenter port> <ccenter  userid> <ccenter userid password> <scriptname> [DELETE]
    #
    # eg.  runBatch 127.0.0.1 58080 admin admin ../conf/script.txt
    #
    # If any errors are produced when running the script, you should run it again specifying the delete option.
    # To delete all successfully defined objects before correcting the script and starting over again:
    #
    # For example,  runBatch 127.0.0.1 58080 admin admin ../conf/script.txt delete
    #
    #
    # Note:  Actions cannot be deleted if referenced by a rule because the rules must be deleted first.
    #        Schedules cannot be deleted if referenced by an SLC Group  because the group must be deleted first.
    #        But, when you add a rule, the action must already be defined.  When you add a group, the
    #        the schedule must already be defined.
    #
    #        Separate scripts should be written for groups and schedules,
    #        and for rules and actions.
    #
    copy slc_regex
    &id;           = WCSLC_7
    &desc;         = description
    &enabled;      = true
    
    &filenameregex; = true
    &filename;     = ˆdest.*
    
    &noderegex;    = false
    &node;         = SERVER*
    
    &processregex; = true
    &process;      = ˆPROCESS$
    
    &remotenoderegex; = false
    &remotenode;   = SERVER
    &schedule;     = schedule
    
    &submitterregex; = false
    &submitter;    =
    
    &servergroup;  = ServerGroup
    &node;         = Node1
    &missingevent;  = true
    &monitortolerance; = 6
    SLCWCGROUP
    #
    
    copy slc_group
    &id;           = WCSLC_6
    &enabled;      = true
    &desc;         = description
    &filename;     = dest
    &node;         = SERVER
    &process;      = PROCESS
    &remotenode;   = SERVER
    &schedule;     = schedule
    &submitter;    = submitter
    &duplicatefilenames; = false
    &duplicateprocesses; = false
    &missingevent; = true
    &monitortolerance; = 6
    &servergroup;  = ServerGroup
    SLCGROUP
    #
    
    copy duration
    &id;           = duration_schedule
    &enabled;      = true
    &dmax;         = 0:30
    &dmin;         = 0:25
    &desc;         = description
    SLCSCHEDULE
    #
    
    copy email
    &desc;          = description
    &email;         = name@address
    &id;            = email_action
    &fromEmailAddr; = from@email
    &subject;       = what a pretty subject
    &message;       = what a beautiful message
    ACTION
    #
    
    copy opSys
    &desc;         = description
    &id;           = opsys_action
    &operation;    = c:\\doit.bat
    ACTION
    #
    
    copy rule
    &id;           = sample_rule
    &desc;         = description
    &enabled;      = true
    &messageid;        = MSGID01I
    &actionid;     = alert0
    &eventtype;    = 6
    RULE
    #
  2. Choose from among the following final statements:
    Statement Object
    ACTION IBM Sterling Control Center Monitor action
    AUTOMATEDREPORTGROUP IBM Sterling Control Center Monitor automated report group
    CALENDAR IBM Sterling Control Center Monitor calendar
    DVG IBM Sterling Control Center Monitor Data Visibility Group
    EMAILLIST IBM Sterling Control Center Monitor email list
    MESSAGELIST IBM Sterling Control Center Monitor data message list
    METADATAACTION IBM Sterling Control Center Monitor metadata action
    METADATARULE IBM Sterling Control Center Monitor metadata rule
    REPORTSCHEDULE IBM Sterling Control Center Monitor rule/metadata rule schedule
    ROLE IBM Sterling Control Center Monitor role
    RULE IBM Sterling Control Center Monitor rule
    RULESCHEDULE IBM Sterling Control Center Monitor rule schedule
    SERVER Create a new server/node definition
    SERVERGROUP Create a new server/node definition
    SLCGROUP IBM Sterling Control Center Monitor SLC group
    SLCSCHEDULE IBM Sterling Control Center Monitor SLC schedule
    SLCWCGROUP IBM Sterling Control Center Monitor wildcard SLC group
    SLCWFGROUP IBM Sterling Control Center Monitor workflow SLC group
    USER IBM Sterling Control Center Monitor user
  3. Name and save the file.
  4. When the IBM Sterling Control Center Monitor engine is running and is initialized, open a command window and change your working directory to ControlCenter\bin.
  5. Type one of the following commands:
    • In Microsoft Windows:
      runBatch hostname port userid password scriptname
    • In UNIX:
      runBatch.sh hostname port userid password scriptname
    The following table shows the parameter values:
    Tag Description
    hostname The IP address or DNS host name where IBM Sterling Control Center Monitor is installed.
    port The HTTP port number that the IBM Sterling Control Center Monitor engine monitors.
    userid The user name to access the IBM Sterling Control Center Monitor. This value is case-sensitive.
    password The password to access the IBM Sterling Control Center Monitor. This value is case-sensitive.
    scriptname The path and name of the script created in step 1 .

    For example, in Microsoft Windows, type:

    runBatch 127.0.0.1 58080 admin admin ..\conf\slcscript.txt

    In UNIX, type:

    runBatch.sh 127.0.0.1 58080 admin admin ../conf/slcscript.txt

    The script executes and creates the objects.

  6. To invoke runBatch utility in a secure mode, specify the -Dsecure=true at the command-line option when you run the batch creation utility. For example, to execute BatchCreate in a secure mode using a single line:
    "E:\ControlCenter61\jre\bin\java" -Xms256m -Xmx512m -Xbootclasspath/p:%BOOT_CP%;
    -Dlog4j.configuration=file:..\conf\Engine.log4j
    -Dlog4j.configurationFile=../conf/EngineLogger.xml
    -Dopenjpa.DynamicEnhancementAgent=false
    -Dsecure=true
    -Djavax.net.ssl.keyStore=path\keystore-file
    -Djavax.net.ssl.keyStorePassword=password
    -Djavax.net.ssl.keyStoreType=jks
    -Djavax.net.ssl.trustStore=path\truststore-file
    -Djavax.net.ssl.trustStorePassword=password
    -Djavax.net.ssl.trustStoreType=jks
    -DCONFIG_DIR=..\conf -jar ..\lib\sterling\SCCenter.jar com.sterlingcommerce.scc.utility.batch.BatchCreate %1 %2 %3 %4 %5 %6 %7 %8
    REM
    To execute BatchCreate in a secure mode using multiple lines:
    REM Note: A command string may be wrapped across multiple lines by specifying
    REM a space + caret (^) at the end of each continuation line as shown below.
    REM
    REM "E:\ControlCenter61\jre\bin\java" -Xms512m -Xmx1024m -Xbootclasspath/p:%BOOT_CP%; ^
    REM -Dlog4j.configurationFile=../conf/EngineLogger.xml ^
    REM -Dsecure=true ^
    REM -Djavax.net.ssl.keyStore=path\keystore-file ^
    REM -Djavax.net.ssl.keyStorePassword=password ^
    REM -Djavax.net.ssl.keyStoreType=jks ^
    REM -Djavax.net.ssl.trustStore=path\truststore-file ^
    REM -Djavax.net.ssl.trustStorePassword=password ^
    REM -Djavax.net.ssl.trustStoreType=jks ^
    REM -DCONFIG_DIR=..\conf ^
    REM -jar ..\lib\sterling\SCCenter.jar com.sterlingcommerce.scc.utility.batch.BatchCreate ^
    REM ipaddr ^
    REM portno ^
    REM userid ^
    REM password ^
    REM path\script-file
  7. If any script errors occur:
    1. Type one of the following to delete all defined objects:
      • In Microsoft Windows, type:
        runBatch hostname port userid password scriptname delete
      • In UNIX, type
        runBatch.sh hostname port userid password scriptname delete
    2. Review the template and scripts to determine where the error occurred.
    3. Make the necessary corrections and issue the runBatch command again.