Questo contenuto non è disponibile nella lingua selezionata.
Chapter 2. Installing HawtIO
There are several options to start using the HawtIO console:
2.1. Adding Red Hat repositories to Maven Copia collegamentoCollegamento copiato negli appunti!
To access artifacts that are in Red Hat Maven repositories, you need to add those repositories to Maven’s settings.xml
file. Maven looks for the settings.xml
file in the .m2
directory of the user’s home directory. If there is not a user specified settings.xml
file, Maven uses the system-level settings.xml
file at M2_HOME/conf/settings.xml
.
Prerequisite:
You know the location of the settings.xml
file in which you want to add the Red Hat repositories.
Procedure:
In the
settings.xml
file, addrepository
elements for the Red Hat repositories as shown in this example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.2. Running from CLI (JBang) Copia collegamentoCollegamento copiato negli appunti!
You can install and run HawtIO from CLI using JBang.
If you don’t have JBang locally yet, first install it: https://www.jbang.dev/download/
Procedure:
Install the latest HawtIO on your machine using the
jbang
command:jbang app install -Dhawtio.jbang.version=4.0.0.redhat-00040 hawtio@hawtio/hawtio
$ jbang app install -Dhawtio.jbang.version=4.0.0.redhat-00040 hawtio@hawtio/hawtio
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThis installation method is available only with jbang>=0.115.0.
It will install the HawtIO command. Launch a HawtIO instance with the following command:
hawtio
$ hawtio
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The command will automatically open the console at http://0.0.0.0:8080/hawtio/. To change the port number, run the following command:
hawtio --port 8090
$ hawtio --port 8090
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information on the configuration options of the CLI, run the following code:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.3. Running a Quarkus app Copia collegamentoCollegamento copiato negli appunti!
You can attach HawtIO to your Quarkus application in a single step.
Procedure:
Add
io.hawt:hawtio-quarkus
and the supporting Camel Quarkus extensions to the dependencies inpom.xml
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run HawtIO with your Quarkus application in development mode as follows:
mvn compile quarkus:dev
mvn compile quarkus:dev
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Open http://localhost:8080/hawtio to view the HawtIO console.
2.4. Running a Spring Boot app Copia collegamentoCollegamento copiato negli appunti!
You can attach HawtIO to your Spring Boot application in two steps.
Procedure:
Add
io.hawt:hawtio-springboot
and the supporting Camel Spring Boot starters to the dependencies inpom.xml
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the HawtIO and Jolokia endpoints by adding the following lines to
application.properties
:spring.jmx.enabled = true management.endpoints.web.exposure.include = hawtio,jolokia
spring.jmx.enabled = true management.endpoints.web.exposure.include = hawtio,jolokia
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run HawtIO with your Spring Boot application in development mode as follows:
mvn spring-boot:run
mvn spring-boot:run
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Open http://localhost:8080/actuator/hawtio to view the HawtIO console.
2.4.1. Configuring HawtIO path Copia collegamentoCollegamento copiato negli appunti!
If you don’t prefer to have the /actuator
base path for the HawtIO endpoint, you can also execute the following:
Customize the Spring Boot management base path with the
management.endpoints.web.base-path
property:management.endpoints.web.base-path = /
management.endpoints.web.base-path = /
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can also customize the path to the HawtIO endpoint by setting the
management.endpoints.web.path-mapping.hawtio
property:management.endpoints.web.path-mapping.hawtio = hawtio/console
management.endpoints.web.path-mapping.hawtio = hawtio/console
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example:
- There is a working Spring Boot example that shows how to monitor a web application that exposes information about Apache Camel routes, metrics, etc. with HawtIO Spring Boot example.
-
A good MBean for real-time values and charts is
java.lang/OperatingSystem
. Try looking at Camel routes. Notice that as you change selections in the tree the list of tabs available changes dynamically based on the content.