/usr/sbin/mc-collectivemap is in mcollective-plugins-stomputil 0.0.0~git20120507.df2fa81-0ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #!/usr/bin/ruby
# Given a MCollective 1.1.3 or newer collective
# this will print as a dot graph a map of the collective
# and sub collectives
require 'mcollective'
include MCollective::RPC
def getcollectives(client)
collectives = {}
client.collective_info do |resp|
data = resp[:body][:data]
if data.include?(:collectives)
data[:collectives].each do |c|
collectives[c] = [] unless collectives.include?(c)
collectives[c] << resp[:senderid]
end
end
end
collectives
end
shelper = rpcclient("stomputil")
shelper.progress = false
collectives = getcollectives(shelper)
puts "graph {"
collectives.keys.sort.each do |collective|
puts "\tsubgraph #{collective} {"
collectives[collective].each do |member|
member_name = member.gsub('.', '_').gsub('-', '_')
puts "\t\t'#{member}' -- #{collective};"
end
puts "\t}"
end
puts "}"
|