Monitor Spring Boot Apps using Prometheus on Kubernetes , not setting end Points

5/28/2019

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.

targets in promethus

service-discovery in promethus

Thank You.

-- Kasun Palihakkara
grafana
kubernetes
kubernetes-helm
prometheus
spring-boot-actuator

1 Answer

5/29/2019

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 and exclude 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. The exclude property lists the IDs of the endpoints that should not be exposed. The excludeproperty takes precedence over the include property. Both include and exclude properties can be configured with a list of endpoint IDs.

For example, to stop exposing all endpoints over JMX and only expose the health and info 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 the env and beans endpoints, use the following properties:

management.endpoints.web.exposure.include=* management.endpoints.web.exposure.exclude=env,beans

-- Crou
Source: StackOverflow