This blog will cover
- What is APM
- Glowroot – Overview
- Configuration – Embedded Collector
- Persistence Option with Docker – Central Collector
What is APM?
- In production environment its important to keep an eye on the resource consumption.
- This is where various monitoring tools comes in.
- When it come to Java there are various open source monitoring tools.
- One of which is Glowroot.
- I personally like this one because of its simplicity and ease to configure.
- 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.
Configuration – Embedded Collector
- Download Glowroot src from above link and extract.
- Folder with name glowroot will contains all dependencies to configure and run.
- In your application you need to add following lines -javaagent:path/to/glowroot.jar in JVM args.
- If you are using Apache Tomcat in Eclipse keep on going.
- Don’t worry if you are using other server just refer this link
Apache Tomcat in Eclipse
- Open Servers Tab
- Double click on Tomcat Server or you can right click server and select Open
- Apache configuration will showup.
- Click on Open Launch Congratulation under General Information. 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 for Central Collector. I recently tried out this in docker and its just 2 command to setup Collector.
- Once done. Your collector is ready to work at dockerip:8181
- Now we need to to send data to this collector.
- Steps are same as described in Embedded Collector.
- Except 1 additional step.
- We will have to add glowroot.properties file in glowroot folder(where your glowroot jar is) with this data
- 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 properiy file.