官方URL:http://sirona.incubator.apache.org/quick-start.html
Quick Start
How to enable Apache Sirona in your web application.
NOTE: this simple configuration save figures in memory (so no more after restart!!)
If you want to store datas, you must have a look at the Cassandra Storage.
Declare version
- <properties>
- <sirona.version>0.2-incubating</sirona.version>
- </properties>
- <dependencies>
- ....
- <!-- sirona dependencies -->
- <dependency>
- <groupId>org.apache.sirona</groupId>
- <artifactId>sirona-core</artifactId>
- <version>${sirona.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.sirona</groupId>
- <artifactId>sirona-reporting</artifactId>
- <version>${sirona.version}</version>
- <classifier>classes</classifier>
- </dependency>
- ...
- </dependencies>
Configuration
If you are using a servlet 3.0 container nothing to do as we use ServletContainerInitializer mechanism. Otherwise you need to configure the filter class org.apache.sirona.reporting.web.SironaController .
In web.xml
- <!-- activated per default -->
- <context-param>
- <param-name>org.apache.sirona.reporting.activated</param-name>
- <param-value>true</param-value>
- </context-param>
- <!-- path in the application default is /sirona -->
- <context-param>
- <param-name>org.apache.sirona.reporting.mapping</param-name>
- <param-value>/monitoring</param-value>
- </context-param>
Using
Just start your application and now browse /sirona (or the path you configured) and have fun (or not).
NOTE: the configuration include only basic collectors. If you need more figures you need to add more dependencies
Web figures
To collect various web informations as:
- response time per http return code
- hits, response time etc.. per http path
- number of active sessions
- etc.. see Web plugin.
Simply add the dependency:
- <dependencies>
- ....
- <dependency>
- <groupId>org.apache.sirona</groupId>
- <artifactId>sirona-web</artifactId>
- <version>${sirona.version}</version>
- </dependency>
- ...
- </dependencies>
JDBC
To collect response time for jdbc queries.
Add the dependency:
- <dependencies>
- ....
- <dependency>
- <groupId>org.apache.sirona</groupId>
- <artifactId>sirona-jdbc</artifactId>
- <version>${sirona.version}</version>
- </dependency>
- ...
- </dependencies>
Configure the jdbc driver now
Normal configuration:
- driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
- url="jdbc:derby:${appserver.base}/database/users;create=true"
Sirona configuration:
- driverClassName="org.apache.sirona.jdbc.SironaDriver"
- url="jdbc:sirona:derby:${appserver.base}/database/users;create=true?delegateDriver=org.apache.derby.jdbc.EmbeddedDriver"