summaryrefslogtreecommitdiff
path: root/plugins/facter/munin_interfaces.rb
blob: 5366573e4d1f54e8569eb13f2802cb9774452eba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# return the set of active interfaces as an array
Facter.add("munin_interfaces") do
	setcode do
		`ip -o link show`.split(/\n/).collect do |line|
			value = nil
			matches = line.match(/^\d*: ([^:]*): <(.*,)?UP(,.*)?>/)
			if !matches.nil?
				value = matches[1]
			end
			value
		end.compact.sort.join(" ")
	end
end