Skip to content

Instantly share code, notes, and snippets.

@pichuang
Last active June 25, 2016 08:11
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 pichuang/3295dda2df83e2a4e7a7e0d87a7686b7 to your computer and use it in GitHub Desktop.
Save pichuang/3295dda2df83e2a4e7a7e0d87a7686b7 to your computer and use it in GitHub Desktop.
jmx + karaf + logstash
input {
jmx {
path => "/etc/logstash/jmx.conf"
polling_frequency => 15
type => "jmx"
nb_thread => 4
}
}
{
//Required, JMX listening host/ip
"host" : "192.168.1.2",
//Required, JMX listening port
"port" : 1335,
//Optional, the username to connect to JMX
"username" : "user",
//Optional, the password to connect to JMX
"password": "pass",
//Optional, use this alias as a prefix in the metric name. If not set use <host>_<port>
"alias" : "test.homeserver.elasticsearch",
//Required, list of JMX metrics to retrieve
"queries" : [
{
//Required, the object name of Mbean to request
"object_name" : "java.lang:type=Memory",
//Optional, use this alias in the metrics value instead of the object_name
"object_alias" : "Memory"
}, {
"object_name" : "java.lang:type=Runtime",
//Optional, set of attributes to retrieve. If not set retrieve
//all metrics available on the configured object_name.
"attributes" : [ "Uptime", "StartTime" ],
"object_alias" : "Runtime"
}, {
//object_name can be configured with * to retrieve all matching Mbeans
"object_name" : "java.lang:type=GarbageCollector,name=*",
"attributes" : [ "CollectionCount", "CollectionTime" ],
//object_alias can be based on specific value from the object_name thanks to ${<varname>}.
//In this case ${type} will be replaced by GarbageCollector...
"object_alias" : "${type}.${name}"
}, {
"object_name" : "java.nio:type=BufferPool,name=*",
"object_alias" : "${type}.${name}"
} ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment