Ask Your Question
0

How to access Facter 3 information

asked 2016-03-04 13:29:48 -0500

lclegg gravatar image

updated 2016-03-04 13:30:35 -0500

I'm a bit confused over how to access some Facter V3 information. Using Open Puppet and Facter version => 3.1.4

Specifically I want to access the value in memory -> system -> available_bytes to use in a calculation. I'm just missing something and nothing is working correctly for me.

$my_value = "The system available bytes value" ???

memory => {
  swap => {
    available => "32.00 GiB",
    available_bytes => 34359734272,
    capacity => "0%",
    total => "32.00 GiB",
    total_bytes => 34359734272,
    used => "0 bytes",
    used_bytes => 0
  },
  system => {
    available => "28.39 GiB",
    available_bytes => 30487240704,
    capacity => "9.41%",
    total => "31.34 GiB",
    total_bytes => 33653538816,
    used => "2.95 GiB",
    used_bytes => 3166298112
  }
}
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-03-04 15:06:37 -0500

lclegg gravatar image

updated 2016-03-04 15:07:10 -0500

Oh man...I was making it way too hard. It is actually very easy:

$my_value = $::memory[system][total_bytes]

That gives me the precise value I was looking for.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-03-04 13:29:48 -0500

Seen: 188 times

Last updated: Mar 04 '16