Looking to run some code on an external host to calculate my local unraid disk size etc. This is some code I've done in PHP, however I do not think it's possible to do this remotely with this technique. Anyone have any ideas or suggestions?
<?php
$dt = disk_total_space( '/mnt/cache' );
$df = disk_free_space( '/mnt/cache' );
$du = $dt - $df;
$dp = sprintf( '%.2f', ( $du / $dt ) * 100 );
$df = formatSize( $df );
$du = formatSize( $du );
$dt = formatSize( $dt );
function formatSize( $bytes ) {
$types = array( 'B', 'KB', 'MB', 'GB', 'TB' );
for ( $i = 0; $bytes >= 1024 && $i < ( count( $types ) - 1 ); $bytes /= 1024, $i++ );
return ( round( $bytes, 2 ) . " " . $types[ $i ] );
}
?>