Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Supporting files for my blog post on remote jmx Spring Boot debugging
package com.example.demo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
@RestController
public class DemoController {
@GetMapping("/ping")
public Mono<String> ping() {
return Mono.just("pong");
}
}
monitorRole readonly
controlRole readwrite
monitorRole 123456
controlRole 123456789
#!/usr/bin/env bash
set -euo pipefail
RMI_HOST=$(wget -q -O - http://169.254.169.254/latest/meta-data/public-hostname)
java -Dcom.sun.management.jmxremote \
-Djava.net.preferIPv4Stack=true \
-Djava.rmi.server.hostname=${RMI_HOST} \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.port=9010 \
-Dcom.sun.management.jmxremote.rmi.port=9010 \
-Dcom.sun.management.jmxremote.authenticate=true \
-Dcom.sun.management.jmxremote.password.file=jmxremote.password \
-Dcom.sun.management.jmxremote.access.file=jmxremote.access \
-Dcom.sun.management.jmxremote.ssl=false \
-jar demo-0.0.1-SNAPSHOT.jar
#!/usr/bin/env bash
set -euo pipefail
java -Dcom.sun.management.jmxremote \
-Djava.net.preferIPv4Stack=true \
-Djava.rmi.server.hostname=localhost \
-Dcom.sun.management.jmxremote.local.only=true \
-Dcom.sun.management.jmxremote.port=9010 \
-Dcom.sun.management.jmxremote.rmi.port=9010 \
-Dcom.sun.management.jmxremote.authenticate=true \
-Dcom.sun.management.jmxremote.password.file=jmxremote.password \
-Dcom.sun.management.jmxremote.access.file=jmxremote.access \
-Dcom.sun.management.jmxremote.ssl=false \
-jar demo-0.0.1-SNAPSHOT.jar
Host server
HostName ec2-11-11-111-111.eu-west-1.compute.amazonaws.com
User ubuntu
IdentityFile ~/.ssh/key.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.