COSMOSEnd2EndSample
From Eclipsepedia
| |
The COSMOS end-to-end scenario demonstrates the configuration of data collection assemblies that collect data from 3 different data sources, and write data to a relational database. The data collected can be then be viewed in reports provided by a web application.
Contents |
System installation and setup
Installing and Configuring Data Visualization Web Application
- Download Tomcat 5.5.23 (http://tomcat.apache.org/). Unzip the driver to the C: drive.
- From http://www.eclipse.org/cosmos/downloads/, select the latest stable build. On the download page of the build, download the zip file labeled "Data Reporting Web Application".
- Unzip this zip file to C:\apache-tomcat-5.5.23\webapps
- Download dojo 0.9. Unzip the files to "C:\apache-tomcat-5.5.23\webapps\COSMOSUI" directory. Rename the dojo-0.9.0beta directory to dojo.
- Edit the catalina.properties under C:\apache-tomcat-5.5.23\conf to point to the database. Add the following line:
derby.system.home=C:/apache-tomcat-5.5.23/webapps/database
Notes:
- The above path must be an absolute path. Do not use ${catalina.home} when specifying the derby.system.home path.
- In the case of the sample COSMOS database, the path must point to the directory containing cosmosdb, and should not end in cosmosdb itself.
- Use forward slashes in the path.
- Use Sun JRE 1.5.0. (This web application doesn't work with IBM JRE.)
Installing and Configuring Data Collection
Download Build and Dependencies
- Follow steps in Download Dependencies section of the Data Collector Environment wiki to get dependencies required to run data collection framework.
- Download the data collection build from the COSMOS download page, and unzip it to the eclipse install directory.
Configure OSGi Environment
To construct a runtime/debug configuration, create a new OSGi Framework configuration, and "Deselect All" of the bundles in the configuration. Select all org.eclipse.cosmos.dc.* and org.eclipse.cosmos.tptp.* bundles. Then press "Add Required Bundles". You'll need to manually add the following from the "Target Platform" list:
javax.mail.api, javax.saaj.api, muse.osgi.soa.mini, org.apache.commons.httpclient, org.apache.commons.logging(1.0.4), org.eclipse.equinox.ds, org.eclipse.equinox.http.jetty, org.eclipse.equinox.log, org.apache.derby
Press "Add Required Bundles", then click "Apply" again,
and you should have an working OSGi configuration for running data collection.
Configure the following VM arguments for setting your preferred Http port and database location:
-Dorg.osgi.service.http.port=8080 -Dderby.system.home=<location of database>
Replace <location of database> with the path to the database directory. A sample database is packaged as part of the data reporting web application. For example: C:\apache-tomcat-5.5.23\webapps\database.
Apache/Tomcat Access Logs
Change to <eclipse_home>\plugins\org.eclipse.cosmos.dc.sample.configurations_1.0.0\META-INF\cosmos, update CBEPersistor.xml to point to a apache/Tomcat accesslog.
<pu:Property propertyName="directory" propertyValue="_____"/> <pu:Property propertyName="fileName" propertyValue="_____"/>
By default, access log is disabled in Tomcat. To generate access logs, edit server.xml in the conf directory of the Tomcat server, and uncomment the following section.
<!--
<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
Alternatively, you can download a sample access log file here.
Windows Applications Log
In WindowsAppLog.xml, update the Sensor section. Change the values of directory and converter to point to the EventLogReader.exe program, which is packaged in the org.eclipse.cosmos.tptp.dependencies module. Replace <path> with the path to the org.eclipse.cosmos.tptp.dependencies module.
<cc:Sensor ...> <pu:Property propertyName="directory" propertyValue="<path>\org.eclipse.cosmos.tptp.dependencies"/> <pu:Property propertyName="fileName" propertyValue="error.log"/> <pu:Property propertyName="converter" propertyValue="<path>\org.eclipse.cosmos.tptp.dependencies\EventLogReader.exe" application <path>\org.eclipse.cosmos.tptp.dependencies\error.log"/> </cc:Sensor>
Tomcat JMX Statistical Data
In TomcatJMXCollector.xml, make sure the HTTP port is correct.
<sample:mbean domain="Catalina" <sample:attribute name="currentThreadsBusy"/> <sample:attribute name="currentThreadCount"/> </sample:mbean>
If you are using port 8080, you need to change the keys attribute to:
keys="type=ThreadPool,name=http-8080"
Running the sample
Viewing reports from Sample database and Data Center SML
- Start Tomcat server by running <server_home>\bin\startup.bat. Note: this .bat file is only available if you did not install Tomcat as a "service". If you did, then you have to (stop and re-)start the Tomcat system service instead.
- Open IE 6.0 or Mozilla Firefox 1.5 browser and point to http://localhost:8080/COSMOSUI/index.jsp?view=cosmos.
- Use the navigation on the left to explore the properties and reports of the managed resources. The data comes from some SML documents packaged with the web application and the COSMOS database.
- Stop the Tomcat server by running <server_home>\bin\shutdown.bat.
Collecting CBE Data from Apache/Tomcat Access Log
1. Start the OSGi runtime environment that you created in the Configure OSGi Environment section above within eclipse.
2. At osgi prompt, load CBE assembly configurations:
osgi> dc load CBEPersistor.xml
3. Activate data collection:
osgi> dc activate CBEPersistor
This command will parse the log file specified in CBEPersistor.xml and write the CBE events into the COSMOS database.
Collecting CBE Data from Windows Application Log
1. Start the OSGi runtime environment that you created in the Configure OSGi Environment section above within Eclipse, if not already started.
2. At osgi prompt, load CBE assembly configurations:
osgi> dc load WindowsAppLog.xml
3. Activate data collection:
osgi> dc activate WindowsAppLog
This command will read the Windows Application Log and write the CBE events into the COSMOS database.
Collecting Tomcat Statistical Data
In order to collect JMX data from a Tomcat instance using the COSMOS DataCollection engine, the Tomcat instance must first enable remote JMX access. This can be done as follows:
In a command shell, set a JAVA_OPTS environment variable to have the following definitions:
set JAVA_OPTS=-Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
Start Tomcat in this shell. The Tomcat startup script will append these JAVA_OPTS to the startup command line. The tomcat will now support JMX access via port 9999.
If you have TPTP MAX installed, you can verify your Tomcat instrumentation by creating a managed JMX agent using the profiling support provided by TPTP. Click on the image below to see an example of a configured JMX agent for exploring the root of the tomcat JMX server.
If you don't have MAX installed, you can perform a netstat -a to verify that JMX has bound to port 9999, as follows:
C:\>netstat -a Active Connections TCP DTW30657N2:8009 DTW30657N2.clients.nasa.cpwr.corp:0 LISTENING TCP DTW30657N2:8888 DTW30657N2.clients.nasa.cpwr.corp:0 LISTENING TCP DTW30657N2:9999 DTW30657N2.clients.nasa.cpwr.corp:0 LISTENING
At the OSGi prompt, load the Tomcat statistical data assembly by typing:
osgi> dc load TomcatJMXCollector.xml
Activate data collection:
osgi> dc activate TomcatJMXSample
Stop the collection by:
osgi> dc deactivate TomcatJMXSample
Exit the OSGi environment by typing
osgi> exit
at the OSGi prompt.
View Reports on Latest Datasets
To view the data you just collected in the previous section, browse to the report webpage again at http://localhost:8080/COSMOSUI/index.jsp?view=cosmos. You should see the latest data sets in the statistical report and the log report of the operating system.