Convert bytes to GB in alert?

I was wondering if there’s a way to convert bytes to GB or TB in an alert? I have the alert:

@if ($alert->state == 0) Time elapsed: {{ $alert->elapsed }} @endif 
Alert Started: {{ $alert->timestamp }}

@foreach ($alert->faults as $key => $value)
Mount Point:  {{ $value['storage_descr'] }}
Percent Utilized:  {{ $value['storage_perc'] }}
Bytes Free:  {{ $value['storage_free'] }}

@endforeach

It reports:

Disk Utilization Alert - $device 
Alert Started: 2018-08-06 13:56:50

Mount Point: /data
Percent Utilized: 81
Bytes Free: 1869629513728

Is there a way to convert “storage_free” to GB or TB?

You can do maths
Inbound Utilization %: @php echo (($value[‘ifInOctets_rate’]*8)/$value[‘ifSpeed’])*100; @endphp %

Thats an example as how it looks for Bits. Just do the same for $value[‘storage_free’]

Hey,

I believe that is for interface, no? I’m trying to convert the free amount of a HDD from bytes to gigabytes or terabytes.

I stumbled upon an “ugly” way to do it though, there is probably a better way like you suggested or through a macro maybe?

GB Free:  {{ $value['storage_free']/1,073,741,824}}