Skip to content

Instantly share code, notes, and snippets.

@ianrumford
Last active December 10, 2015 18:28
Show Gist options
  • Save ianrumford/4474713 to your computer and use it in GitHub Desktop.
Save ianrumford/4474713 to your computer and use it in GitHub Desktop.
Riemann Feeds blog_feed_jmx0
#!/usr/bin/jruby
# riemann feeds
# A simple JMX feed monitoring the Hadoop YARN NameNode
require 'riemann-feeds' # bootstrap reieman feeds
#$DEBUG = true # force diags
# Create the 'external' configuration hashes
config_riemann = {riemann_host: '10.16.0.64', riemann_port: 5555, riemann_interval: 10}
credentials_jmx = {jmx_user: 'monitorRole', jmx_pass: 'monitorpass'}
jmxconfig_namenode = {jmx_host: '10.16.0.48', jmx_port: 8004}
# Create the feed specification
# Note the include_configuration array 'pulls in' the ('external') hashes.
feedspec_namenode = {
type: :JMX,
name: 'YARN NameNode',
configuration:
{ include_configuration: [credentials_jmx,
jmxconfig_namenode,
config_riemann,
],
event_defaults: {
service: 'NameNode',
status: 'ok',
tags: ['YARN', 'NameNode'],
},
beans: ["Hadoop:service=NameNode,name=NameNodeActivity",
"java.lang:type=OperatingSystem"
]
}
}
# Make a feed handler
feed_handler = Riemann::Feeds::FeedHandler.new
# Show the feed to the handler
feed_handler.import_feed_or_croak(feedspec_namenode)
# Now tell the handler to run the feed
feed_handler.run_feed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment