jilo-agent/functions.php

43 lines
1.1 KiB
PHP
Raw Normal View History

<?php
// get nginx data
function getNginxStatus() {
$status = trim(shell_exec('systemctl is-active nginx'));
return ($status === 'active') ? 'running' : 'not running';
}
function getNginxConnections() {
$connections = shell_exec("netstat -an | grep ':80' | wc -l");
return intval(trim($connections));
}
2024-09-01 13:40:47 +00:00
// get prosody data
function getProsodyStatus() {
$status = trim(shell_exec('systemctl is-active prosody'));
return ($status === 'active') ? 'running' : 'not running';
}
2024-09-01 13:40:47 +00:00
// get jicofo data
function getJicofoStatus() {
$status = trim(shell_exec('systemctl is-active jicofo'));
return ($status === 'active') ? 'running' : 'not running';
}
2024-09-01 13:49:43 +00:00
function getJicofoStats($command) {
$data = shell_exec($command);
$decodedData = json_decode($data, true);
if (json_last_error() !== JSON_ERROR_NONE) {
return ['error' => 'Failed to decode the JSON reply from the service.'];
}
return $decodedData;
}
2024-09-01 13:40:47 +00:00
// get JVB data
function getJVBStatus() {
$status = trim(shell_exec('systemctl is-active jitsi-videobridge'));
return ($status === 'active') ? 'running' : 'not running';
}
?>