JMX Console

API Reference

Access JMX Console's RESTful API to programmatically monitor and manage Java applications. All endpoints require authentication.

Overview

🔐

Authentication

All endpoints require basic authentication using credentials defined in jmxremote.access

🧩

RESTful Design

Standard HTTP methods and resource-based endpoints for CRUD operations on JMX resources.

🚦

Rate Limiting

100 requests per minute per authenticated user. Use tokens for programmatic access.

Authentication

Basic Authentication

curl -u admin:password http://localhost:8080/jmx-console/api/v1/metrics 
                

Token-Based Authentication

Request

POST /auth/token
Content-Type: application/json

{
  "username": "admin",
  "token_request": true
}

Response

{
  "token": "eyJhbGciOiJIUzI1...",
  "valid_for": 3600,
  "scopes": ["read_all", "write_metrics"],
  "issued_at": "2025-09-05T10:30:00Z"
}

Include token in header: Authorization: Bearer eyJhbGciOiJIUzI1...

API Operations

GET /api/v1/metrics/memory

Description

Retrieve current heap and non-heap memory statistics including used, committed, and maximum capacities.

Parameters

  • format - json or xml (default: json)
  • pretty - boolean (default: false)

Example Response

{
  "heap": {
    "used": 84529280,
    "committed": 91987968,
    "max": 2147483648,
    "class": "G1 Young Generation"
  },
  "non_heap": {
    "used": 14680364,
    "committed": 16206848,
    "max": 0
  }
}

GET /api/v1/metrics/gc

Description

Returns garbage collection metrics including pause times and collection counts.

Parameters

  • last - number of minutes to aggregate (default: 5)
  • gc_type - all, young, or full

Example Response

{
  "total_pause_time": 142,
  "full_gc_count": 3,
  "young_gc_count": 45,
  "last_full_gc": "2025-09-05T10:22:13Z"
}

GET /api/v1/metrics/threads

Description

Returns detailed thread statistics including total, peak, daemon counts and thread dumps.

Parameters

  • full_dump - boolean (includes full stack traces)
  • state - all, runnable, blocked, etc

Example Response

{
  "total_threads": 186,
  "daemon_threads": 21,
  "peak_threads": 204,
  "thread_states": {
    "RUNNABLE": 8,
    "BLOCKED": 12,
    "TIMED_WAITING": 35
  }
}

POST /api/v1/mbeans/{objectName}

Description

Invoke operations on specific MBeans. Available operations vary by MBean.

Parameters

  • operation - name of MBean operation
  • params - JSON object with parameters

Example: Trigger GC

POST /api/v1/mbeans/java.lang:type=Memory
{
  "operation": "gc",
  "params": {}
}

Example: Set Threads

POST /api/v1/mbeans/java.lang:type=Threading
{
  "operation": "setStackSize",
  "params": { "value": 1048576 }
}

GET /api/v1/stream

Description

Continuous stream of performance metrics. Requires Accept: application/x-ndjson header.

Parameters

  • interval - update frequency in seconds
  • metrics - comma-separated list of metrics to include

Stream Example

{
  "timestamp": "2025-09-05T10:45:12Z",
  "heap_used": 83210496,
  "heap_max": 2147483648,
  "thread_count": 189,
  "gc_pause": 142
}

...repeated every 5 seconds