Get instance memory (in GB) in puppet

157 Views Asked by At

How to get memory of an azure instance type in to manifest file?

i'm trying to get instance memory and set heap value based on memory available. if memory available is more then 62GB then heap=31GB, if its less then 62GB the heap available =15GB.

1

There are 1 best solutions below

0
John Bollinger On

The core facts reported for every node include some describing the amount of system memory. You are probably looking for $facts['memory']['system']['total'], which is expressed in human-readable format such as 15.51 GiB, or $facts['memory']['system']['total_bytes'] which is the same as a pure number, in units of bytes.

Or if you mean "available" in the sense of "free", then $facts['memory']['system']['available'] and $facts['memory']['system']['available_bytes'].

If you want to include swap space in addition to RAM, then that data is available from analogous entries in $facts['memory']['swap'].