Created
November 6, 2009 18:08
-
-
Save macros/228153 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ganglia_interface(host) | |
if host[:ganglia] && host[:ganglia][:cluster] && host[:ganglia][:cluster][:interface] | |
interface = host[:ganglia_cluster][:interface] | |
else | |
interface = host[:network][:default_interface] | |
end | |
end | |
def ganglia_ip(host) | |
interface = ganglia_interface(host) | |
host[:network][:interfaces][interface][:addresses].each do |addr,value| | |
if host[:network][:interfaces][interface][:addresses][addr][:family] == "inet" | |
return addr | |
end | |
end | |
end | |
def get_ips(cluster) | |
ips = [] | |
search(:node, "*").each do |host| | |
if host[:ganglia] && host[:ganglia][:cluster] == cluster | |
ipaddr = ganglia_ip(host) | |
ips << ipaddr | |
end | |
end | |
return ips | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment