A demo of using JMX, Spring, and Dash to build an application monitoring dashboard.
- Git
- Maven (comes with many Java IDEs)
- Java 8 SDK
- Create a Dash account. Note that the Push to Dash widgets require a Dash Pro or Dash Business account. A similar effect can be gained by creating REST endpoints similar to those in
TomcatStatsController.java
and using Fetch from URL widgets instead.
- Clone the dash-lightning repository on GitHub:
git clone [email protected]:jerryorr/dash-lightning.git
- Create a new Dash dashboard.
- Create the following widgets in your Dash dashboard:
- Custom > Fetch from URL > Custom Speedometer and name it Memory Usage. For Data URL, enter
http://[your public IP]:8080/stats/memory/speedometer
. You can get your public IP by searching google for "my ip address". You may need to set up port forwarding and open up your firewall, depending on your network/router settings. - Custom > Push to Dash > Basic Value (requires Dash Pro or Business account) and name it Active Sessions. Note the Push URL for later.
- Custom > Push to Dash > Custom Chart (requires Dash Pro or Business account) and name it whatever you want. Note the Push URL for later.
- Custom > Fetch from URL > Custom Speedometer and name it Memory Usage. For Data URL, enter
- Open
src/main/resources/application.properties
and enter the appropriate Push URL above fordash.chart
anddash.sessions
. Alternatively, set them as environment variablesDASH_CHART_URL
andDASH_SESSIONS_URL
. - In the root
dash-lightning
directory, runmvn spring-boot:run
. - Open http://localhost:8080/chart and play with the buttons.
- Check out your dashboard and see the magic! The Memory Usage widget will update every 30 seconds, the Active Sessions and chart widgets will update immediately.