Skip to content

Instantly share code, notes, and snippets.

@ianrumford
Last active December 11, 2015 01:49
Show Gist options
  • Save ianrumford/4526472 to your computer and use it in GitHub Desktop.
Save ianrumford/4526472 to your computer and use it in GitHub Desktop.
Riemann Feeds blog_feed_jmx2.jmxbeanconfigOperatingSystem.rb
# riemann feeds
# jmxbeanconfigOperatingSystem
# Some normalisation stuff
bytes2GB = (1024 * 1024 * 1024).to_f
bytes_2_gigabytes = ->(b) { b.to_f / bytes2GB }
{ bean_name: 'java.lang:type=OperatingSystem',
event_defaults: { tags: ['OS'] },
attributes: {
include: ['free_physical_memory_size',
'free_swap_space_size',
'total_swap_space_size',
'system_load_average',
'available_processors'
],
definitions: {
'free_physical_memory_size' =>
{ event_defaults: { tags: ['FreeMem']}, # more tags
metric: bytes_2_gigabytes,
select: ->(e) {(r = e[:metric]) ? (r < 1.0) : true}, # only pass through events where free memory less than 1GB
map: ->(e) {e[:status] = 'critical'; e },
},
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment