]> git.openstreetmap.org Git - chef.git/blob - cookbooks/hardware/templates/default/lldp.rb.erb
15e35050ad8c0759f2710468184a1e9adb83d313
[chef.git] / cookbooks / hardware / templates / default / lldp.rb.erb
1 require "json"
2
3 Ohai.plugin(:Lldp) do
4   provides "lldp"
5
6   collect_data(:default) do
7     lldp Mash.new
8
9     json = JSON.parse(%x(/sbin/lldpctl -f json))
10
11     json["lldp"]["interface"].each do |interface|
12       interface.each do |name, details|
13         lldp[name] = details
14       end
15     end
16
17     lldp
18   end
19 end