Skip to content

Instantly share code, notes, and snippets.

@dcarley
Created July 5, 2013 13:03
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 dcarley/5934404 to your computer and use it in GitHub Desktop.
Save dcarley/5934404 to your computer and use it in GitHub Desktop.
collectd configuration for querying Elasticsearch using curl_json plugin
<Plugin curl_json>
<URL "http://127.0.0.1:<%= es_port -%>/_cluster/nodes/_local/stats?http=true&process=true&jvm=true&transport=true">
Instance "elasticsearch"
<%
stats = {
"counter" => [
"indices.cache.field_evictions",
"indices.cache.filter_count",
"indices.cache.filter_evictions",
"indices.indexing.index_total",
"indices.indexing.index_time_in_millis",
"indices.indexing.delete_total",
"indices.indexing.delete_time_in_millis",
"indices.get.total",
"indices.get.total_time_in_millis",
"indices.get.exists_total",
"indices.get.exists_time_in_millis",
"indices.get.missing_total",
"indices.get.missing_time_in_millis",
"indices.flush.total",
"indices.flush.total_time_in_millis",
"indices.merges.total",
"indices.merges.total_time_in_millis",
"indices.refresh.total",
"indices.refresh.total_time_in_millis",
"indices.search.query_total",
"indices.search.query_time_in_millis",
"indices.search.fetch_current",
"indices.search.fetch_total",
"indices.search.fetch_time_in_millis",
"jvm.gc.collection_count",
"jvm.gc.collection_time_in_millis",
"transport.rx_count",
"transport.tx_count",
],
"bytes" => [
"indices.store.size_in_bytes",
"indices.cache.field_size_in_bytes",
"indices.cache.filter_size_in_bytes",
"indices.merges.total_size_in_bytes",
"jvm.mem.heap_used_in_bytes",
"jvm.mem.heap_committed_in_bytes",
"jvm.mem.non_heap_used_in_bytes",
"jvm.mem.non_heap_committed_in_bytes",
"transport.http.current_open",
"transport.http.total_opened",
"transport.rx_size_in_bytes",
"transport.tx_size_in_bytes",
],
"gauge" => [
"indices.docs.count",
"indices.docs.deleted",
"indices.merges.current",
"indices.merges.current_docs",
"indices.merges.total_docs",
"indices.search.query_current",
"jvm.threads.count",
"jvm.threads.peak_count",
"transport.server_open",
"http.current_open",
"http.total_opened",
"process.open_file_descriptors",
],
}
# We write out Instance because the autogenerated version only uses the last
# two parts of the key name and can produce clashes.
stats.each do |stat_type, stat_keys|
stat_keys.each do |stat_key|
-%>
<Key "nodes/*/<%= stat_key.gsub(".", "/") -%>">
Type "<%= stat_type -%>"
Instance "<%= stat_key -%>"
</Key>
<%
end
end
-%>
</URL>
</Plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment