Skip to content

Commit

Permalink
status: order redis processes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anrijs committed Oct 5, 2018
1 parent 73626fc commit 5a93377
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion www/stat.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ function get_server_cpu_usage(){
return $load[0];
}

function cmp($a, $b) {
return strcmp($a["id"], $b["id"]);
}

$response = array();
$response["cpu"] = get_server_cpu_usage();
$response["mem"] = get_server_memory_usage();
Expand All @@ -46,7 +50,9 @@ function get_server_cpu_usage(){
$procs[] = $proc;
}

$response["proc"] = $procs;
usort($procs, "cmp");

$procs = $response["proc"] = $procs;

header('Content-Type: application/json');
echo json_encode($response);
Expand Down

0 comments on commit 5a93377

Please sign in to comment.