Port from config and path from plugin function

This commit is contained in:
Jaroslav Drzik
2021-12-15 10:24:10 +01:00
parent a8e4ddb2e0
commit f868d991b1
2 changed files with 14 additions and 7 deletions

View File

@@ -8,13 +8,19 @@ global $DB, $agents;
$check_arr = [];
$comps = [];
$rs_path = Plugin::getPhpDir('remotesupport');
$pfConfig = new PluginFusioninventoryConfig();
$port = $pfConfig->getValue('agent_port');
$pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer();
foreach (getAllDataFromTable(PluginFusioninventoryAgent::getTable()) as $a) {
$check = [];
$a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($a["computers_id"]);
$check["url"] = "http://" . $a_computerextend["remote_addr"] . ":62354/status";
$check["url"] = "http://" . $a_computerextend["remote_addr"] . ":" . $port . "/status";
$check["id"] = $a["id"];
$check["computers_id"] = $a["computers_id"];
$check["status"] = "unknown";
@@ -33,7 +39,7 @@ $descriptorspec = array(
$cwd = '/tmp';
$env = array('debug' => 'false');
$process = proc_open(__DIR__ . '/check_status', $descriptorspec, $pipes, $cwd, $env);
$process = proc_open($rs_path . '/bin/check_status', $descriptorspec, $pipes, $cwd, $env);
if (is_resource($process)) {
// $pipes now looks like this:

View File

@@ -9,10 +9,8 @@ class PluginRemotesupportRemotesupport extends CommonDBTM
public static function showInfo($item)
{
$fi_path = Plugin::getWebDir('fusioninventory');
// Manage locks pictures
PluginFusioninventoryLock::showLockIcon('Computer');
//PluginFusioninventoryLock::showLockIcon('Computer');
$pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer();
$a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($item->getID());
@@ -75,6 +73,9 @@ class PluginRemotesupportRemotesupport extends CommonDBTM
global $DB;
Toolbox::logInFile("remotsupport", "Starting search of agents\n");
$pfConfig = new PluginFusioninventoryConfig();
$port = $pfConfig->getValue('agent_port');
$rs_path = Plugin::getPhpDir('remotesupport');
$check_arr = [];
$comps = [];
@@ -84,7 +85,7 @@ class PluginRemotesupportRemotesupport extends CommonDBTM
$check = [];
$a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($a["computers_id"]);
$check["url"] = "http://" . $a_computerextend["remote_addr"] . ":62354/status";
$check["url"] = "http://" . $a_computerextend["remote_addr"] . ":" . $port . "/status";
$check["id"] = $a["id"];
$check["computers_id"] = $a["computers_id"];
$check["status"] = "unknown";
@@ -103,7 +104,7 @@ class PluginRemotesupportRemotesupport extends CommonDBTM
$cwd = '/tmp';
$env = array('debug' => 'false');
$process = proc_open(__DIR__ . '/../bin/check_status', $descriptorspec, $pipes, $cwd, $env);
$process = proc_open($rs_path . '/bin/check_status', $descriptorspec, $pipes, $cwd, $env);
if (is_resource($process)) {
// $pipes now looks like this: