Last active
February 8, 2017 11:43
-
-
Save CodeBrauer/765428bc0d9b4260177d0f47a68af1b3 to your computer and use it in GitHub Desktop.
get server % load (debian) in php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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