WASdev/sample.metrics

Name: sample.metrics

Owner: WASdev

Description: A simple sample of how to add metrics to your Liberty apps and visualize them in Grafana.

Created: 2017-06-15 16:30:00.0

Updated: 2017-06-20 20:52:08.0

Pushed: 2017-08-02 09:59:40.0

Homepage: null

Size: 72436

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Metrics Sample

This project contains a simple Servlet application that has been customised to emit metrics from the WebSphere Liberty server and the app using the Dropwizard Metrics API. The sample also demonstrates (using Docker containers) how to monitor your Liberty metrics using collectd, Graphite, and Grafana.

The instructions below are minimal so that you can just get the sample running. For more detail and for instructions on how to add metrics to a servlet application, check out this article on WASdev.net.

Running with Maven

To run the entire demonstration:

  1. Make sure you have installed Java 8, Docker, and Maven.
  2. Clone this repository to your local harddrive:
    clone https://github.com/WASdev/sample.metrics.git
    
  3. Change to the sample.metrics directory:
    ample.metrics
    
  4. Build the sample:
    clean install
    
  5. Build the Liberty Docker image:
    er build -t example:liberty .
    
  6. Run the Liberty Docker image:
    er run --name liberty -d -p 9080:9080 -p 9443:9443 example:liberty
    
  7. Check that the application is running in a browser at http://localhost:9080/MetricsExample
  8. Change to the collectd directory:
    ollectd
    
  9. Change the permissions on the bash script in the directory then run the script:
    d 755 collectd_graphite_setup.sh
    llectd_graphite_setup.sh
    
    (This copies some files collectd needs from the running Liberty container, builds a collectd Docker image, runs a Graphite Docker container from DockerHub, and runs the collectd Docker container.
  10. Check that the Graphite application is running and displaying metrics in a browser at http://localhost:80
  11. If you want to display the metrics in Grafana:
    er run -i --name grafana -d -p 3000:3000 --link graphite grafana/grafana
    
  12. Open Grafana in a browser: http://localhost:3000
  13. Add the Graphite server as a data source in Grafana and then import the provided dashboard from sample.metrics/grafana/MetricsSampleDashboard.json.

Notice

© Copyright IBM Corporation 2017.

License

nsed under the Apache License, Version 2.0 (the "License");
may not use this file except in compliance with the License.
may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

ss required by applicable law or agreed to in writing, software
ributed under the License is distributed on an "AS IS" BASIS,
OUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
the License for the specific language governing permissions and
tations under the License.

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.