Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
The easiest way is to get an SSH key to log in without a password, and write in php
and then parse $out;
$out = shell_exec("ssh [email protected] 'df -BM'");
You can use Deployer , Envoy , or just exec( ). But it is better to use some kind of agent that will constantly work on the server and give the information we need on a simple request to the selected port or on a regular basis, via the API. Well, for example, on the server we create a cron task that will run a console php script once an hour and put the information into a json file. Then we can get disk space with a simple request to this json, without suffering from ssh requests to the server and without opening a potential security hole.
It is better to use zabbix for these purposes
. It has api and packages for php
Why connect to SSH?
Why not ask PHP?
https://www.php.net/manual/en/function.disk-free-s...
disk_free_space
(PHP 4 >= 4.1.0, PHP 5, PHP 7)
disk_free_space - Returns the amount of available space in a directory or file system
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question