title: Monitoring tomcat permgen
body: <p>Is there a tool/way to monitor the tomcat memory usage i.e. permgen to avoid getting issues like below. Yes we can increase the memory and trim up the GC, but still some monitoring would be nice. It would also be desireable to send warning emails when some critical memory consumption is reached.</p>
  
  <pre><code>java.lang.OutOfMemoryError: PermGen space
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1815)
      at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
      at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:108)
      at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:58)
      at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)
      at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1064)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4238)
      at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3083)
      at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:404)
      at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1279)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1571)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1580)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1580)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1560)
      at java.lang.Thread.run(Thread.java:662)
  </code></pre>