Skip to content

Instantly share code, notes, and snippets.

@CodeBrauer
Last active February 8, 2017 11:43
Show Gist options
  • Save CodeBrauer/765428bc0d9b4260177d0f47a68af1b3 to your computer and use it in GitHub Desktop.
Save CodeBrauer/765428bc0d9b4260177d0f47a68af1b3 to your computer and use it in GitHub Desktop.
get server % load (debian) in php
<?php
$load = str_replace(',','.', trim(`uptime| awk '{print $10 }'`));
$cores = trim(`lscpu | grep "CPU(s):" | awk '{print $2}' | head -1`);
$percent = $load/$cores * 100;
echo $percent . '%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment