ini 样本收集配置以获取jetty和jvm指标以进行监控(并发送到石墨)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ini 样本收集配置以获取jetty和jvm指标以进行监控(并发送到石墨)相关的知识,希望对你有一定的参考价值。

#
# Config file for collectd(1).
# Please read collectd.conf(5) for a list of options.
# http://collectd.org/
#

##################
# Global settings
##################

#Hostname    "localhost"
FQDNLookup   true
BaseDir     "/opt/collectd/var/lib/collectd"
PIDFile     "/opt/collectd/var/run/collectd.pid"
PluginDir   "/opt/collectd/lib/collectd"
TypesDB     "/opt/collectd/share/collectd/types.db"
Interval     10
Timeout      2
ReadThreads  5


##############
# Plugin list
##############

LoadPlugin syslog
LoadPlugin write_graphite
LoadPlugin java

<Plugin "java">
   JVMArg "-Djava.class.path=/opt/collectd/share/collectd/java/collectd-api.jar:/opt/collectd/share/collectd/java/generic-jmx.jar"
   LoadPlugin "org.collectd.java.GenericJMX"

   <Plugin "GenericJMX">
   # Garbage collector information
   <MBean "garbage_collector">
     ObjectName "java.lang:type=GarbageCollector,*"
     InstancePrefix "gc-"
     InstanceFrom "name"

     <Value>
       Type "invocations"
       #InstancePrefix ""
       #InstanceFrom ""
       Table false
       Attribute "CollectionCount"
     </Value>
     <Value>
       Type "total_time_in_ms"
       InstancePrefix "collection_time"
       #InstanceFrom ""
       Table false
       Attribute "CollectionTime"
     </Value>
   </MBean>

   # Generic heap/nonheap memory usage.
   <MBean "memory">
     ObjectName "java.lang:type=Memory"
     #InstanceFrom ""
     InstancePrefix "memory"

     # Creates four values: committed, init, max, used
     <Value>
       Type "memory"
       #InstancePrefix ""
       #InstanceFrom ""
       Table true
       Attribute "HeapMemoryUsage"
       InstancePrefix "heap-"
     </Value>

     # Creates four values: committed, init, max, used
     <Value>
       Type "memory"
       #InstancePrefix ""
       #InstanceFrom ""
       Table true
       Attribute "NonHeapMemoryUsage"
       InstancePrefix "nonheap-"
     </Value>
   </MBean>


   <MBean "jetty">
     ObjectName "org.eclipse.jetty.server.handler:type=statisticshandler,id=0"
     InstancePrefix "jetty"
     #InstanceFrom "name"

     <Value>
       Type "response_time"
       Table false
       Attribute "requestTimeMax"
       InstancePrefix "requestTimeMax"
     </Value>
     <Value>
       Type "response_time"
       Table false
       Attribute "requestTimeMean"
       InstancePrefix "requestTimeMean"
     </Value>
     <Value>
       Type "response_time"
       Table false
       Attribute "requestTimeStdDev"
       InstancePrefix "requestTimeStdDev"
     </Value>

     <Value>
       Type "requests"
       Table false
       Attribute "asyncRequestsWaiting"
       InstancePrefix "asyncRequestsWaiting"
     </Value>

     <Value>
       Type "requests"
       Table false
       Attribute "requestsActive"
       InstancePrefix "requestsActive"
     </Value>

     <Value>
       Type "requests"
       Table false
       Attribute "responses1xx"
       InstancePrefix "responses1xx"
     </Value>
     <Value>
       Type "requests"
       Table false
       Attribute "responses2xx"
       InstancePrefix "responses2xx"
     </Value>
     <Value>
       Type "requests"
       Table false
       Attribute "responses3xx"
       InstancePrefix "responses3xx"
     </Value>
     <Value>
       Type "requests"
       Table false
       Attribute "responses4xx"
       InstancePrefix "responses4xx"
     </Value>
     <Value>
       Type "requests"
       Table false
       Attribute "responses5xx"
       InstancePrefix "responses5xx"
     </Value>
   </MBean>


      <Connection>
        ServiceURL "service:jmx:rmi:///jndi/rmi://<java_host>:<java_jmx_port>/jmxrmi"
        Host "<java_host>"
        Collect "garbage_collector"
        Collect "memory"
        Collect "jetty"
      </Connection>

   </Plugin>
</Plugin>

# write collectd logs to syslog
<Plugin syslog>
   LogLevel info
</Plugin>

<Plugin write_graphite>
   <Carbon>
      Host "<graphite_host>"
      Port 2003
      Prefix "collectd."
   </Carbon>
</Plugin>

以上是关于ini 样本收集配置以获取jetty和jvm指标以进行监控(并发送到石墨)的主要内容,如果未能解决你的问题,请参考以下文章

基于 kafka,zabbix 构建应用统计数据收集展示系统

如何在每个样本中从分析器获取完整的堆栈转储以用于火焰图中?

如何配置 Prometheus 以通过公开路由获取具有 2 个副本的服务的指标?

jetty:如何以编程方式配置多个虚拟主机?

JVM垃圾收集器CMS和G1

如何配置嵌入式 Jetty 以处理 OPTIONS 预检请求?