Hello,
I just thought I would post something cool that I’ve come across. I’ve been looking for a way to access JMX functionality remotely without using Java. I was originally looking for something that would provide XML-RPC access, but then I found something better:
To implement on Amazon EC2, I added the following to my startup.xml:
<Download>
<URL>http://www.jolokia.org/dist/0.90/jolokia-0.90-bin.zip</URL>
<Destination>/opt/jolokia.zip</Destination>
<Action>UNZIP</Action>
</Download>
Then, I changed the following in tuning/bin/setenv.sh:
JAVA_OPTS="-Xmx{JAVAMAXHEAPSIZE} -server -javaagent:/opt/jolokia-0.90/agents/jolokia-jvm6.jar"
Then, I added port 8778 to my EC2 security group (see here on how to choose a different port: http://www.jolokia.org/agent/jvm.html).
After startup, I was able to go to http://ec2-123-123-123-123.compute-1.amazonaws.com:8778/jolokia/read/WowzaMediaServerPro:name=Connections and get the following response:
{"timestamp":1305929352,"status":200,"request":{
"mbean":"WowzaMediaServerPro:name=Connections",
"type":"read"
},"value":{
"total":0,
"modelerType":"com.wowza.wms.client.ConnectionCounter",
"lastConnectAcceptedTimeString":"never",
"lastDisconnectTimeString":"never",
"lastDisconnectStampString":"never",
"lastConnectAcceptedStamp":0,
"totalAccepted":0,
"lastDisconnectStamp":0,
"lastConnectRejectedStamp":0,
"current":0,
"totalRejected":0,
"lastConnectAcceptedStampString":"never",
"lastConnectRejectedTimeString":"never",
"lastConnectRejectedStampString":"never"
}}
See http://www.jolokia.org/reference/html/protocol.html for more details on what you can do, but you can do more than just read. You can write and execute as well.
Anyway, hope this helps someone!
Security note: As is, this is wide open to anyone. A better option would be to load it on localhost (-javaagent:agent.jar=port=7777,host=localhost) and use Apache to redirect and handle authentication. I’ll update this post once I’ve figured out the easiest way to do that.
- david