Skip to content

Instantly share code, notes, and snippets.

@sheldonh
Created August 13, 2009 14:59
Show Gist options
  • Select an option

  • Save sheldonh/167227 to your computer and use it in GitHub Desktop.

Select an option

Save sheldonh/167227 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
default_classes = %w(
sudo
fastcgi
)
node_types = {
:webmail => {
:hosts => %w(
webmail1.jnb2.fromblewoz.com
webmail1.cpt2.fromblewoz.com
),
:classes => %w(
monitor::munin
monitor::webmail
),
},
:nagios => {
:hosts => %w(
manage1.cpt1.fromblewoz.com
manage2.cpt2.fromblewoz.com
),
:classes => %w(
monitor::nagios_server
),
},
}
hostname = ARGV[0].dup
classes = default_classes.dup
node_types.each do |type, config|
if config[:hosts].include? hostname
classes.concat config[:classes]
end
end
puts hostname << ": " << classes.join(", ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment