Creating multiple objects by using the sample script

You can create multiple objects by using a script.

About this task

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® Control Center.

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:

Procedure

  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 Control Center action
    AUTOMATEDREPORTGROUP IBM Control Center automated report group
    CALENDAR IBM Control Center calendar
    DVG IBM Control Center Data Visibility Group
    EMAILLIST IBM Control Center email list
    MESSAGELIST IBM Control Center data message list
    METADATAACTION IBM Control Center metadata action
    METADATARULE IBM Control Center metadata rule
    REPORTSCHEDULE IBM Control Center rule/metadata rule schedule
    ROLE IBM Control Center role
    RULE IBM Control Center rule
    RULESCHEDULE IBM Control Center rule schedule
    SERVER Create a new server/node definition
    SERVERGROUP Create a new server/node definition
    SLCGROUP IBM Control Center SLC group
    SLCSCHEDULE IBM Control Center SLC schedule
    SLCWCGROUP IBM Control Center wildcard SLC group
    SLCWFGROUP IBM Control Center workflow SLC group
    USER IBM Control Center user
  3. Name and save the file.
  4. When the IBM Control Center 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 Control Center is installed.
    port The HTTP port number that the IBM Control Center engine monitors.
    userid The user name to access the IBM Control Center. This value is case-sensitive.
    password The password to access the IBM Control Center. 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. 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.