-
Notifications
You must be signed in to change notification settings - Fork 1
Monitoring Java Spring Boot Applications
Netdata can be used to monitor running Java Spring Boot applications that expose their metrics with the use of the Spring Boot Actuator included in Spring Boot library.
The Spring Boot Actuator exposes these metrics over HTTP and is very easy to use:
- add
org.springframework.boot:spring-boot-starter-actuatorto your application dependencies - set
endpoints.metrics.sensitive=falsein yourapplication.properties
You can create custom Metrics by add and inject a PublicMetrics in your application. This is a example to add custom metrics:
package com.example;
import org.springframework.boot.actuate.endpoint.PublicMetrics;
import org.springframework.boot.actuate.metrics.Metric;
import org.springframework.stereotype.Service;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryPoolMXBean;
import java.util.ArrayList;
import java.util.Collection;
@Service
public class HeapPoolMetrics implements PublicMetrics {
private static final String PREFIX = "mempool.";
private static final String KEY_EDEN = PREFIX + "eden";
private static final String KEY_SURVIVOR = PREFIX + "survivor";
private static final String KEY_TENURED = PREFIX + "tenured";
@Override
public Collection<Metric<?>> metrics() {
Collection<Metric<?>> result = new ArrayList<>(4);
for (MemoryPoolMXBean mem : ManagementFactory.getMemoryPoolMXBeans()) {
String poolName = mem.getName();
String name = null;
if (poolName.indexOf("Eden Space") != -1) {
name = KEY_EDEN;
} else if (poolName.indexOf("Survivor Space") != -1) {
name = KEY_SURVIVOR;
} else if (poolName.indexOf("Tenured Gen") != -1 || poolName.indexOf("Old Gen") != -1) {
name = KEY_TENURED;
}
if (name != null) {
result.add(newMemoryMetric(name, mem.getUsage().getMax()));
result.add(newMemoryMetric(name + ".init", mem.getUsage().getInit()));
result.add(newMemoryMetric(name + ".committed", mem.getUsage().getCommitted()));
result.add(newMemoryMetric(name + ".used", mem.getUsage().getUsed()));
}
}
return result;
}
private Metric<Long> newMemoryMetric(String name, long bytes) {
return new Metric<>(name, bytes / 1024);
}
}Please refer Spring Boot Actuator: Production-ready features and 81. Actuator - Part IX. ‘How-to’ guides for more information.
The springboot module is enabled by default. It looks up http://localhost:8080/metrics and http://127.0.0.1:8080/metrics to detect Spring Boot application by default. You can change it by editing /etc/netdata/python.d/springboot.conf (to edit it on your system run /etc/netdata/edit-config python.d/springboot.conf).
This module defines some common charts, and you can add custom charts by change the configurations.
The configuration format is like:
<id>:
name: '<name>'
url: '<metrics endpoint>' # ex. http://localhost:8080/metrics
user: '<username>' # optional
pass: '<password>' # optional
defaults:
[<chart-id>]: true|false
extras:
- id: '<chart-id>'
options:
title: '***'
units: '***'
family: '***'
context: 'springboot.***'
charttype: 'stacked' | 'area' | 'line'
lines:
- { dimension: 'myapp_ok', name: 'ok', algorithm: 'absolute', multiplier: 1, divisor: 1} # it shows "myapp.ok" metrics
- { dimension: 'myapp_ng', name: 'ng', algorithm: 'absolute', multiplier: 1, divisor: 1} # it shows "myapp.ng" metricsBy default, it creates response_code, threads, gc_time, gc_ope abd heap charts.
You can disable the default charts by set defaults.<chart-id>: false.
The dimension name of extras charts should replace . to _.
Please check springboot.conf for more examples.
General
- Home
- Why netdata
- Installation
- Installation with docker
- Command Line Options
- Configuration
- Log Files
- Tracing Options
Running Netdata
Special Uses
-
netdata for IoT
lower netdata resource utilization -
high performance netdata
netdata public on the internet
Notes on memory management
-
Memory deduplication
half netdata memory requirements - netdata virtual memory size
Database Replication and Mirroring
- Replication Overview
-
monitoring ephemeral nodes
Use netdata to monitor auto-scaled cloud servers. -
netdata proxies
Streaming netdata metrics between netdata servers.
Backends
archiving netdata collected metrics to a time-series database
-
netdata-backends
graphite,opentsdb,kairosdb,influxdb,elasticsearch,blueflood - netdata with prometheus
- Walk Through: netdata with prometheus and grafana
Health monitoring - Alarms
alarms and alarm notifications in netdata
- Overview
-
Reference
reference for writing alarms -
Examples
simple how-to for writing alarms -
Notifications Configuration
- health API calls
- troubleshooting alarms
Netdata Registry
Monitoring Info
-
Monitoring web servers
The spectacles of a web server log file -
monitoring ephemeral containers
Use netdata to monitor auto-scaled containers. - monitoring systemd services
-
monitoring cgroups
Use netdata to monitor containers and virtual machines. -
monitoring IPMI
Use netdata to monitor enterprise server hardware - Monitoring disks
- Monitoring Go Applications
Netdata Badges
Data Collection
- Add more charts to netdata
- Internal Plugins
- External Plugins
-
statsd
netdata is a fully featured statsd server -
Third Party Plugins
netdata plugins distributed by third parties
Binary Modules
Python Modules
- How to write new module
- apache
- beanstalk
- bind_rndc
- ceph
- couchdb
- cpuidle
- cpufreq
- dns_query_time
- dovecot
- elasticsearch
- exim
- fail2ban
- freeradius
- go_expvar
- haproxy
- hddtemp
- httpcheck
- icecast
- ipfs
- isc_dhcpd
- litespeed
- mdstat
- megacli
- memcached
- mongodb
- mysql
- nginx
- nginx_plus
- nsd
- ntpd
- ovpn_status_log
- phpfpm
- portcheck
- postfix
- postgres
- powerdns
- puppet
- rabbitmq
- redis
- rethinkdbs
- retroshare
- sensors
- spigotmc
- springboot
- squid
- smartd_log
- tomcat
- traefik
- unbound
- varnish
- w1sensor
- web_log
Node.js Modules
BASH Modules
Active BASH Modules
Obsolete BASH Modules
- apache
- cpufreq
- cpu_apps
- exim
- hddtemp
- load_average
- mem_apps
- mysql
- nginx
- phpfpm
- postfix
- sensors
- squid
- tomcat
API Documentation
Web Dashboards
-
Learn how to create dashboards with charts from one or more netdata servers!
Running behind another web server
Package Maintainers
Donations
Blog
-
December, 2016
Linux console tools, fail to report per process CPU usage properly
-
April, 2016
You should install QoS on all your servers (Linux QoS for humans)
Monitor application bandwidth with Linux QoS (Good to do it, anyway)
Monitoring SYNPROXY (Linux TCP Anti-DDoS)
-
March, 2016
Article: Introducing netdata (the design principles of netdata)