47

I am able to access endpoints like http://localhost:8081/health, /status, /env, /metrics, /shutdown but not /actuator or /loginfo endpoints.

Getting below exception.

{"timestamp":1455929182552,"status":404,"error":"Not Found","message":"No message available","path":"/actuator"}

How to acccess http://localhost:8081/actuator endpoint?

Roman Cherepanov
  • 1,639
  • 2
  • 24
  • 44
grkhyd
  • 473
  • 1
  • 5
  • 6

21 Answers21

54

As of spring boot version 2.0.1 using below property would work

management.endpoints.web.exposure.include=<comma separated endpoints you wish to expose>

You can use * wildcard to expose all actuator endpoints over the web if security isn't your concern.

Also endpoints seems to have moved from previous versions. For ex. if you wish to use beans, you would now have /actuator/beans endpoint.

Just to be sure look at startup logs for such endpoints.

More on endpoints can be found here

Algirdas
  • 677
  • 1
  • 6
  • 15
Shanu Gupta
  • 3,699
  • 2
  • 19
  • 29
  • 1
    Make sure to include the dependency spring-boot-actuator-autoconfigure – tiktock Apr 30 '19 at 21:59
  • When using application.yml instead of application.properties I could not get * to work so I had to list out the various endpoints (available from the link). Thanks. management: endpoints: web: exposure: include: beans,env,health,info – pamcevoy Jun 21 '20 at 23:25
20

If you type http://localhost:8080/actuator/ yo'll get the list of endpoints that has been exposed by default (3 endpoint) so in order to expose all your endpoint what you have to add in your application.properties/yml file:

management.endpoints.web.exposure.include=*
BERGUIGA Mohamed Amine
  • 6,094
  • 3
  • 40
  • 38
13

It looks like you mapped your Actuator endpoints to the base path /. Check if you have the following line in your configuration:

management.endpoints.web.base-path=/

So, if you omit this line, then you will access all endpoints under actuator path, e.g.:

http://localhost:8081/actuator/health

and the actuator itself will become accessible here:

http://localhost:8081/actuator
xuesheng
  • 3,396
  • 2
  • 29
  • 38
9

i was facing same problem, after spending hours, could resolve. first thing we need to set below property to *

management.endpoints.web.exposure.include=*
management.endpoints.enabled-by-default=false

and we need to provide the below property port, instead on server.port in the URL.

management.server.port=9000

example:

http://localhost:9000/actuator/loggers/{package}
http://localhost:9000/actuator/health

This is tried in a micro-service with spring boot 2.1.13, with below properties and worked fine.

management.endpoints.web.exposure.include=*
management.endpoint.loggers.enabled=true
management.endpoint.restart.enabled=true
management.endpoint.refresh.enabled=true
management.endpoint.health.enabled=true
management.security.enabled=false
management.health.db.enabled=true
management.health.diskspace.enabled=true
Sharan
  • 253
  • 4
  • 14
7

as of springboot 2.0.5.RELEASE the health check endpoint is http://hostname:portnumber/applicationroot/actuator/health

also check if you have added the dependency

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
Mohammed Rafeeq
  • 2,586
  • 25
  • 26
5

Actuator endpoints moved in Spring Boot 2.0.0, so you need to check /application/health.

Gradle:

compile('org.springframework.boot:spring-boot-starter-actuator')
springBootVersion = '2.0.0.M3'*

Edit the build.gradle file and change the Boot version to 1.5.4.RELEASE. Run the app.

curl -i localhost:8080/health

HTTP/1.1 200
X-Application-Context: application
Content-Type: application/vnd.spring-boot.actuator.v1+json;charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 14 Jun 2017 20:45:51 GMT

{"status":"UP"}
Honza Zidek
  • 9,204
  • 4
  • 72
  • 118
Kumar Abhishek
  • 3,004
  • 33
  • 29
5

I got a pretty descriptive message

2017-11-09 23:27:14.572  INFO 30483 --- [nio-8080-exec-2] s.b.a.e.m.MvcEndpointSecurityInterceptor : Full authentication is required to access actuator endpoints. Consider adding Spring Security or set 'management.security.enabled' to false.

So I put the property in the applicaiton.properties

management.security.enabled=false 

And it will worked.

UPDATE: management.security.enabled is now deprecated in spring boot 2, thanks @Abdelghani Roussi

Adelin
  • 18,144
  • 26
  • 115
  • 175
4

Base on @Vinod's answer, I add application.yml content.
For spring boot 2.1.0 please add below property value in application.yml file.

management:
  endpoints:
    web:
      exposure:
        include: '*'
  endpoint:
    health:
      show-details: always
    beans:
      enabled: true

Access below url from your local system[either browser or postman] from where you are running a application.

http://localhost:8080/actuator/metrics
http://localhost:8080/actuator/health
http://localhost:8080/actuator/beans

More endpoint, see the link:
Part V. Spring Boot Actuator: Production-ready features

Zgpeace
  • 3,927
  • 33
  • 31
3

check https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#base-path

change the application.properties fle for this would allow you use http://localhost:8080/beans (or /health , /env )

server.port=8080
management.endpoints.web.base-path=/
management.endpoints.web.exposure.include=*
3
For spring boot 2.x.x please add below property value in application.property file.

management.endpoint.health.show-details=ALWAYS
management.endpoints.web.exposure.include=*
management.endpoint.beans.enabled=true

Access below url from your local system[either browser or postman] from where you are running a application.

http://localhost:8080/actuator/metrics
http://localhost:8080/actuator/health
http://localhost:8080/actuator/beans
Vinod
  • 81
  • 3
3

health check endpoint as of Spring Boot 2.1.5.RELEASE

http://localhost:8080/actuator/health

check if you have added the dependency

 <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
 </dependency>

check if you have added the application.properties

management.endpoints.web.exposure.include = *

3

I had display issue with http://localhost:8080/actuator/ and got resolved by adding hal-explorer dependency. Please make sure to have below 2 dependencies in your pom.xml to display correct content for actuator.

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-rest-hal-explorer</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

Also check below properties in your application.properties

management.endpoints.web.exposure.include=*
#management.endpoints.enabled-by-default=false
#management.endpoints.web.base-path=/
borkarda
  • 95
  • 1
  • 8
  • I tried everything until found your message but no one add this dependency on the pom file to see actuator results. Interesting... – hepcocukkalan Sep 28 '22 at 19:32
2

Make sure that those 'sensitive' endpoints are enabled. This doc describes how to enable all sensitive endpoints or individual ones. It sounds like you have certain sensitive endpoints enabled (like shutdown) but not others (like actuator).

To enable all sensitive endpoints:

endpoints.sensitive=true

To enable actuator and logfile individually:

endpoints.actuator.enabled=true
endpoints.logfile.enabled=true
zappcity
  • 66
  • 2
  • I already have them in my properties file `endpoints.beans.id=springbeans endpoints.beans.sensitive=true endpoints.shutdown.enabled=true endpoints.enabled=true endpoints.info.enabled=true endpoints.metrics.id=metrics endpoints.metrics.sensitive=true endpoints.metrics.enabled=true endpoints.actuator.enabled=true endpoints.logfile.enabled=true management.port=8081 management.security.enabled=true management.security.role=SUPERUSER security.user.name=admin security.user.password=secret123 security.require_ssl=false security.basic.enabled=true` – grkhyd Feb 22 '16 at 22:51
  • This is the example i am trying to work on [link](https://github.com/bkielczewski/example-spring-boot-actuator) – grkhyd Feb 23 '16 at 00:16
2

First you should make sure you have the following dependencies in your pom.xml

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>  

Then you should have the following configuration in your application.yml

 management:
      endpoint:
        health:
          enabled: true
          show-details: always
      endpoints:
        web:
          exposure:
            include: '*'
        jmx:
          exposure:
            include: '*'

You can customize the information in the info enpoit with the following configuration inside the application.yml

info:
    app:
        name: @project.name@
        description: @project.description@
        version: @project.version@
        encoding: @project.build.sourceEncoding@
        java:
            version: @java.version@

After That, you can go to the url localhost:8080 and see the list of endpoints as follows:

enter image description here

Hope this answer can help someone

Sergio Sánchez Sánchez
  • 1,694
  • 3
  • 28
  • 48
  • thanks, for me the only way to make it work was to add also the spring-boot-starter-web. Found nowhere else this info :) – Matteo Mar 15 '22 at 16:30
1

spring boot 1.5.6

actuator Provides a hypermedia-based “discovery page” for the other endpoints. Requires Spring HATEOAS to be on the classpath.

please see: https://docs.spring.io/spring-boot/docs/1.5.6.RELEASE/reference/html/production-ready-endpoints.html

zhuguowei
  • 8,401
  • 16
  • 70
  • 106
1

I always prefer to provide context path with the base URL of application. Now to configure actuator we should include below dependency into our pom.xml

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

let it use the default version which is being beared by Spring boot version. Put below properties into your application.properties

server.servlet.contextPath=/<app-name>
server.port=8080

management.endpoint.metrics.enabled=true
management.endpoints.web.exposure.include=*
management.endpoint.prometheus.enabled=true
management.metrics.export.prometheus.enabled=true
management.security.enabled=false
management.health.mongo.enabled=false
management.health.redis.enabled=false
management.health.rabbit.enabled=false
management.endpoint.health.show-details=always

#/metrics endpoint configuration
endpoints.metrics.id=metrics
endpoints.metrics.sensitive=false
endpoints.metrics.enabled=true

#/health endpoint configuration (Comment when you are using customized health check)
endpoints.health.id=health
endpoints.health.sensitive=false
endpoints.health.enabled=true

info.app.name=@project.name@
info.app.description=@project.description@
info.app.version=@project.version@
info.app.encoding=@project.build.sourceEncoding@
info.app.java.version=@java.version@

After above configuration once you start your server , you can easily check the metrics as below http calls-

 # curl http://localhost:8080/myapp/actuator/metrics
 {
  "names": ["jvm.buffer.memory.used", "jvm.gc.memory.allocated", 
  "jvm.memory.committed", "jvm.memory.used", "http.server.requests", 
  "jvm.gc.max.data.size", "logback.events", "system.cpu.count", 
  "jvm.memory.max", "jvm.buffer.total.capacity", "jvm.buffer.count", 
  "process.files.max", "jvm.threads.daemon", "process.start.time", 
  "jvm.gc.live.data.size", "process.files.open", "process.cpu.usage", 
  "process.uptime", "system.load.average.1m", "jvm.gc.pause", 
  "system.cpu.usage", "jvm.threads.live", "jvm.classes.loaded", 
  "jvm.classes.unloaded", "jvm.threads.peak", "jvm.gc.memory.promoted"]
}

For details you can watch my blog here

Bharat
  • 121
  • 1
  • 4
1

For those, who do not use anything in the Spring Boot like I do (I use Spring Integration IP and listen for packets): you still need the following dependency for /actuator to work (regardless of if it'll be running on the server.port or management.server.port):

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

Without this dependency, the actuator will not appear in the startup log at all.

You do not need to use Spring Security though unless you want to secure endpoints.

Sergio Sánchez Sánchez pointed this out in an answer above, but in my opinion it was not clear enough.

Voronin
  • 159
  • 1
  • 7
0

I had the same issue.

  1. Check in your console for errors like "invalid LOC header (bad signature)". Do 'mvn spring-boot:run' to get logs.
    My sprint-boot-starter-actuator was corrupted !

  2. In my case the actuators url are

Hope it helps

Manu
  • 629
  • 7
  • 6
0

I guess there is no endpoint named /loginfo according to the docs

for /actuator endpoint, please see answer on the similar question

haykart
  • 957
  • 5
  • 14
  • 34
0

Here is the application.yml file to change base path to / & disable /info.

management:
  endpoints:
    web:
      base-path: /
  endpoint:
    #Disable /info
    info:
      enabled: false
    health:
      show-details: always
  health:
      defaults:
        enabled: false
Prateek Naik
  • 2,522
  • 4
  • 18
  • 38
PTT
  • 526
  • 7
  • 27
0

You can try the base-path config like this

management:
  endpoints:
    web:
      base-path: /actuator
      exposure:
        include: info, health
Eric Tan
  • 1,377
  • 15
  • 14