Monitor-JVM
Native library that auto-injects JMX and JIM arguments into Java processes.
Monitor-JVM (Native Library Injection)#
| Property | Details |
|---|---|
| What it is | A native C library (libhealagent.so) that hooks into the OS's process creation mechanism to automatically inject JMX and JIM arguments into Java processes |
| Installed as | Shared library registered in /etc/ld.so.preload |
| Runs as | Loaded into every new process's address space (filters to only act on Java processes) |
| Communication | None — it doesn't communicate with HEAL directly |
| Data it collects | None — it's an enabler, not a collector |
| Purpose | Ensures that every Java process on the target server automatically gets JMX monitoring and JIM tracing without manual configuration |
| Configured in CC | Not configured in CC — it's a local utility |
How Monitor-JVM Works#
1. Library is listed in /etc/ld.so.preload → loaded into EVERY new process
2. When a new process starts, the library checks:
a. Is this a Java process? (checks for java binary)
b. Does it match the whitelist regex? (e.g., "tomcat:start")
c. Does it match the blacklist regex? (e.g., "tomcat:stop") → if yes, SKIP
3. If whitelisted:
a. Find a free JMX port starting from jmxBasePort (11001)
b. Look up jimConfig.properties for the matching instance config
c. Inject JMX arguments (-Dcom.sun.management.jmxremote.port=11001, etc.)
d. Inject JIM arguments (-javaagent:heal-jim-opentelemetry-javaagent.jar, etc.)
4. Java process starts with all monitoring arguments already in place
Why It's Important
Without Monitor-JVM, you would need to manually add JMX and JIM flags to every Java process's startup script. Monitor-JVM automates this — even if the app is restarted, the arguments are automatically re-injected.
Key Files#
/home/heal/Agent/utils/monitor-jvm/
├── config/
│ ├── heal.conf # Master config (enable/disable JMX, JIM, whitelist/blacklist)
│ ├── jimConfig.properties # Maps app server instances to JIM config files
│ └── extraArgs.properties # Additional JVM arguments
├── lib/
│ ├── 64/libhealagent.so.1.2.1 # The actual native library (64-bit)
│ └── 32/libhealagent.so.1.2.1 # 32-bit version
├── data/
│ └── .portData.dat # Tracks assigned JMX ports
├── logs/
│ └── healagent.log # Injection events log
└── install_libhealagent_linux.sh # Installer script
System-Level Symlinks#
/etc/ld.so.preload → contains "/$LIB/libhealagent.so"
/etc/heal.conf → symlink to config/heal.conf
/lib64/libhealagent.so → symlink to lib/64/libhealagent.so.1.2.1
Verification#
cat /etc/ld.so.preload
# Should contain: /$LIB/libhealagent.so
tail -20 /home/heal/Agent/utils/monitor-jvm/logs/healagent.log