Skip to content

Instantly share code, notes, and snippets.

@kernelp4nic
Forked from ajayverghese/collectd.conf
Created February 6, 2017 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kernelp4nic/3dacfb3a925b3ef24eebe5bcd7526d5e to your computer and use it in GitHub Desktop.
Save kernelp4nic/3dacfb3a925b3ef24eebe5bcd7526d5e to your computer and use it in GitHub Desktop.
Sample collectd configuration to fetch jetty and jvm metrics for monitoring (and send to graphite)
#
# 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment