SebastianWendel / astack

Astack is a script to securely deploy and update Atlassians developer applications in less than five minutes, like apt or yum.
2 stars 0 forks source link

Enable local jmx listener for jvm monitoring #36

Open SebastianWendel opened 11 years ago

SebastianWendel commented 11 years ago

http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html

SebastianWendel commented 11 years ago
echo "tomcat password" | tee /opt/confluence/data/config/jmxremote.password
echo "tomcat readonly" | tee /opt/confluence/data/config/jmxremote.access
chown -R confluence:confluence /opt/confluence/data/config/jmxremote.*
chmod 500 /opt/confluence/data/config/jmxremote.*

JMX_OPTIONS=$(cat << 'EOF'

# enable jmx monitoring interface
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote "
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=true "
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9001 "
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false "
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.password.file=/opt/confluence/data/config/jmxremote.password "
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.access.file=/opt/confluence/data/config/jmxremote.access "
export JAVA_OPTS;

EOF
)
echo "${JMX_OPTIONS}" | sudo tee -a /opt/confluence/current/bin/setenv.sh

service confluence restart

tail -f /opt/confluence/current/logs/catalina.out /opt/confluence/data/logs/atlassian-confluence.log

netstat -tulpen | grep java
ps -ef | grep confluence
SebastianWendel commented 11 years ago

Note in README:

http://code.google.com/p/jmxquery

./check_jmx -U service:jmx:rmi:///jndi/rmi://localhost:9001/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -I HeapMemoryUsage -J used -vvvv -w 800000000 -c 1500000000 -username tomcat -password password