如何在 Azure Monitor 中监视 Java 堆使用情况

How to monitor Java Heap usage in Azure Monitor

如何使用 Azure Monitor 监控我的 Java 应用程序的堆内存使用情况,并在使用率达到 90% 时生成警报?

好像可以用Zabbix等监控JVM的Heap,但是用Azure Monitor可以监控吗?

Azure 推荐的方法是使用包含堆内存的 Azure Monitor Application Insights Java 3.0 which does not require any code change to your application. You can take a look at detailed configuration ( especially the JMX counter) here

<PerformanceCounters>
      <Jmx>
        <Add objectName="java.lang:type=ClassLoading" attribute="TotalLoadedClassCount" displayName="Loaded Class Count"/>
        <Add objectName="java.lang:type=Memory" attribute="HeapMemoryUsage.used" displayName="Heap Memory Usage-used" type="composite"/>
      </Jmx>
    </PerformanceCounters>

要为这些指标添加警报,您可以查阅文档 here