diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2016-11-11 21:13:56 +0100 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2016-11-11 21:13:56 +0100 |
| commit | cb577b3170e2d6e5c44aa29c37ab5d9751a66636 (patch) | |
| tree | 0d733a20274bda284bacc38b5b5c0f2b7af50b2c /www/status.php | |
| parent | 08fc60226f224de87d665aa7c55b6eaa9f66d768 (diff) | |
| download | phinde-cb577b3170e2d6e5c44aa29c37ab5d9751a66636.tar.gz phinde-cb577b3170e2d6e5c44aa29c37ab5d9751a66636.zip | |
improve status page
Diffstat (limited to 'www/status.php')
| -rw-r--r-- | www/status.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/www/status.php b/www/status.php index 3bc52cf..08e2a0d 100644 --- a/www/status.php +++ b/www/status.php @@ -3,15 +3,28 @@ namespace phinde; require 'www-header.php'; $es = new Elasticsearch($GLOBALS['phinde']['elasticsearch']); -$esDocs = $es->countDocuments(); +$esStatus = $es->getIndexStatus(); $queue = new Queue(); $gearStatus = $queue->getServerStatus(); +/** + * @link http://jeffreysambells.com/2012/10/25/human-readable-filesize-php + */ +function human_filesize($bytes, $decimals = 2) +{ + $size = array('B','kiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'); + $factor = floor((strlen($bytes) - 1) / 3); + return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) + . ' ' . @$size[$factor]; +} + +$esStatus['size_human'] = human_filesize($esStatus['size']); + render( 'status', array( - 'esDocs' => $esDocs, + 'esStatus' => $esStatus, 'gearStatus' => $gearStatus, ) ); |
