Creating a new OMNIbus event reader from the command line

You can create a new OMNIbus event reader from the command line.

To create an OMNIbus event reader from the command line, use the following steps:

  1. Create an XML file called create_service.xml using the following lines:

    <?xml version="1.0" encoding="utf-8"?>
    
    <project name="create_service" default="createService" basedir="." xmlns:if="ant:if" xmlns:unless="ant:unless">
    
        <taskdef name="impactHttp" classname="com.ibm.tivoli.impact.install.taskdef.ImpactHttpUtils"
                 classpath="${impact.home}/install/configuration/cfg_scripts/taskdefs/install-taskdefs.jar"
                 onerror="report"/>
    
    	<target name="createService">
    
        <!-- if you want to add without filters, add the following property: "addWithoutFilters": "true" -->
        <!-- For Filters: Modify the "items:" section in "EVENTMAPPINGS", with your policies and filters -->
    	<property name="newService" value='
    		{"isNew": "true",
    		"GETUPDATEDEVENTSACTION": false,
    		"EVENTLOCKINGENABLED": false,
    		"GETDELETEDEVENTSACTION": false,
    		"RUNPOLICYONDELETESACTION": "AddPolicyProcessMapping",
    		"EVENTLOCKINGEXPRESSION": "",
    		"STARTUPENABLED": false,
    		"SERVICECLASS": "OMNIbusEventReader",
    		"EVENTMAPPINGS": {
    				"layout": [{
    					"encode": true,
    					"field": "RESTRICTIONFILTER",
    					"name": "Restriction Filter"
    				}, {
    					"field": "POLICYNAME",
    					"name": "Policy Name"
    				}, {
    					"field": "ACTIVE",
    					"name": "Active"
    				}, {
    					"field": "CHAIN",
    					"name": "Chain"
    				}],
    				"identifier": "id",
    				"label": "id",
    				"items": [
    				  {
                        "CHAIN": false,
                        "ACTIVE": true,
                        "id": 1,
                        "POLICYNAME": "AddPolicyProcessMapping",
                        "RESTRICTIONFILTER": "1=1"
                      },
                      {
                        "CHAIN": false,
                        "ACTIVE": true,
                        "id": 2,
                        "POLICYNAME": "DefaultExceptionHandler",
                        "RESTRICTIONFILTER": "1=1"
                      }
    			    ]
    			},
    		"SELECTEDFIELDS": {
    			"identifier": "name",
    			"label": "name",
    			"items": [{
    				"name": "*"
    			}]
    		},
    		"SERVICENAME": "${service.name}",
    		"DATASOURCENAME": "defaultobjectserver",
    		"AVAILABLEFIELDS": {
    			"identifier": "name",
    			"label": "name",
    			"items": []
    		},
    		"POLLINGINTERVAL": 3000,
    		"SERVICELOGENABLED": true,
    		"COLLECTREPORTSENABLED": false,
    		"EVENTMATCHING": 0,
    		"ORDERBY": "",
    		"FAILEDDISCOVERY": true,
    		"GETSTATUSEVENTSACTION": false
    	}'/>
    			
    		<echo message="Creating the Event Reader Service: "/>
    		<impactHttp url="http://${impact.hostname}:${impact.port}/restui/serviceui/service/omnibuseventreader/${service.name}" method="POST" body="${newService}" username="${impact.user}" password="${impact.pass}">		
    	    <header name="Content-Type" value="application/json"/>
    		</impactHttp>
    	</target>
    	
    </project>
  2. Place the file in your home directory on the Impact server system.

  3. Execute following command from the $IMPACT_HOME/bin directory:

    ./nc_ant -buildfile /home/tivoli/create_service.xml -Dimpact.home="/opt/IBM/tivoli/impact_server" -Dimpact.hostname="vacuum1.fyre.ibm.com" -Dimpact.port="9090" -Dimpact.user="impactadmin" -Dimpact.pass="impactpass" -Dservice.name="OMNIbusEventReader2"

    Changing the following parameters for your environment: impact.home, impact.hostname, impact.port, impact.user and impact.pass, and service.name

    You can also change the contents for the XML file to modify the parameters as required.

    Note: You will need to modify EVENTMAPPINGS for your environment.
  4. Execute following command from the $IMPACT_HOME/bin directory:

    ./nci_version_control <ImpactServerName> add $IMPACT_HOMEt/etc/<ImpactServerName>_<yourservicename_in_lowercase>.props impactadmin

    Where impactadmin is a valid impact admin user.