forked from iamacarpet/cloud9php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystemdata.php
More file actions
25 lines (19 loc) · 786 Bytes
/
systemdata.php
File metadata and controls
25 lines (19 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Systemdata extends CI_Model {
function getLoad(){
$output = array('label' => 'label-success', 'load' => array('9.99', '9.99', '9.99'));
$load = sys_getloadavg();
$output['load'][0] = number_format($load[0],2);
$output['load'][1] = number_format($load[1],2);
$output['load'][2] = number_format($load[2],2);
if ($load[0] > 1.5 || $load[1] > 1.5 || $load[2] > 1.5){
if ($load[0] > 2.5 || $load[1] > 2.5 || $load[2] > 2.5){
$output['label'] = 'label-important';
} else {
$output['label'] = 'label-warning';
}
}
return $output;
}
}
?>