This blog will cover

  • What is APM
  • Glowroot – Overview
  • Configuration – Embedded Collector
  • Persistence Option with Docker – Central Collector
What is APM?
  • In a production environment, it’s important to keep an eye on resource consumption.
  • This is where various monitoring tools come in.
  • When it comes to Java there are various open-source monitoring tools.
  • One of which is Glowroot.
  • I personally like Glowroot because of its simplicity and ease to configure.
Glowroot
  • Glowroot is open-source Java APM.
  • Read more detail here
  • Live Demo to see how it works and decide if it useful for your Application.
Download src
Configuration – Embedded Collector
  • Download Glowroot src from the above link and extract.
  • Folder with name glowroot will contains all dependencies to configure and run.
  • In your application, you need to add the following lines -javaagent:path/to/glowroot.jar in JVM args.
  • If you are using Apache Tomcat in Eclipse keep ongoing.
  • Don’t worry if you are using other servers just refer this link
Apache Tomcat in Eclipse
  • Open Servers Tab
  • Double click on Tomcat Server or you can right-click the server and select Open
  • Apache configuration will show up.
  • Click on Open Launch Congratulation under General Information. a window will pop up.
  • In that go to Arguments and add lines at last in VM argument
  • like this -javaagent:/home/username/Documents/glowroot/glowroot.jar
  • Refer below image

Note: This Embedded Collector’s data will not be persisted. So if Application stops, all data is lost.

Persistence Option with Docker – Central Collector
  • If you want data to be persisted.
  • You can go to Central Collector. I recently tried out this in docker and its just 2 commands to setup Collector.
docker run --name mycassandra -d cassandra

docker run --name myglowroot \
--link mycassandra:cassandra \
--publish 0.0.0.0:4000:4000 \
--publish 0.0.0.0:8181:8181 \
glowroot/glowroot-central:0.10.12
  • Once done. Your collector is ready to work at dockerip:8181
  • Now we need to to send data to this collector.
  • Steps are the same as described in Embedded Collector.
  • Except for 1 additional step.
  • We will have to add glowroot.properties file in glowroot folder(where your glowroot jar is) with this data
agent.id=Docker
collector.address=http://localhost:8181
  • Now you will have all your data persisted in Cassandra DB.

Note: By adding glowroot.properties you are telling to run central Collector instead of Embedded. So to run Embedded yo just need to delete this property file.

Useful link for other options


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *