File tree Expand file tree Collapse file tree 1 file changed +70
-1
lines changed Expand file tree Collapse file tree 1 file changed +70
-1
lines changed Original file line number Diff line number Diff line change 1- # php-server-info
1+ # PHP Server Info
2+
3+ ## Installation
4+
5+ ``` bash
6+ composer require divineomega/php-server-info
7+ ```
8+
9+ ## Usage
10+
11+ ``` php
12+ <?php
13+
14+ use DivineOmega\ServerInfo\Server;
15+ use DivineOmega\SSHConnection\SSHConnection;
16+
17+ require_once __DIR__.'/../vendor/autoload.php';
18+
19+ $connection = (new SSHConnection())
20+ ->to('example.com')
21+ ->as('username')
22+ ->withPrivateKey('/home/user/.ssh/id_rsa');
23+
24+ $array = (new Server($connection))
25+ ->metrics()
26+ ->toArray();
27+
28+ var_dump($array);
29+ ```
30+
31+ ``` php
32+ array(14) {
33+ ["uptime"]=>
34+ int(7564013)
35+ ["hostname"]=>
36+ string(11) "example"
37+ ["disk-usage-percentage"]=>
38+ int(29)
39+ ["total-disk-space-bytes"]=>
40+ int(18045964)
41+ ["memory-usage-percentage"]=>
42+ int(37)
43+ ["total-memory-bytes"]=>
44+ int(1009128)
45+ ["swap-usage-percentage"]=>
46+ int(26)
47+ ["total-swap-bytes"]=>
48+ int(1048572)
49+ ["mysql-server-running"]=>
50+ bool(true)
51+ ["apache-server-running"]=>
52+ bool(false)
53+ ["nginx-server-running"]=>
54+ bool(true)
55+ ["active-http-connections"]=>
56+ int(0)
57+ ["load-averages"]=>
58+ array(3) {
59+ [1]=>
60+ float(0.13)
61+ [5]=>
62+ float(0.19)
63+ [15]=>
64+ float(0.13)
65+ }
66+ ["cpu-usage-percentage"]=>
67+ float(6.2)
68+ }
69+
70+ ```
You can’t perform that action at this time.
0 commit comments