diff --git a/web/api/app/Controller/HostController.php b/web/api/app/Controller/HostController.php index f09f27943..d7c3c45d7 100644 --- a/web/api/app/Controller/HostController.php +++ b/web/api/app/Controller/HostController.php @@ -22,4 +22,15 @@ class HostController extends AppController { )); } + function getLoad() { + $uptime = shell_exec( 'uptime' ); + $load = ''; + if ( preg_match( '/load average: ([\d.]+)/', $uptime, $matches ) ) + $load = $matches[1]; + + $this->set(array( + 'load' => $load, + '_serialize' => array('load') + )); + } }