0

I have a problem because this is not a clean solution how I calculate the things. Storage should be calculated in GB and Memory in MB I get values like "free" => 98807345152 from the respective Storage and Memory. What is a better solution?

I don't like the calculations there.

$nodeMemory = GetNodeMemoryStatusAction::run('node01');
    $nodeStorage = GetNodeStorageStatusAction::run('node01');

    if (number_format($nodeMemory['free'] / 1024 / 1024, 0, ',', '') >= $this->data['memory']
        && number_format($nodeStorage['free'] / 1024 / 1024, 0, ',', '') >= $this->data['storage'] / 1024) {
    }
IMSoP
  • 89,526
  • 13
  • 117
  • 169
  • What do you "not like", exactly? It's not clear what kind of answer you're looking for. – IMSoP Mar 18 '22 at 11:50
  • Does this answer your question? [Format bytes to kilobytes, megabytes, gigabytes](https://stackoverflow.com/questions/2510434/format-bytes-to-kilobytes-megabytes-gigabytes) – CBroe Mar 18 '22 at 11:51
  • If you don't like dealing in bytes, create an interface with values you do like? – Ian Brindley Mar 18 '22 at 11:58

0 Answers0