This message was deleted.
# puppet
s
This message was deleted.
m
gonna do what i done for rpm and make it an array of key/values
Copy code
Facter.add(:rpm) do
  confine :osfamily => "RedHat"
  setcode do

  rpm_hash = {}

  # Grab rpm facts
  if Facter::Core::Execution.which('rpm')
    # Pull the rpm facts and parse
    rpm_output = Facter::Core::Execution.execute('rpm --query --all  --qf "%{NAME}||%{VERSION}\n"')

    # Split by line
    rpm_output.split("\n").each do |line|

      # Split by ||
      rpm_detail = line.split("||")

      # Populate hash with package name [0] and package version [1]
      rpm_hash[rpm_detail[0]] = rpm_detail[1]

    end

  # Return the fact hash
  rpm_hash

  end
  end
end
l
yea, so my understanding is that will be 100s of facts for RPM not a single fact... and you'll get warnings at 2048 facts
m
ah okay, this comes in as a single array, thats 1 fact right?
or hash i mean
l
I am not sure, I'd let one of the puppet folks confirm, but my recollection of how they described it is that all the depth gets flattened in the db to some degree
m
got it, i'd have hit the limit a long time ago if it were more facts. Really need to move away from gathering too much info via puppet. The node_exporter Yury mentioned looks to be more appropriate
b
use puppet to configure stuff that collects data, don't gather data with puppet 🙂