2017 © Pedro Peláez
 

library server-status

Library to access various components of the operating system

image

innmind/server-status

Library to access various components of the operating system

  • Wednesday, February 14, 2018
  • by Baptouuuu
  • Repository
  • 1 Watchers
  • 2 Stars
  • 230 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 7 % Grown

The README.md

Server Status

Build Status codecov Type Coverage, (*1)

Give an easy access to the cpu, memory, disk usages and the list of processes running on the machine., (*2)

Note: only works for Mac OSX and Linux for now., (*3)

Installation

composer require innmind/server-status

Usage

use Innmind\Server\Status\{
    ServerFactory,
    Server\Disk\Volume\MountPoint,
    Server\Process\Pid,
};
use Innmind\TimeContinuum\Earth\Clock;

$server = ServerFactory::build(new Clock);

$server->cpu()->user(); //percentage of the cpu used by the user
$server->cpu()->system(); //percentage of the cpu used by the system
$server->cpu()->idle(); //percentage of the cpu not used
$server->cput()->cores(); //number of cores available

$server->memory()->total(); //total memory of the server
$server->memory()->wired(); //memory that cannot be taken out of ram
$server->memory()->active(); //memory that is used by processes
$server->memory()->free(); //memory that is not used
$server->memory()->swap(); //memory that is used and located on disk
$server->memory()->used(); //total - free

$server->loadAverage()->lastMinute();
$server->loadAverage()->lastFiveMinutes();
$server->loadAverage()->lastFifteenMinutes();

$server->disk()->get(new MountPoint('/'))->size(); //total size of the volume
$server->disk()->get(new MountPoint('/'))->available();
$server->disk()->get(new MountPoint('/'))->used();
$server->disk()->get(new MountPoint('/'))->usage(); //percentage of space being used

$server->processes()->get(new Pid(1))->user(); //root in this case
$server->processes()->get(new Pid(1))->cpu(); //percentage
$server->processes()->get(new Pid(1))->memory(); //percentage
$server->processes()->get(new Pid(1))->start(); //point in time at which the process started
$server->processes()->get(new Pid(1))->command();

$server->tmp(); //path to temp directory

You can easily log all the informations gathered via a simple decorator:, (*4)

use Innmind\Server\Status\Server\Logger;
use Psr\Log\LoggerInterface;

$server = new Logger($server, /** instance of LoggerInterface */);

The Versions

14/02 2018

dev-master

9999999-dev http://github.com/Innmind/ServerStatus

Library to access various components of the operating system

  Sources   Download

MIT

The Requires

 

The Development Requires

14/02 2018

1.1.0

1.1.0.0 http://github.com/Innmind/ServerStatus

Library to access various components of the operating system

  Sources   Download

MIT

The Requires

 

The Development Requires

14/02 2018

dev-develop

dev-develop http://github.com/Innmind/ServerStatus

Library to access various components of the operating system

  Sources   Download

MIT

The Requires

 

The Development Requires

26/11 2017

1.0.1

1.0.1.0 http://github.com/Innmind/ServerStatus

Library to access various components of the operating system

  Sources   Download

MIT

The Requires

 

The Development Requires

26/05 2017

1.0.0

1.0.0.0 http://github.com/Innmind/ServerStatus

Library to access various components of the operating system

  Sources   Download

MIT

The Requires

 

The Development Requires