Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created October 24, 2016 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8d326e40b5484e455f269509f269cc0c to your computer and use it in GitHub Desktop.
Save anonymous/8d326e40b5484e455f269509f269cc0c to your computer and use it in GitHub Desktop.
# Pastebin 0Dc4Zqj0
Facter.add(:nagios_ipaddress6) do
setcode do
Facter.value(:networking)['interfaces'].
reject { |i,_| i =~ /lo.*/ }.
values.
map { |x| x['bindings6'] }.
flatten.
map { |x| x['address'] }.
select { |x| valid_addr? x }.
sort_by { |x| x.length }.
shift
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment