<commit_before>require "json"

Ohai.plugin(:Lldp) do
  provides "lldp"

  collect_data(:default) do
    lldp Mash.new

    json = JSON.parse(%x(/sbin/lldpctl -f json))

    json["lldp"].each do |key, value|
      lldp[key] = value
    end

    lldp
  end
end<commit_msg>Improve layout of LLDP data<commit_after>require "json"

Ohai.plugin(:Lldp) do
  provides "lldp"

  collect_data(:default) do
    lldp Mash.new

    json = JSON.parse(%x(/sbin/lldpctl -f json))

    json["lldp"]["interface"].each do |interface|
      interface.each do |name, details|
        lldp[name] = details
      end
    end

    lldp
  end
end
{'fraction_non_alphanumeric': 0.12721417069243157, 'fraction_numerical': 0.0, 'mean_word_length': 2.8395061728395063, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4433786', 'n_tokens_mistral': 248, 'n_tokens_neox': 242, 'n_words': 55}