From 646b511cd4b378c29b19658691eeaaec1ccdc3a6 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Wed, 11 Sep 2013 09:22:53 -0400 Subject: [PATCH] Added a function in AppModel to check the System Load --- web/app/Model/AppModel.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/app/Model/AppModel.php b/web/app/Model/AppModel.php index d4b5c8057..1fbc798bf 100644 --- a/web/app/Model/AppModel.php +++ b/web/app/Model/AppModel.php @@ -46,6 +46,15 @@ class AppModel extends Model { $return = exec( $string ); return $return; } + +function getSystemLoad() +{ + $uptime = shell_exec( 'uptime' ); + $load = ''; + if ( preg_match( '/load average: ([\d.]+)/', $uptime, $matches ) ) + $load = $matches[1]; + return( $load ); +}