COSMOS DEMO i8
From Eclipsepedia
This page provides instructions on how to install and run the COSMOS demo for i8.
Contents |
Objective of the Demo
Installation
Download COSMOS Demo and Pre-requisites
This section provides instructions for installing and running the demo program that is provided in the COSMOS i8 build.
- Install Tomcat 5.5.25. The directory where the Tomcat server is installed will be referred to as the <tomcat_install_dir> in this document.
- From the COSMOS download page, click on the link of the latest stable build (for i8). Download the zip file under the "COSMOS Demo" section.
- Unzip the demo zip file to a directory. You will see a directory called "cosmos-demo". This directory will be referred to as <cosmos-demo> in this document.
- Under <cosmos-demo>\WebApps, you will see 3 subdirectories. Copy these directories to <tomcat_install_dir>\webapps.
Configurations
- At a Windows command prompt, enter <cosmos-demo>\bin.
- Run configDemo.bat to update some configuration files according to your system environment.
- The configDemo program assumes:
- You have copied the cosmos directory to the webapps directory in Tomcat by following the instructions in the previous section.
- Your <cosmos-demo> directory and the tomcat installation are on the same host.
- The program will prompt you for some input. You will see something like the following in a successful execution of the config program.
D:\cosmos2\i8\build4\cosmos-demo\bin>java -cp config.jar org.eclipse.cosmos.demo .config.DemoConfig This program will configure some environment variables for the COSMOS demo to ru nWe assume that the Tomcat server and the directory where you unzipped the demo program are on the same computer. Apache Tomcat install directory: C:\Program Files\apache-tomcat-5.5.23 Hostname of the Tomcat server (e.g. www.eclipse.org): www.mydomain.com Tomcat port number: 8080 COSMOS Demo install directory: C:\cosmos-demo Set management domain EPR for broker successfully. Set management domain EPR for Example MDR successfully. Set management domain EPR for SML MDR successfully. Set management domain EPR for logging data manager successfully. Set CBEData.dir for logging data manager successfully. Set management domain EPR for stat data manager successfully. Set derby.system.home for statistical data manager successfully. Updated SML MDR config file successfully.
Running the Program
Starting the Management Domain and Broker
After you have configured the program by following instructions in the previous section, start Tomcat by running <tomcat_install_dir>/bin/startup.bat. Note: this is a Java program, so you will need JRE_HOME or JAVA_HOME set in order for this to run.
Register Broker with Management Domain
- After Tomcat is started, we need to register the broker with the management domain.
- Execute <cosmos-demo>\bin\domainEPR.bat. This program will ask you for your hostname and port number of the Tomcat server, and prints out the EPR (Endpoint Reference) of the management domain; this reference is expressed in XML format. Copy the EPR of the management domain to a scratch editor window, such as in Notepad. You will use it later.
- Execute <cosmos-demo>\bin\brokerEPR.bat. This program will ask you for your hostname and port number of the Tomcat server, and prints out the EPR of the broker. Copy the EPR of the broker to an editor window, like you did for the management domain EPR. You will use it later.
- Execute <cosmos-demo>\cosmos-client\cosmosClient.bat.
- At the COSMOS prompt, type "broker register". When prompted for the broker EPR, copy the output of the previous step at the COSMOS prompt.
COSMOS> broker register
Broker EPR (terminate by an empty line):
<?xml version="1.0" encoding="UTF-8"?>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>http://localhost:8080/cosmos/services/broker</wsa:Address>
</wsa:EndpointReference>
Broker has been registered with management domain.
- Get a list of brokers at the management domain with the "domain getBrokers" command:
COSMOS> domain getBrokers
Management Domain EPR (terminate by an empty line):
<?xml version="1.0" encoding="UTF-8"?>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>http://localhost:8080/cosmos/services/domain</wsa:Address>
</wsa:EndpointReference>
EPR of brokers:
Broker 1:
<?xml version="1.0" encoding="UTF-8"?>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing"/>
<wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8080/cosmos/services/broker</wsa:Address>
</wsa:EndpointReference>
Starting the Data Managers
- Pre-requisite: Tomcat server is started.
- Open a new command prompt window. At the prompt, change to this directory: <cosmos-demo>\DataManagers.
- Execute startup.bat.
- The data managers are started in an OSGi container by the startup.bat program. The data managers are registered with the management domain automatically.
- At the command prompt where you were executing the cosmos-client, you can see a list of the data managers by executing "broker getDataManagers".
COSMOS> broker getDataManagers
EPR of data mangers:
Data Manager 1:
<?xml version="1.0" encoding="UTF-8"?>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://______:8081/cosmos/services/org.eclipse.cosmos.example.mdr.ExampleMdr</wsa:Address>
<wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing">
<muse-wsa:ResourceId xmlns:muse-wsa="http://ws.apache.org/muse/addressing">Example</muse-wsa:ResourceId>
</wsa:ReferenceParameters>
</wsa:EndpointReference>
Data Manager 2:
<?xml version="1.0" encoding="UTF-8"?>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://_____:8081/cosmos/services/org.eclipse.cosmos.rm.sml.mdr.impl.SmlRepositoryMdr</wsa:Address>
<wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing">
<muse-wsa:ResourceId xmlns:muse-wsa="http://ws.apache.org/muse/addressing">SML_REPO_ID</muse-wsa:ResourceId>
</wsa:ReferenceParameters>
</wsa:EndpointReference>
Data Manager 3:
<?xml version="1.0" encoding="UTF-8"?>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://_____:8081/cosmos/services/org.eclipse.cosmos.dc.logging.datamgr.LoggingDataManager</wsa:Address>
<wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing">
<muse-wsa:ResourceId xmlns:muse-wsa="http://ws.apache.org/muse/addressing">LoggingDataManager</muse-wsa:ResourceId>
</wsa:ReferenceParameters>
</wsa:EndpointReference>
Data Manager 4:
<?xml version="1.0" encoding="UTF-8"?>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://_____:8081/cosmos/services/org.eclipse.cosmos.dc.stat.datamgr.StatisticalDataManager</wsa:Address>
<wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing">
<muse-wsa:ResourceId xmlns:muse-wsa="http://ws.apache.org/muse/addressing">StatDataManager</muse-wsa:ResourceId>
</wsa:ReferenceParameters>
</wsa:EndpointReference>
Executing CMDBf Queries
Using a command line client
- We can execute CMDBf queries using the command line client.
- At the COSMOS prompt, type "smlmdr query" followed by the path to the query file to run a query against the SML MDR. If you are querying the Example MDR, the command is instead "examplemdr".
- The query files for the SML MDR are located in <cosmos-demo>\cosmos-client\cmdbf-queries\SMLMDR.
- The query files for the Example MDR are located in <cosmos-demo>\cosmos-client\cmdbf-queries\ExampleMDR.
- When prompted for the EPR for the SML MDR or the Example MDR, you can copy the EPR from the output of the "broker getDataManagers" command you did in the previous section.
COSMOS> smlmdr query _______\cosmos-demo\cosmos-client\cmdbf-queries\SMLMDR\testInstanceIdQuery.txt
EPR of SML Repository MDR (terminate by an empty line):
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>http://____:8081/cosmos/services/org.eclipse.cosmos.rm.sml.mdr.impl.SmlRepositoryMdr</wsa:Address>
<wsa:ReferenceParameters>
<muse-wsa:ResourceId xmlns:muse-wsa="http://ws.apache.org/muse/addressing">SML_REPO_ID</muse-wsa:ResourceId>
</wsa:ReferenceParameters>
</wsa:EndpointReference>
Query response:
<?xml version="1.0" encoding="UTF-8"?><dyn:queryResponseType xmlns:dyn="http://www.eclipse.org/cosmos/mdrquery">
<dyn:queryResponseType xmlns="http://cmdbf.org/schema/1-0-0/datamodel">
<nodes templateId="cableTemplate">
........ Content omitted .........
</nodes>
</dyn:queryResponseType>
</dyn:queryResponseType>
- You can invoke queries on the Example MDR in a similar way.
COSMOS> examplemdr query _______\cosmos-demo\cosmos-client\cmdbf-queries\ExampleMDR\all-students.txt
EPR of SML Repository MDR (terminate by an empty line):
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>http://_____:8081/cosmos/services/org.eclipse.cosmos.example.mdr.ExampleMdr</wsa:Address>
<wsa:ReferenceParameters>
<muse-wsa:ResourceId xmlns:muse-wsa="http://ws.apache.org/muse/addressing">Example</muse-wsa:ResourceId>
</wsa:ReferenceParameters>
</wsa:EndpointReference>
Query response:
<?xml version="1.0" encoding="UTF-8"?><dyn:queryResponseType xmlns:dyn="http://www.eclipse.org/cosmos/mdrquery">
<dyn:queryResponseType xmlns="http://cmdbf.org/schema/1-0-0/datamodel">
<nodes templateId="items">
........ Content omitted .........
</nodes>
</dyn:queryResponseType>
</dyn:queryResponseType>
Invoking services of data managers
Collect Log events from the logging data manager
There are two types of log event information available from the logging data manager:
- the actual event information
- a summary of the types of events (e.g. Severe/Warning/Info) for each subcomponent
To obtain this information, use the CosmosClient.bat file mentioned in the above section. Note that when using 'logging' commands, you will be prompted for the EPR of the DataManager Enter it exactly as it is shown in the output of 'broker getDataManagers' for example
COSMOS> broker getDataManagers Broker EPR (terminate by an empty line): <?xml version="1.0" encoding="UTF-8"?> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Address>http://localhost:8080/cosmos/services/broker</wsa:Address> </wsa:EndpointReference> EPR of data mangers: Data Manager 1: <?xml version="1.0" encoding="UTF-8"?> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8081/cosmos/services/org.eclipse.cosmos.dc.logging.datamgr.LoggingDataManager</wsa:Address> <wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing"> <muse-wsa:ResourceId xmlns:muse- wsa="http://ws.apache.org/muse/addressing">LoggingDataManager</muse-wsa:ResourceId> </wsa:ReferenceParameters> </wsa:EndpointReference>
So when the prompt says
DataManager EPR (terminate by an empty line):
you enter
<?xml version="1.0" encoding="UTF-8"?> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8081/cosmos/services/org.eclipse.cosmos.dc.logging.datamgr.LoggingDataManager</wsa:Address> <wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing"> <muse-wsa:ResourceId xmlns:muse- wsa="http://ws.apache.org/muse/addressing">LoggingDataManager</muse-wsa:ResourceId> </wsa:ReferenceParameters> </wsa:EndpointReference>
followed by a blank line.
First call logging getDatasets to get a list of available datasources like this:
COSMOS> logging getDatasets DataManager EPR (terminate by an empty line): <?xml version="1.0" encoding="UTF-8"?> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8081/cosmos/services/org.eclipse.cosmos.dc.logging.datamgr.LoggingDataManager</wsa:Address> <wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing"> <muse-wsa:ResourceId xmlns:muse- wsa="http://ws.apache.org/muse/addressing">LoggingDataManager</muse-wsa:ResourceId> </wsa:ReferenceParameters> </wsa:EndpointReference> access_log.cbe.xml windows_app_log.cbe.xml
Then, get the event info using logging getAllCBE <logfile> where 'logfile' is one of the data source files from the list obtained from logging getDatasets (e.g. access_log.cbe.xml).
COSMOS> logging getAllCBE access_log.cbe.xml DataManager EPR (terminate by an empty line): <?xml version="1.0" encoding="UTF-8"?> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8081/cosmos/services/org.eclipse.cosmos.dc.logging.datamgr.LoggingDataManager</wsa:Address> <wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing"> <muse-wsa:ResourceId xmlns:muse- wsa="http://ws.apache.org/muse/addressing">LoggingDataManager</muse-wsa:ResourceId> </wsa:ReferenceParameters> </wsa:EndpointReference>
This will print out a long list of CommonBaseEvent objects obtained from the logfile specified.
To get the event type summary, use logging getCBECountBySeverity <logfile> where 'logfile' is again a logfile from the list obtained by logging getDatasets. Using the same example:
COSMOS> logging getCBECountBySeverity access_log.cbe.xml DataManager EPR (terminate by an empty line): <?xml version="1.0" encoding="UTF-8"?> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8081/cosmos/services/org.eclipse.cosmos.dc.logging.datamgr.LoggingDataManager</wsa:Address> <wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing"> <muse-wsa:ResourceId xmlns:muse- wsa="http://ws.apache.org/muse/addressing">LoggingDataManager</muse-wsa:ResourceId> </wsa:ReferenceParameters> </wsa:EndpointReference> Component Network Device Severe 2 Warning 25 InfoCount 159 Component Apache HTTP Server Severe 2 Warning 25 InfoCount 159
Collect webserver performance data from the statistical data manager
To get information from the statistical data manager, use the CosmosClient.bat mentioned in the above section.
Similar to the 'logging' commands, when using 'stat' commands, you will be prompted for the EPR of the DataManager
Enter it exactly as it is shown in the output of 'broker getDataManagers'
for example
COSMOS> broker getDataManagers Broker EPR (terminate by an empty line): <?xml version="1.0" encoding="UTF-8"?> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Address>http://localhost:8080/cosmos/services/broker</wsa:Address> </wsa:EndpointReference> EPR of data mangers: Data Manager 1: <?xml version="1.0" encoding="UTF-8"?> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8081/cosmos/services/org.eclipse.cosmos.dc.logging.datamgr.StatisticalDataManager</wsa:Address> <wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing"> <muse-wsa:ResourceId xmlns:muse- wsa="http://ws.apache.org/muse/addressing">StatDataManager</muse-wsa:ResourceId> </wsa:ReferenceParameters> </wsa:EndpointReference>
So when the prompt says
DataManager EPR (terminate by an empty line):
you enter
<?xml version="1.0" encoding="UTF-8"?> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8081/cosmos/services/org.eclipse.cosmos.dc.logging.datamgr.StatisticalDataManager</wsa:Address> <wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing"> <muse-wsa:ResourceId xmlns:muse- wsa="http://ws.apache.org/muse/addressing">StatDataManager</muse-wsa:ResourceId> </wsa:ReferenceParameters> </wsa:EndpointReference>
followed by a blank line.
First you have to call stat getDatasourceKeyset like this:
COSMOS> stat getDatasourceKeyset DataManager EPR (terminate by an empty line): <?xml version="1.0" encoding="UTF-8"?> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8081/cosmos/services/org.eclipse.cosmos.dc.logging.datamgr.StatisticalDataManager</wsa:Address> <wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing"> <muse-wsa:ResourceId xmlns:muse- wsa="http://ws.apache.org/muse/addressing">StatDataManager</muse-wsa:ResourceId> </wsa:ReferenceParameters> </wsa:EndpointReference> server 33 tomcat1181829221515 CBE server 33 tomcat1181829221515 TomcatSet
This will return the available dataset/keyset combinations available
Then use this information to call stat getStatDataForSource <dataset> <keyset>
where dataset and keyset come the list obtained from stat getDatasourceKeyset
In the above example, the first line indicates that the dataset is "server 33 tomcat1181829221515" and the keyset is CBE. It is important to use quotes around the dataset argument, so that the parser does not think you mean dataset = server and keyset = 33.
In that case, you would call the client like this:
COSMOS> stat getStatDataForSource "server 33 tomcat1181829221515" CBE DataManager EPR (terminate by an empty line): <?xml version="1.0" encoding="UTF-8"?> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8081/cosmos/services/org.eclipse.cosmos.dc.logging.datamgr.StatisticalDataManager</wsa:Address> <wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing"> <muse-wsa:ResourceId xmlns:muse- wsa="http://ws.apache.org/muse/addressing">StatDataManager</muse-wsa:ResourceId> </wsa:ReferenceParameters> </wsa:EndpointReference> Thu Jun 14 09:54:41 EDT 2007 ( server 33 tomcat1181829221515 = 2 ) Thu Jun 14 09:54:43 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:54:45 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:54:47 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:54:50 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:54:52 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:54:54 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:54:56 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:54:58 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:55:00 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:55:02 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:55:04 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:55:06 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:55:08 EDT 2007 ( server 33 tomcat1181829221515 = 3 ) Thu Jun 14 09:55:10 EDT 2007 ( server 33 tomcat1181829221515 = 2 ) Thu Jun 14 09:55:12 EDT 2007 ( server 33 tomcat1181829221515 = 2 ) Thu Jun 14 09:55:14 EDT 2007 ( server 33 tomcat1181829221515 = 1 ) Thu Jun 14 09:55:16 EDT 2007 ( server 33 tomcat1181829221515 = 1 ) Thu Jun 14 09:55:18 EDT 2007 ( server 33 tomcat1181829221515 = 1 )
The above example illustrates the format of the output.
Using the COSMOS Web User Interface
Once you have successfully installed the COSMOS Management Domain, Broker and Data Managers as described above, you can use the COSMOS Web User application to interact with your Data Managers.
To setup the COSMOS Web User application:
- If necessary, set the Management Domain EPR in the COSMOS Web User application deployment descriptor file (<tomcat-install-dir>\webapps\COSMOSUI\WEB-INF\web.xml)
<context-param> <param-name>MANAGEMENT_DOMAIN_EPR</param-name> <param-value>http://localhost:8080/cosmos/services/domain</param-value> </context-param>
- Point your web browser to http://localhost:8080/COSMOSUI/?page=cosmos
You can right-click on the Example and SML MDR data managers and choose the "submit query" menu to execute queries. Paste the query from the above file and press submit:
You can expand the query result:

