Thursday, 13 March 2014

Apple: Get Memory Utilization From Your Mac With UNIX Command

The UNIX command below allows you to get the memory utilization from your MacBook.
#!/bin/bash

free_blocks=$(vm_stat | grep free | awk '{ print $3 }' | sed 's/\.//')
free=$(($free_blocks*4096/1048576))
used=$(((8000-$free)))
echo "0:$used:OK"
* Note: The output from the script can be read by Paessler PRTG.

No comments:

Post a Comment