https://github.com/divineomega/php-server-info
Gets metrics on a server via an SSH connection
https://github.com/divineomega/php-server-info
metrics php-library servers ssh ssh-connection
Last synced: 10 months ago
JSON representation
Gets metrics on a server via an SSH connection
- Host: GitHub
- URL: https://github.com/divineomega/php-server-info
- Owner: DivineOmega
- License: lgpl-3.0
- Created: 2019-08-07T20:19:29.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-10T20:51:58.000Z (over 6 years ago)
- Last Synced: 2025-03-16T16:11:45.664Z (10 months ago)
- Topics: metrics, php-library, servers, ssh, ssh-connection
- Language: PHP
- Homepage:
- Size: 21.5 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP Server Info
## Installation
```bash
composer require divineomega/php-server-info
```
## Usage
```php
to('example.com')
->as('username')
->withPrivateKey('/home/user/.ssh/id_rsa');
$array = (new Server($connection))
->metrics()
->toArray();
var_dump($array);
```
```php
array(14) {
["uptime"]=>
int(7564013)
["hostname"]=>
string(11) "example"
["disk-usage-percentage"]=>
int(29)
["total-disk-space-bytes"]=>
int(18045964)
["memory-usage-percentage"]=>
int(37)
["total-memory-bytes"]=>
int(1009128)
["swap-usage-percentage"]=>
int(26)
["total-swap-bytes"]=>
int(1048572)
["mysql-server-running"]=>
bool(true)
["apache-server-running"]=>
bool(false)
["nginx-server-running"]=>
bool(true)
["active-http-connections"]=>
int(0)
["load-averages"]=>
array(3) {
[1]=>
float(0.13)
[5]=>
float(0.19)
[15]=>
float(0.13)
}
["cpu-usage-percentage"]=>
float(6.2)
}
```