I am Trying to monitor Spring Boot application using Prometheus on Kubernetes. Promethus was insatll using Helm and I am using Spring Boot Actuator for Health checking, Auditing, Metrics gathering and Monitoring.
Actuator gives details about application. For example
http://**IP:Port**/actuator/health
return below output
{"status":"UP"}.
I use below configuration file to add the application end point in promethus.
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: scp-service-creator
namespace: sc678
labels:
app: scp-service-creator
release: prometheus-operator
spec:
selector:
matchLabels:
app: scp-service-creator
endpoints:
- port: api
path: "/actuator/prometheus"
scheme: http
interval: 10s
honorLabels: true
So my problem is even service is added to prometheus , no endpoint is assigned. So What would be wrong here. Really appreciate your help.
Thank You.
From the Spring Boot Actuator documentation, to be more specific the Endpoints part. One can read that Endpoints are enabled be default except Shutdown
which is disabled, but only health
and info
are exposed.
This can be checked here.
You need to expose the Endpoint you want manually.
The Endpoint you want to use which is Prometheus
is Not Available for JMX and is disabled for Web.
To change which endpoints are exposed, use the following technology-specific
include
andexclude
properties:Property | Default
management.endpoints.jmx.exposure.exclude
|
management.endpoints.jmx.exposure.include
| *
management.endpoints.web.exposure.exclude
|
management.endpoints.web.exposure.include
|info, health
The
include
property lists the IDs of the endpoints that are exposed. Theexclude
property lists the IDs of the endpoints that should not be exposed. Theexclude
property takes precedence over theinclude
property. Bothinclude
andexclude
properties can be configured with a list of endpoint IDs.For example, to stop exposing all endpoints over JMX and only expose the
health
andinfo
endpoints, use the following property:
management.endpoints.jmx.exposure.include=health,info
*
can be used to select all endpoints. For example, to expose everything over HTTP except theenv
andbeans
endpoints, use the following properties:
management.endpoints.web.exposure.include=*
management.endpoints.web.exposure.exclude=env,beans