diff --git a/.github/workflows/checkPHP.yml b/.github/workflows/checkPHP.yml index 5a71f971..a6cbfbe3 100644 --- a/.github/workflows/checkPHP.yml +++ b/.github/workflows/checkPHP.yml @@ -12,8 +12,8 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: PHP Syntax Checker (Lint) - uses: StephaneBour/actions-php-lint@8.1 + uses: StephaneBour/actions-php-lint@8.2 with: dir: '.' diff --git a/.vscode/settings.json b/.vscode/settings.json index 8d484bbe..e7d6b117 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,6 +11,7 @@ "CACHEDEV", "cartereseau", "cartereseauautre", + "cartesreseau", "clientlist", "colorhigh", "colorlow", @@ -33,6 +34,7 @@ "Etat", "firmver", "Formated", + "freebsd", "getcfg", "getconf", "getconfiguration", diff --git a/core/class/Monitoring.class.php b/core/class/Monitoring.class.php index 3d609d00..18a46d5f 100644 --- a/core/class/Monitoring.class.php +++ b/core/class/Monitoring.class.php @@ -814,7 +814,8 @@ public function postSave() { $MonitoringCmd->setLogicalId('network'); $MonitoringCmd->setType('info'); $MonitoringCmd->setSubType('string'); - $MonitoringCmd->setDisplay('icon', ''); + // $MonitoringCmd->setDisplay('icon', ''); + $MonitoringCmd->setDisplay('icon', ''); $MonitoringCmd->setDisplay('forceReturnLineBefore', '1'); $MonitoringCmd->setDisplay('forceReturnLineAfter', '1'); $MonitoringCmd->setIsVisible(1); @@ -1922,6 +1923,136 @@ public function postSave() { $orderCmd++; } + // Création des commandes pour les cartes réseau supplémentaires + if ($this->getConfiguration('multi_if', '0') == '1') { + $multi_if_list = $this->getConfiguration('multi_if_list', ''); + if (!empty($multi_if_list)) { + // Nettoyer et parser la liste des cartes réseau + $network_cards = array_map('trim', explode(',', $multi_if_list)); + + foreach ($network_cards as $if_name) { + if (empty($if_name)) { + continue; + } + + // Remplacer les caractères spéciaux par des underscores pour le logicalId + $if_safe = preg_replace('/[^a-zA-Z0-9]/', '_', $if_name); + + // Commande network_infos pour cette interface + $MonitoringCmd = $this->getCmd(null, 'network_infos_' . $if_safe); + if (!is_object($MonitoringCmd)) { + $MonitoringCmd = new MonitoringCmd(); + $MonitoringCmd->setName(__('Infos Réseau', __FILE__) . ' (' . $if_name . ')'); + $MonitoringCmd->setEqLogic_id($this->getId()); + $MonitoringCmd->setLogicalId('network_infos_' . $if_safe); + $MonitoringCmd->setType('info'); + $MonitoringCmd->setSubType('string'); + $MonitoringCmd->setDisplay('icon', ''); + $MonitoringCmd->setDisplay('forceReturnLineBefore', '1'); + $MonitoringCmd->setDisplay('forceReturnLineAfter', '1'); + $MonitoringCmd->setIsVisible(1); + $MonitoringCmd->setOrder($orderCmd++); + $MonitoringCmd->save(); + } else { + $orderCmd++; + } + + // Commande network (TX-RX formaté) pour cette interface + $MonitoringCmd = $this->getCmd(null, 'network_' . $if_safe); + if (!is_object($MonitoringCmd)) { + $MonitoringCmd = new MonitoringCmd(); + $MonitoringCmd->setName(__('Réseau (TX-RX)', __FILE__) . ' (' . $if_name . ')'); + $MonitoringCmd->setEqLogic_id($this->getId()); + $MonitoringCmd->setLogicalId('network_' . $if_safe); + $MonitoringCmd->setType('info'); + $MonitoringCmd->setSubType('string'); + $MonitoringCmd->setDisplay('icon', ''); + $MonitoringCmd->setDisplay('forceReturnLineBefore', '1'); + $MonitoringCmd->setDisplay('forceReturnLineAfter', '1'); + $MonitoringCmd->setIsVisible(1); + $MonitoringCmd->setOrder($orderCmd++); + $MonitoringCmd->save(); + } else { + $orderCmd++; + } + + // Commande network_tx pour cette interface + $MonitoringCmd = $this->getCmd(null, 'network_tx_' . $if_safe); + if (!is_object($MonitoringCmd)) { + $MonitoringCmd = new MonitoringCmd(); + $MonitoringCmd->setName(__('Réseau (TX)', __FILE__) . ' (' . $if_name . ')'); + $MonitoringCmd->setEqLogic_id($this->getId()); + $MonitoringCmd->setLogicalId('network_tx_' . $if_safe); + $MonitoringCmd->setType('info'); + $MonitoringCmd->setSubType('numeric'); + $MonitoringCmd->setUnite('Mo'); + $MonitoringCmd->setDisplay('forceReturnLineBefore', '1'); + $MonitoringCmd->setDisplay('forceReturnLineAfter', '1'); + $MonitoringCmd->setIsVisible(0); + $MonitoringCmd->setOrder($orderCmd++); + $MonitoringCmd->save(); + } else { + $orderCmd++; + } + + // Commande network_rx pour cette interface + $MonitoringCmd = $this->getCmd(null, 'network_rx_' . $if_safe); + if (!is_object($MonitoringCmd)) { + $MonitoringCmd = new MonitoringCmd(); + $MonitoringCmd->setName(__('Réseau (RX)', __FILE__) . ' (' . $if_name . ')'); + $MonitoringCmd->setEqLogic_id($this->getId()); + $MonitoringCmd->setLogicalId('network_rx_' . $if_safe); + $MonitoringCmd->setType('info'); + $MonitoringCmd->setSubType('numeric'); + $MonitoringCmd->setUnite('Mo'); + $MonitoringCmd->setDisplay('forceReturnLineBefore', '1'); + $MonitoringCmd->setDisplay('forceReturnLineAfter', '1'); + $MonitoringCmd->setIsVisible(0); + $MonitoringCmd->setOrder($orderCmd++); + $MonitoringCmd->save(); + } else { + $orderCmd++; + } + + // Commande network_name pour cette interface + $MonitoringCmd = $this->getCmd(null, 'network_name_' . $if_safe); + if (!is_object($MonitoringCmd)) { + $MonitoringCmd = new MonitoringCmd(); + $MonitoringCmd->setName(__('Carte Réseau', __FILE__) . ' (' . $if_name . ')'); + $MonitoringCmd->setEqLogic_id($this->getId()); + $MonitoringCmd->setLogicalId('network_name_' . $if_safe); + $MonitoringCmd->setType('info'); + $MonitoringCmd->setSubType('string'); + $MonitoringCmd->setDisplay('forceReturnLineBefore', '1'); + $MonitoringCmd->setDisplay('forceReturnLineAfter', '1'); + $MonitoringCmd->setIsVisible(1); + $MonitoringCmd->setOrder($orderCmd++); + $MonitoringCmd->save(); + } else { + $orderCmd++; + } + + // Commande network_ip pour cette interface + $MonitoringCmd = $this->getCmd(null, 'network_ip_' . $if_safe); + if (!is_object($MonitoringCmd)) { + $MonitoringCmd = new MonitoringCmd(); + $MonitoringCmd->setName(__('Adresse IP', __FILE__) . ' (' . $if_name . ')'); + $MonitoringCmd->setEqLogic_id($this->getId()); + $MonitoringCmd->setLogicalId('network_ip_' . $if_safe); + $MonitoringCmd->setType('info'); + $MonitoringCmd->setSubType('string'); + $MonitoringCmd->setDisplay('forceReturnLineBefore', '1'); + $MonitoringCmd->setDisplay('forceReturnLineAfter', '1'); + $MonitoringCmd->setIsVisible(1); + $MonitoringCmd->setOrder($orderCmd++); + $MonitoringCmd->save(); + } else { + $orderCmd++; + } + } + } + } + if ($this->getConfiguration('pull_use_custom', '0') == '1') { $cron = cron::byClassAndFunction('Monitoring', 'pullCustom', array('Monitoring_Id' => intval($this->getId()))); if (!is_object($cron)) { @@ -2015,6 +2146,23 @@ public function toHtml($_version = 'dashboard') { 'perso4' => array('icon', 'exec', 'id', 'display', 'collect', 'value', 'name', 'unite', 'colorlow', 'colorhigh', 'stats') ); + // Cartes réseau supplémentaires + if ($this->getConfiguration('multi_if', '0') == '1') { + $multi_if_list = $this->getConfiguration('multi_if_list', ''); + if (!empty($multi_if_list)) { + $network_cards = array_map('trim', explode(',', $multi_if_list)); + foreach ($network_cards as $if_name) { + if (!empty($if_name)) { + $if_safe = preg_replace('/[^a-zA-Z0-9]/', '_', $if_name); + $cmdToReplace['network_infos_' . $if_safe] = array('icon', 'exec', 'id', 'display', 'collect', 'value'); + $cmdToReplace['network_' . $if_safe] = array('icon', 'exec', 'id', 'display', 'collect', 'value'); + $cmdToReplace['network_name_' . $if_safe] = array('exec', 'id'); + $cmdToReplace['network_ip_' . $if_safe] = array('exec', 'id'); + } + } + } + } + // Synology if ($this->getConfiguration('synology') == '1') { // Arrays of Synology commands to add if the corresponding option is enabled @@ -2079,11 +2227,70 @@ public function toHtml($_version = 'dashboard') { $this->getCmdReplace($cmdName, $cmdOptions, $replace); } + // Génération du HTML pour les cartes réseau supplémentaires + $multi_network_html = ''; + if ($this->getConfiguration('multi_if', '0') == '1') { + $multi_if_list = $this->getConfiguration('multi_if_list', ''); + if (!empty($multi_if_list)) { + $network_cards = array_map('trim', explode(',', $multi_if_list)); + foreach ($network_cards as $if_name) { + if (!empty($if_name)) { + $if_safe = preg_replace('/[^a-zA-Z0-9]/', '_', $if_name); + + // Vérifier si les commandes existent + $cmd_infos = $this->getCmd(null, 'network_infos_' . $if_safe); + $cmd_network = $this->getCmd(null, 'network_' . $if_safe); + + if (is_object($cmd_infos) || is_object($cmd_network)) { + // Format des tooltips selon la version (dashboard ou mobile) + if ($version == 'mobile') { + // Format mobile : utilise || au lieu de
+ $title_infos = 'Infos Réseau (' . $if_name . ') || Date valeur : #network_infos_' . $if_safe . '_value# || Date collecte : #network_infos_' . $if_safe . '_collect#'; + $title_network = 'Trafic Réseau (#network_name_' . $if_safe . '# / #network_ip_' . $if_safe . '#) || Date valeur : #network_' . $if_safe . '_value# || Date collecte : #network_' . $if_safe . '_collect#'; + } else { + // Format dashboard : utilise
+ $title_infos = 'Infos Réseau (' . $if_name . ')
Date de valeur : #network_infos_' . $if_safe . '_value#
Date de collecte : #network_infos_' . $if_safe . '_collect#
'; + $title_network = 'Trafic Réseau (#network_name_' . $if_safe . '# / #network_ip_' . $if_safe . '#)
Date de valeur : #network_' . $if_safe . '_value#
Date de collecte : #network_' . $if_safe . '_collect#
'; + } + + $multi_network_html .= ' + +
+ #network_infos_' . $if_safe . '_icon# + +
+ +
+ #network_' . $if_safe . '_icon# + +
+ '; + } + } + } + } + } + // Le HTML des cartes réseau sera remplacé après que toutes les variables soient définies + $replace['#multi_network_cards#'] = $multi_network_html; + // Commandes Actions foreach ($this->getCmd('action') as $cmd) { $replace['#cmd_' . $cmd->getLogicalId() . '_id#'] = $cmd->getId(); $replace['#cmd_' . $cmd->getLogicalId() . '_display#'] = (is_object($cmd) && $cmd->getIsVisible()) ? "inline-block" : "none"; } + + // Remplacer les variables dans le HTML des cartes réseau supplémentaires + if (!empty($multi_network_html)) { + $replace['#multi_network_cards#'] = template_replace($replace, $multi_network_html); + } // Use a specific template for AsusWRT and default for others if ($this->getConfiguration('asuswrt') == '1') { @@ -2538,7 +2745,7 @@ public function getRemoteArchKeys($hostId, $osType = '') { return [$archKey, $archSubKey, $archKeyType, $ARMv, $distri_name_value]; } - public function getCommands($key, $subKey = '', $cartereseau = '', $confLocalorRemote = 'local') { + public function getCommands($key, $subKey = '', $cartereseau = '', $cartesreseau_multi = [], $confLocalorRemote = 'local') { if (!empty($subKey)) { log::add('Monitoring', 'debug', '['. $this->getName() .'][getCommands] Key / SubKey (LocalorRemote) :: ' . $key . ' / ' . $subKey . ' (' . $confLocalorRemote . ')'); } else { @@ -2559,8 +2766,10 @@ public function getCommands($key, $subKey = '', $cartereseau = '', $confLocalorR $memory_command = "LC_ALL=C free 2>/dev/null | grep 'Mem' | head -1 | awk '{ print $2,$3,$4,$6,$7 }'"; $swap_command = "LC_ALL=C free 2>/dev/null | awk -F':' '/Swap/ { print $2 }' | awk '{ print $1,$2,$3}'"; - $network_command = "cat /proc/net/dev 2>/dev/null | grep \"" . $cartereseau . ":\" | awk '{ print $1,$2,$10 }' | awk -v ORS=\"\" '{ gsub(/:/, \"\"); print }'"; - $network_ip_command = "LC_ALL=C ip -o -f inet a 2>/dev/null | grep \"" . $cartereseau . " \" | awk '{ print $4 }' | awk -v ORS=\"\" '{ gsub(/\/[0-9]+/, \"\"); print }'"; + $network_command = "cat /proc/net/dev 2>/dev/null | grep \"%s:\" | awk '{ print $1,$2,$10 }' | awk -v ORS=\"\" '{ gsub(/:/, \"\"); print }'"; + $network_ip_command = "LC_ALL=C ip -o -f inet a 2>/dev/null | grep \"%s \" | awk '{ print $4 }' | awk -v ORS=\"\" '{ gsub(/\/[0-9]+/, \"\"); print }'"; + $network_freebsd_command = "netstat -b -i -n -f inet | grep '%s' | awk -v ORS=\"\" '{ print $1,$8,$11 }'"; + $network_ip_freebsd_command = "ifconfig -u %s | awk -v ORS=\"\" '/inet / { print $2 }'"; $load_avg_command = "cat /proc/loadavg 2>/dev/null"; $uptime_command = "awk '{ print $1 }' /proc/uptime 2>/dev/null | awk -v ORS=\"\" '{ gsub(/^[[:space:]]+|[[:space:]]+$/, \"\"); print }'"; $release_command = "awk -F'=' '/%s/ { print $2 }' /etc/*-release 2>/dev/null | awk -v ORS=\"\" '{ gsub(/\"/, \"\"); print }'"; @@ -2595,9 +2804,17 @@ public function getCommands($key, $subKey = '', $cartereseau = '', $confLocalorR 'memory' => $memory_command, 'swap' => $swap_command, 'hdd' => sprintf($hdd_command, '/$'), - 'network' => $network_command, // on récupère le nom de la carte en plus pour l'afficher dans les infos - 'network_ip' => $network_ip_command, + 'network' => sprintf($network_command, $cartereseau), // on récupère le nom de la carte en plus pour l'afficher dans les infos + 'network_ip' => sprintf($network_ip_command, $cartereseau), ]; + + // Ajout des commandes pour les cartes réseau supplémentaires + if (!empty($cartesreseau_multi)) { + foreach ($cartesreseau_multi as $if_safe => $if_name) { + $cmdLocalCommon['network_' . $if_safe] = sprintf($network_command, $if_name); + $cmdLocalCommon['network_ip_' . $if_safe] = sprintf($network_ip_command, $if_name); + } + } // Local Specific $cmdLocalSpecific = [ @@ -2650,9 +2867,17 @@ public function getCommands($key, $subKey = '', $cartereseau = '', $confLocalorR 'load_avg' => $load_avg_command, 'memory' => $memory_command, 'swap' => $swap_command, - 'network' => $network_command, // on récupère le nom de la carte en plus pour l'afficher dans les infos - 'network_ip' => $network_ip_command, + 'network' => sprintf($network_command, $cartereseau), // on récupère le nom de la carte en plus pour l'afficher dans les infos + 'network_ip' => sprintf($network_ip_command, $cartereseau), ]; + + // Ajout des commandes pour les cartes réseau supplémentaires (remote) + if (!empty($cartesreseau_multi)) { + foreach ($cartesreseau_multi as $if_safe => $if_name) { + $cmdRemoteCommon['network_' . $if_safe] = sprintf($network_command, $if_name); + $cmdRemoteCommon['network_ip_' . $if_safe] = sprintf($network_ip_command, $if_name); + } + } // Remote Specific $cmdRemoteSpecific = [ @@ -2737,8 +2962,8 @@ public function getCommands($key, $subKey = '', $cartereseau = '', $confLocalorR 'load_avg' => "sysctl -n vm.loadavg | awk '{ print $2, $3, $4 }'", 'memory' => "total=\$(sysctl -n hw.physmem); pagesize=\$(sysctl -n hw.pagesize); free=\$((\$(sysctl -n vm.stats.vm.v_free_count) * \$pagesize)); inactive=\$(($(sysctl -n vm.stats.vm.v_inactive_count) * \$pagesize)); cache=\$((\$(sysctl -n vm.stats.vm.v_cache_count) * \$pagesize)); wired=\$((\$(sysctl -n vm.stats.vm.v_wire_count) * \$pagesize)); used=\$((\$total - (\$free + \$inactive + \$cache))); available=\$((\$free + \$inactive + \$cache)); echo \"\$total \$used \$free \$cache \$available\"", 'swap' => "swapinfo | awk 'NR>1 {print $2, $3, $4}'", - 'network' => "netstat -b -i -n -f inet | grep '" . $cartereseau . "' | awk -v ORS=\"\" '{ print $1,$8,$11 }'", // on récupère le nom de la carte en plus pour l'afficher dans les infos - 'network_ip' => "ifconfig -u " . $cartereseau . " | awk -v ORS=\"\" '/inet / { print $2 }'", + 'network' => sprintf($network_freebsd_command, $cartereseau), // on récupère le nom de la carte en plus pour l'afficher dans les infos + 'network_ip' => sprintf($network_ip_freebsd_command, $cartereseau), 'cpu_nb' => "sysctl hw.ncpu | awk '{ print $2}'", 'cpu_freq' => [ 1 => ['cmd', "sysctl -n 'dev.cpu.0.freq' 2>/dev/null"], @@ -2844,6 +3069,14 @@ public function getCommands($key, $subKey = '', $cartereseau = '', $confLocalorR 'hdd' => sprintf($hdd_command_qnap, '/share/CACHEDEV[1-9]_DATA$'), ], ]; + + // Ajout des cartes réseau supplémentaires pour FreeBSD + if (!empty($cartesreseau_multi)) { + foreach ($cartesreseau_multi as $if_safe => $if_name) { + $cmdRemoteSpecific['FreeBSD']['network_' . $if_safe] = sprintf($network_freebsd_command, $if_name); + $cmdRemoteSpecific['FreeBSD']['network_ip_' . $if_safe] = sprintf($network_ip_freebsd_command, $if_name); + } + } $cmdRemoteSpecific['armv7l'] = &$cmdRemoteSpecific['aarch64']; // Included OS : OSMC, LibreELEC $cmdRemoteSpecific['mips64'] = &$cmdRemoteSpecific['aarch64']; @@ -3088,7 +3321,7 @@ public function formatCPU($_cpu_nb, $_cpu_freq, $_cpu_temp, $_OS, $_equipement) public function formatNetwork($_network_txrx, $_network_ip, $_equipement) { // Network TX, Network RX, Network Name, Network Ip, Text - $network_ip = isset($_network_ip) ? $_network_ip : ''; + $network_ip = isset($_network_ip) && !empty($_network_ip) ? $_network_ip : 'N/A'; // Init result $result = [0.00, 0.00, '', $network_ip, '', '']; @@ -3407,12 +3640,26 @@ public function getInformations() { $isQNAP = ($this->getConfiguration('qnap') == '1') ? true : false; $isAsusWRT = ($this->getConfiguration('asuswrt') == '1') ? true : false; + // Préparation de la liste des cartes réseau supplémentaires + $cartesreseau_multi = []; + if ($this->getConfiguration('multi_if', '0') == '1') { + $multi_if_list = $this->getConfiguration('multi_if_list', ''); + if (!empty($multi_if_list)) { + $network_cards = array_map('trim', explode(',', $multi_if_list)); + foreach ($network_cards as $if_name) { + if (!empty($if_name)) { + $if_safe = preg_replace('/[^a-zA-Z0-9]/', '_', $if_name); + $cartesreseau_multi[$if_safe] = $if_name; + } + } + } + } + // Configuration distante if ($confLocalOrRemote == 'distant' && $this->getIsEnable()) { [$cnx_ssh, $hostId] = $this->connectSSH(); if ($cnx_ssh == 'OK') { - // OS Type $osType = $isSynology ? "Synology" : ($isAsusWRT ? "AsusWRT" : ($isQNAP ? "QNAP" : '')); @@ -3426,7 +3673,7 @@ public function getInformations() { } $cartereseau = $this->getNetworkCard($this->getConfiguration('cartereseau'), 'remote', $hostId, $archKey); - $commands = $this->getCommands($archKey, $archSubKey, $cartereseau, 'remote'); + $commands = $this->getCommands($archKey, $archSubKey, $cartereseau, $cartesreseau_multi, 'remote'); $ARMv = empty($ARMv) ? ($commands['ARMv'][0] === 'cmd' ? $this->execSSH($hostId, $commands['ARMv'][1], 'ARMv') : $commands['ARMv'][1]) : $ARMv; @@ -3450,6 +3697,18 @@ public function getInformations() { $network_value = $this->execSSH($hostId, $commands['network'], 'ReseauRXTX'); $network_ip_value = $this->execSSH($hostId, $commands['network_ip'], 'ReseauIP'); + + // Récupération des informations des cartes réseau supplémentaires (mode distant) + $multi_if_values = []; + if (!empty($cartesreseau_multi)) { + foreach ($cartesreseau_multi as $if_safe => $if_name) { + $multi_if_values[$if_safe] = [ + 'network_value' => $this->execSSH($hostId, $commands['network_' . $if_safe], 'ReseauRXTX_' . $if_name), + 'network_ip_value' => $this->execSSH($hostId, $commands['network_ip_' . $if_safe], 'ReseauIP_' . $if_name) + ]; + } + } + $cpu_nb = $this->execSSH($hostId, $commands['cpu_nb'], 'NbCPU'); extract($this->getCPUFreq($commands['cpu_freq'], $equipement, 'remote', $hostId)); @@ -3561,11 +3820,20 @@ public function getInformations() { $perso4_cmd = $this->getCmdPerso('perso4'); $perso4 = !empty($perso4_cmd) ? $this->execSSH($hostId, $perso4_cmd, 'Perso4') : ''; + // Fermeture explicite de la connexion SSH + if (class_exists('sshmanager') && method_exists('sshmanager', 'closeConnection')) { + try { + sshmanager::closeConnection($hostId); + log::add('Monitoring', 'debug', '['. $this->getName() .'][SSH-CNX] Connexion SSH fermée'); + } catch (Exception $e) { + log::add('Monitoring', 'warning', '['. $this->getName() .'][SSH-CNX] Erreur lors de la fermeture :: ' . $e->getMessage()); + } + } } } + // Configuration locale elseif ($this->getConfiguration('localoudistant') == 'local' && $this->getIsEnable()) { $cnx_ssh = 'No'; - [$archKey, $archSubKey, $archKeyType, $ARMv] = $this->getLocalArchKeys(); if (!empty($archSubKey)) { @@ -3575,7 +3843,7 @@ public function getInformations() { } $cartereseau = $this->getNetworkCard($this->getConfiguration('cartereseau'), 'local'); - $commands = $this->getCommands($archKey, $archSubKey, $cartereseau, 'local'); + $commands = $this->getCommands($archKey, $archSubKey, $cartereseau, $cartesreseau_multi, 'local'); $ARMv = empty($ARMv) ? ($commands['ARMv'][0] === 'cmd' ? $this->execSRV($commands['ARMv'][1], 'ARMv') : $commands['ARMv'][1]) : $ARMv; @@ -3588,6 +3856,18 @@ public function getInformations() { $swap_value = $this->execSRV($commands['swap'], 'Swap'); $network_value = $this->execSRV($commands['network'], 'ReseauRXTX'); $network_ip_value = $this->execSRV($commands['network_ip'], 'ReseauIP'); + + // Récupération des informations des cartes réseau supplémentaires (mode local) + $multi_if_values = []; + if (!empty($cartesreseau_multi)) { + foreach ($cartesreseau_multi as $if_safe => $if_name) { + $multi_if_values[$if_safe] = [ + 'network_value' => $this->execSRV($commands['network_' . $if_safe], 'ReseauRXTX_' . $if_name), + 'network_ip_value' => $this->execSRV($commands['network_ip_' . $if_safe], 'ReseauIP_' . $if_name) + ]; + } + } + $cpu_nb = $this->execSRV($commands['cpu_nb'], 'NbCPU'); extract($this->getHDD($commands['hdd'], $equipement)); @@ -3626,12 +3906,10 @@ public function getInformations() { // Perso4 Command $perso4_cmd = $this->getCmdPerso('perso4'); $perso4 = !empty($perso4_cmd) ? $this->execSRV($perso4_cmd, 'Perso4') : ''; - } // Traitement des données récupérées if (isset($cnx_ssh)) { - // Connexion Local ou Connexion SSH OK if ($this->getConfiguration('localoudistant') == 'local' || $cnx_ssh == 'OK') { @@ -3760,6 +4038,19 @@ public function getInformations() { 'perso3' => $perso3, 'perso4' => $perso4 ); + + // Ajout des données des cartes réseau supplémentaires dans $dataresult + if (!empty($multi_if_values)) { + foreach ($multi_if_values as $if_safe => $if_data) { + [$if_tx, $if_rx, $if_name, $if_ip, $if_network, $if_infos] = $this->formatNetwork($if_data['network_value'], $if_data['network_ip_value'], $equipement); + $dataresult['network_tx_' . $if_safe] = $if_tx; + $dataresult['network_rx_' . $if_safe] = $if_rx; + $dataresult['network_name_' . $if_safe] = $if_name; + $dataresult['network_ip_' . $if_safe] = $if_ip; + $dataresult['network_' . $if_safe] = $if_network; + $dataresult['network_infos_' . $if_safe] = $if_infos; + } + } $dataresult_stats = array( 'load_avg_1mn' => 2, @@ -3954,6 +4245,17 @@ function getCaseAction($paramaction) { $poweroff = $this->execSSH($hostId, $poweroffcmd, 'PowerOff'); break; } + + // Fermeture explicite de la connexion SSH + if (class_exists('sshmanager') && method_exists('sshmanager', 'closeConnection')) { + try { + sshmanager::closeConnection($hostId); + log::add('Monitoring', 'debug', '['. $equipement .'][SSH-CNX] Connexion SSH fermée'); + } catch (Exception $e) { + log::add('Monitoring', 'warning', '['. $equipement .'][SSH-CNX] Erreur lors de la fermeture :: ' . $e->getMessage()); + } + } + } else { log::add('Monitoring', 'error', '['. $equipement .'][SSH] Reboot/Shutdown :: Connection SSH KO'); } diff --git a/core/i18n/de_DE.json b/core/i18n/de_DE.json index c3404a77..5d5cc0fc 100644 --- a/core/i18n/de_DE.json +++ b/core/i18n/de_DE.json @@ -146,6 +146,7 @@ "1er port Wi-Fi": "1. Wi-Fi-Anschluss", "401 - Accès non autorisé": "401 - Unberechtigter Zugriff", "A cocher pour afficher les tendances (statistiques) sur le widget du dashboard": "Anzukreuzen, um Trends (Statistiken) auf dem Dashboard-Widget anzuzeigen", + "A cocher pour monitorer des cartes réseau supplémentaires": "Aktivieren Sie diese Option, um zusätzliche Netzwerkkarten zu überwachen.", "A cocher pour monitorer un NAS QNAP": "Aktivieren Sie diese Option, um ein QNAP-NAS zu überwachen", "A cocher pour monitorer un NAS Synology": "Zur Überwachung eines Synology NAS ankreuzen", "A cocher pour monitorer un Routeur AsusWRT": "Aktivieren Sie diese Option, um einen AsusWRT-Router zu überwachen", @@ -168,6 +169,7 @@ "Auto-Actualisation (Cron)": "Selbstaktualisierung (Cron)", "Autre": "Andere", "Carte Réseau": "Netzwerkkarte", + "Cartes Réseau +": "Netzwerkkarten +", "Catégorie": "Kategorie", "Choisir un hôte dans la liste ou créez en un nouveau": "Wählen Sie einen Host aus der Liste oder erstellen Sie einen neuen", "Cliquer sur ? pour afficher l'assistant cron": "Klicken Sie auf ?, um den Cron-Assistenten anzuzeigen", @@ -202,6 +204,7 @@ "Nom de l'équipement": "Name des Geräts", "Nom de l'équipement Monitoring": "Name des Geräts Monitoring", "Nom de la carte réseau": "Name der Netzwerkkarte", + "Noms des interfaces": "Bezeichnungen der Schnittstellen", "Objet parent": "Übergeordnetes Objekt", "Options": "Optionen", "Port WiFi 2.4G": "2,4-GHz-WLAN-Anschluss", @@ -215,6 +218,7 @@ "Statistiques": "Statistiken", "Supprimer": "Löschen", "Synology": "Synology", + "Séparer les noms par des virgules": "Namen durch Kommas trennen", "Temp (Alt)": "Temp (Alt)", "Tendance": "Trend", "Timeout SRV": "SRV Timeout", @@ -227,7 +231,8 @@ "[ATTENTION] La prochaine version du plugin Monitoring ne supportera plus les versions de Jeedom < \"4.4\".
Veuillez mettre à jour Jeedom pour bénéficier des dernières fonctionnalités.

En attendant, il est conseillé de bloquer les mises à jour du plugin Monitoring.": "[ACHTUNG] Die nächste Version des Monitoring-Plugins wird Jeedom-Versionen < \"4.4\" nicht mehr unterstützen.
Bitte aktualisieren Sie Jeedom, um die neuesten Funktionen zu erhalten.

In der Zwischenzeit ist es ratsam, Updates des Monitoring-Plugins zu blockieren.", "[PLUGIN] Impossible de charger le fichier sshmanager.helper.js (Vérifiez les dépendances)": "[PLUGIN] Die Datei sshmanager.helper.js konnte nicht geladen werden (Überprüfen Sie die Abhängigkeiten)", "[Plugin :: Monitoring] Attention - Version Jeedom !": "[Plugin :: Monitoring] Achtung - Jeedom Version!", - "eth1 : 2ème port Ethernet, wlan1 : 2ème port Wi-Fi...": "eth1: 2. Ethernet-Anschluss, wlan1: 2. Wi-Fi-Anschluss..." + "eth1 : 2ème port Ethernet, wlan1 : 2ème port Wi-Fi...": "eth1: 2. Ethernet-Anschluss, wlan1: 2. Wi-Fi-Anschluss...", + "eth2, eth5, enp0s3": "eth2, eth5, enp0s3" }, "plugins\/Monitoring\/plugin_info\/configuration.php": { "Activer ou Désactiver l'affichage des statistiques mémoire de l'équipement local dans les logs": "Aktivieren oder Deaktivieren der Anzeige der Speicherstatistiken des lokalen Geräts in den Protokollen", diff --git a/core/i18n/en_US.json b/core/i18n/en_US.json index 0e2e8121..7d41154b 100644 --- a/core/i18n/en_US.json +++ b/core/i18n/en_US.json @@ -146,6 +146,7 @@ "1er port Wi-Fi": "1st Wi-Fi port", "401 - Accès non autorisé": "401 - Unauthorized access", "A cocher pour afficher les tendances (statistiques) sur le widget du dashboard": "Check to display trends (statistics) on the dashboard widget", + "A cocher pour monitorer des cartes réseau supplémentaires": "Check this box to monitor additional network cards", "A cocher pour monitorer un NAS QNAP": "Check this box to monitor a QNAP NAS", "A cocher pour monitorer un NAS Synology": "Check to monitor a Synology NAS", "A cocher pour monitorer un Routeur AsusWRT": "Check this box to monitor an AsusWRT router", @@ -168,6 +169,7 @@ "Auto-Actualisation (Cron)": "Auto-update (Cron)", "Autre": "Other", "Carte Réseau": "Network card", + "Cartes Réseau +": "Network Cards +", "Catégorie": "Category", "Choisir un hôte dans la liste ou créez en un nouveau": "Choose a host from the list or create a new one", "Cliquer sur ? pour afficher l'assistant cron": "Click on ? to display the cron wizard", @@ -202,6 +204,7 @@ "Nom de l'équipement": "Equipment name", "Nom de l'équipement Monitoring": "Equipment name Monitoring", "Nom de la carte réseau": "Network card name", + "Noms des interfaces": "Interface names", "Objet parent": "Parent object", "Options": "Options", "Port WiFi 2.4G": "2.4G WiFi port", @@ -215,6 +218,7 @@ "Statistiques": "Statistics", "Supprimer": "Delete", "Synology": "Synology", + "Séparer les noms par des virgules": "Separate names with commas", "Temp (Alt)": "Temp (Alt)", "Tendance": "Trend", "Timeout SRV": "Timeout SRV", @@ -227,7 +231,8 @@ "[ATTENTION] La prochaine version du plugin Monitoring ne supportera plus les versions de Jeedom < \"4.4\".
Veuillez mettre à jour Jeedom pour bénéficier des dernières fonctionnalités.

En attendant, il est conseillé de bloquer les mises à jour du plugin Monitoring.": "[ATTENTION] The next version of the Monitoring plugin will no longer support Jeedom versions < \"4.4\".
Please update Jeedom to benefit from the latest features.

In the meantime, it is advisable to block updates to the Monitoring plugin.", "[PLUGIN] Impossible de charger le fichier sshmanager.helper.js (Vérifiez les dépendances)": "[PLUGIN] Unable to load sshmanager.helper.js (Check dependencies)", "[Plugin :: Monitoring] Attention - Version Jeedom !": "[Plugin :: Monitoring] Warning - Jeedom version!", - "eth1 : 2ème port Ethernet, wlan1 : 2ème port Wi-Fi...": "eth1: 2nd Ethernet port, wlan1: 2nd Wi-Fi port..." + "eth1 : 2ème port Ethernet, wlan1 : 2ème port Wi-Fi...": "eth1: 2nd Ethernet port, wlan1: 2nd Wi-Fi port...", + "eth2, eth5, enp0s3": "eth2, eth5, enp0s3" }, "plugins\/Monitoring\/plugin_info\/configuration.php": { "Activer ou Désactiver l'affichage des statistiques mémoire de l'équipement local dans les logs": "Enable or disable the display of local device memory statistics in logs", diff --git a/core/i18n/es_ES.json b/core/i18n/es_ES.json index 9d44a97a..73fe3a8d 100644 --- a/core/i18n/es_ES.json +++ b/core/i18n/es_ES.json @@ -146,6 +146,7 @@ "1er port Wi-Fi": "1er puerto Wi-Fi", "401 - Accès non autorisé": "401 - Acceso no autorizado", "A cocher pour afficher les tendances (statistiques) sur le widget du dashboard": "Marca para mostrar tendencias (estadísticas) en el widget del panel de control", + "A cocher pour monitorer des cartes réseau supplémentaires": "Marque esta casilla para supervisar tarjetas de red adicionales.", "A cocher pour monitorer un NAS QNAP": "Marcar para supervisar un NAS QNAP", "A cocher pour monitorer un NAS Synology": "Comprobación para supervisar un Synology NAS", "A cocher pour monitorer un Routeur AsusWRT": "Marcar para supervisar un router AsusWRT", @@ -168,6 +169,7 @@ "Auto-Actualisation (Cron)": "Actualización automática (Cron)", "Autre": "Otros", "Carte Réseau": "Tarjeta de red", + "Cartes Réseau +": "Tarjetas de red +", "Catégorie": "Categoría", "Choisir un hôte dans la liste ou créez en un nouveau": "Elija un host de la lista o cree uno nuevo", "Cliquer sur ? pour afficher l'assistant cron": "Haga clic en ? para mostrar el asistente de cron", @@ -202,6 +204,7 @@ "Nom de l'équipement": "Nombre del equipo", "Nom de l'équipement Monitoring": "Nombre del equipo Supervisión", "Nom de la carte réseau": "Nombre de la tarjeta de red", + "Noms des interfaces": "Nombres de las interfaces", "Objet parent": "Objeto principal", "Options": "Opciones", "Port WiFi 2.4G": "Puerto WiFi 2.4G", @@ -215,6 +218,7 @@ "Statistiques": "Estadísticas", "Supprimer": "Borrar", "Synology": "Synology", + "Séparer les noms par des virgules": "Separe los nombres con comas.", "Temp (Alt)": "Temp (Alt)", "Tendance": "Tendencias", "Timeout SRV": "Tiempo de espera SRV", @@ -227,7 +231,8 @@ "[ATTENTION] La prochaine version du plugin Monitoring ne supportera plus les versions de Jeedom < \"4.4\".
Veuillez mettre à jour Jeedom pour bénéficier des dernières fonctionnalités.

En attendant, il est conseillé de bloquer les mises à jour du plugin Monitoring.": "[AVISO] La próxima versión del plugin de Monitorización dejará de ser compatible con versiones de Jeedom < \"4.4\".
Por favor, actualice Jeedom para beneficiarse de las últimas funcionalidades.

Mientras tanto, es recomendable bloquear las actualizaciones del plugin de Monitorización.", "[PLUGIN] Impossible de charger le fichier sshmanager.helper.js (Vérifiez les dépendances)": "[PLUGIN] No se puede cargar sshmanager.helper.js (Comprobar dependencias)", "[Plugin :: Monitoring] Attention - Version Jeedom !": "[Plugin :: Monitorización] Advertencia - ¡Versión Jeedom!", - "eth1 : 2ème port Ethernet, wlan1 : 2ème port Wi-Fi...": "eth1: 2º puerto Ethernet, wlan1: 2º puerto Wi-Fi..." + "eth1 : 2ème port Ethernet, wlan1 : 2ème port Wi-Fi...": "eth1: 2º puerto Ethernet, wlan1: 2º puerto Wi-Fi...", + "eth2, eth5, enp0s3": "eth2, eth5, enp0s3" }, "plugins\/Monitoring\/plugin_info\/configuration.php": { "Activer ou Désactiver l'affichage des statistiques mémoire de l'équipement local dans les logs": "Activar o desactivar la visualización de las estadísticas de memoria del equipo local en los registros.", diff --git a/core/i18n/it_IT.json b/core/i18n/it_IT.json index eb3fd0bc..11eae3a8 100644 --- a/core/i18n/it_IT.json +++ b/core/i18n/it_IT.json @@ -146,6 +146,7 @@ "1er port Wi-Fi": "1a porta Wi-Fi", "401 - Accès non autorisé": "401 - Accesso non autorizzato", "A cocher pour afficher les tendances (statistiques) sur le widget du dashboard": "Spunta per visualizzare i trend (statistiche) sul widget del cruscotto", + "A cocher pour monitorer des cartes réseau supplémentaires": "Da selezionare per monitorare schede di rete aggiuntive", "A cocher pour monitorer un NAS QNAP": "Da selezionare per monitorare un NAS QNAP", "A cocher pour monitorer un NAS Synology": "Controllare per monitorare un NAS Synology", "A cocher pour monitorer un Routeur AsusWRT": "Da selezionare per monitorare un router AsusWRT", @@ -168,6 +169,7 @@ "Auto-Actualisation (Cron)": "Aggiornamento automatico (Cron)", "Autre": "Altro", "Carte Réseau": "Scheda di rete", + "Cartes Réseau +": "Schede di rete +", "Catégorie": "Categoria", "Choisir un hôte dans la liste ou créez en un nouveau": "Scegliere un host dall'elenco o crearne uno nuovo", "Cliquer sur ? pour afficher l'assistant cron": "Fare clic su ? per visualizzare la procedura guidata di cron", @@ -202,6 +204,7 @@ "Nom de l'équipement": "Nome dell'apparecchiatura", "Nom de l'équipement Monitoring": "Nome dell'apparecchiatura Monitoraggio", "Nom de la carte réseau": "Nome della scheda di rete", + "Noms des interfaces": "Nomi delle interfacce", "Objet parent": "Oggetto genitore", "Options": "Opzioni", "Port WiFi 2.4G": "Porta WiFi 2.4G", @@ -215,6 +218,7 @@ "Statistiques": "Statistiche", "Supprimer": "Cancellare", "Synology": "Synology", + "Séparer les noms par des virgules": "Separare i nomi con virgole", "Temp (Alt)": "Temperatura (Alt)", "Tendance": "Tendenze", "Timeout SRV": "Timeout SRV", @@ -227,7 +231,8 @@ "[ATTENTION] La prochaine version du plugin Monitoring ne supportera plus les versions de Jeedom < \"4.4\".
Veuillez mettre à jour Jeedom pour bénéficier des dernières fonctionnalités.

En attendant, il est conseillé de bloquer les mises à jour du plugin Monitoring.": "[La prossima versione del plugin Monitoring non supporterà più le versioni di Jeedom < \"4.4\".
Si prega di aggiornare Jeedom per usufruire delle ultime funzionalità.

Nel frattempo, si consiglia di bloccare gli aggiornamenti del plugin Monitoring.", "[PLUGIN] Impossible de charger le fichier sshmanager.helper.js (Vérifiez les dépendances)": "[PLUGIN] Impossibile caricare sshmanager.helper.js (controllare le dipendenze)", "[Plugin :: Monitoring] Attention - Version Jeedom !": "[Plugin :: Monitoraggio] Attenzione - versione Jeedom!", - "eth1 : 2ème port Ethernet, wlan1 : 2ème port Wi-Fi...": "eth1: seconda porta Ethernet, wlan1: seconda porta Wi-Fi..." + "eth1 : 2ème port Ethernet, wlan1 : 2ème port Wi-Fi...": "eth1: seconda porta Ethernet, wlan1: seconda porta Wi-Fi...", + "eth2, eth5, enp0s3": "eth2, eth5, enp0s3" }, "plugins\/Monitoring\/plugin_info\/configuration.php": { "Activer ou Désactiver l'affichage des statistiques mémoire de l'équipement local dans les logs": "Attivare o disattivare la visualizzazione delle statistiche di memoria dell'apparecchiatura locale nei log", diff --git a/core/i18n/pt_PT.json b/core/i18n/pt_PT.json index a3b8c42f..b9eb2e7d 100644 --- a/core/i18n/pt_PT.json +++ b/core/i18n/pt_PT.json @@ -146,6 +146,7 @@ "1er port Wi-Fi": "1ª porta Wi-Fi", "401 - Accès non autorisé": "401 - Acesso não autorizado", "A cocher pour afficher les tendances (statistiques) sur le widget du dashboard": "Assinalar para apresentar tendências (estatísticas) no widget do painel de controlo", + "A cocher pour monitorer des cartes réseau supplémentaires": "Marque esta opção para monitorizar placas de rede adicionais", "A cocher pour monitorer un NAS QNAP": "Marque esta opção para monitorizar um NAS QNAP", "A cocher pour monitorer un NAS Synology": "Verificação para monitorizar um Synology NAS", "A cocher pour monitorer un Routeur AsusWRT": "Marque esta opção para monitorizar um router AsusWRT", @@ -168,6 +169,7 @@ "Auto-Actualisation (Cron)": "Atualização automática (Cron)", "Autre": "Outros", "Carte Réseau": "Placa de rede", + "Cartes Réseau +": "Placas de rede +", "Catégorie": "Categoria", "Choisir un hôte dans la liste ou créez en un nouveau": "Escolha um anfitrião da lista ou crie um novo", "Cliquer sur ? pour afficher l'assistant cron": "Clique em ? para visualizar o assistente de cron", @@ -202,6 +204,7 @@ "Nom de l'équipement": "Nome do equipamento", "Nom de l'équipement Monitoring": "Nome do equipamento Monitorização", "Nom de la carte réseau": "Nome da placa de rede", + "Noms des interfaces": "Nomes das interfaces", "Objet parent": "Objeto principal", "Options": "Opções", "Port WiFi 2.4G": "Porta WiFi 2.4G", @@ -215,6 +218,7 @@ "Statistiques": "Estatísticas", "Supprimer": "Eliminar", "Synology": "Synology", + "Séparer les noms par des virgules": "Separe os nomes por vírgulas", "Temp (Alt)": "Temp (Alt)", "Tendance": "Tendências", "Timeout SRV": "Tempo limite SRV", @@ -227,7 +231,8 @@ "[ATTENTION] La prochaine version du plugin Monitoring ne supportera plus les versions de Jeedom < \"4.4\".
Veuillez mettre à jour Jeedom pour bénéficier des dernières fonctionnalités.

En attendant, il est conseillé de bloquer les mises à jour du plugin Monitoring.": "[AVISO] A próxima versão do plugin de Monitorização deixará de suportar as versões do Jeedom < \"4.4\".
Por favor, actualize o Jeedom para beneficiar das últimas funcionalidades.

Entretanto, é aconselhável bloquear as actualizações do plugin de Monitorização.", "[PLUGIN] Impossible de charger le fichier sshmanager.helper.js (Vérifiez les dépendances)": "[PLUGIN] Não foi possível carregar sshmanager.helper.js (Verificar dependências)", "[Plugin :: Monitoring] Attention - Version Jeedom !": "[Plugin :: Monitorização] Aviso - Versão do Jeedom!", - "eth1 : 2ème port Ethernet, wlan1 : 2ème port Wi-Fi...": "eth1: 2ª porta Ethernet, wlan1: 2ª porta Wi-Fi..." + "eth1 : 2ème port Ethernet, wlan1 : 2ème port Wi-Fi...": "eth1: 2ª porta Ethernet, wlan1: 2ª porta Wi-Fi...", + "eth2, eth5, enp0s3": "eth2, eth5, enp0s3" }, "plugins\/Monitoring\/plugin_info\/configuration.php": { "Activer ou Désactiver l'affichage des statistiques mémoire de l'équipement local dans les logs": "Ativar ou desativar a exibição das estatísticas de memória do equipamento local nos registos", diff --git a/core/template/dashboard/Monitoring.html b/core/template/dashboard/Monitoring.html index d1979b04..e412847a 100644 --- a/core/template/dashboard/Monitoring.html +++ b/core/template/dashboard/Monitoring.html @@ -284,6 +284,8 @@ document.getElementById('network#id#').innerHTML = '#network#'; } + + #multi_network_cards#
#hdd_icon# diff --git a/core/template/mobile/Monitoring.html b/core/template/mobile/Monitoring.html index 7b8236a0..b525a877 100644 --- a/core/template/mobile/Monitoring.html +++ b/core/template/mobile/Monitoring.html @@ -247,6 +247,8 @@ document.getElementById('network#id#').innerHTML = '#network#'; } + + #multi_network_cards#
#hdd_icon# diff --git a/desktop/js/Monitoring.js b/desktop/js/Monitoring.js index 0611676a..4bc87368 100644 --- a/desktop/js/Monitoring.js +++ b/desktop/js/Monitoring.js @@ -57,7 +57,15 @@ function addCmdToTable(_cmd) { tr += ''; tr += ''; - if (['cron_status', 'uptime_sec', 'load_avg_1mn', 'load_avg_5mn', 'load_avg_15mn', 'memory_total', 'memory_used', 'memory_free', 'memory_buffcache', 'memory_available', 'memory_free_percent', 'memory_used_percent', 'memory_available_percent', 'swap_free_percent', 'swap_used_percent', 'swap_total', 'swap_used', 'swap_free', 'network_tx', 'network_rx', 'hdd_total', 'hdd_used', 'hdd_free', 'hdd_used_percent', 'hdd_free_percent', 'cpu_temp', 'perso1', 'perso2', 'perso3', 'perso4', 'syno_hddv2_total', 'syno_hddv2_used', 'syno_hddv2_free', 'syno_hddv2_used_percent', 'syno_hddv2_free_percent', 'syno_hddusb_total', 'syno_hddusb_used', 'syno_hddusb_used_percent', 'syno_hddusb_free', 'syno_hddusb_free_percent', 'syno_hddesata_total', 'syno_hddesata_used', 'syno_hddesata_used_percent', 'syno_hddesata_free', 'syno_hddesata_free_percent', 'asus_clients_total', 'asus_clients_wifi24', 'asus_clients_wifi5', 'asus_clients_wired', 'asus_fw_check', 'asus_wifi2g_temp', 'asus_wifi5g_temp'].includes(init(_cmd.logicalId))) { + // Liste des commandes de base pouvant être historisées + let historizedCommands = ['cron_status', 'uptime_sec', 'load_avg_1mn', 'load_avg_5mn', 'load_avg_15mn', 'memory_total', 'memory_used', 'memory_free', 'memory_buffcache', 'memory_available', 'memory_free_percent', 'memory_used_percent', 'memory_available_percent', 'swap_free_percent', 'swap_used_percent', 'swap_total', 'swap_used', 'swap_free', 'network_tx', 'network_rx', 'hdd_total', 'hdd_used', 'hdd_free', 'hdd_used_percent', 'hdd_free_percent', 'cpu_temp', 'perso1', 'perso2', 'perso3', 'perso4', 'syno_hddv2_total', 'syno_hddv2_used', 'syno_hddv2_free', 'syno_hddv2_used_percent', 'syno_hddv2_free_percent', 'syno_hddusb_total', 'syno_hddusb_used', 'syno_hddusb_used_percent', 'syno_hddusb_free', 'syno_hddusb_free_percent', 'syno_hddesata_total', 'syno_hddesata_used', 'syno_hddesata_used_percent', 'syno_hddesata_free', 'syno_hddesata_free_percent', 'asus_clients_total', 'asus_clients_wifi24', 'asus_clients_wifi5', 'asus_clients_wired', 'asus_fw_check', 'asus_wifi2g_temp', 'asus_wifi5g_temp']; + + // Vérifier si c'est une commande standard ou une commande de carte réseau supplémentaire + let canBeHistorized = historizedCommands.includes(init(_cmd.logicalId)) || + init(_cmd.logicalId).startsWith('network_tx_') || + init(_cmd.logicalId).startsWith('network_rx_'); + + if (canBeHistorized) { tr += ''; } tr += ''; @@ -161,6 +169,14 @@ document.querySelector(".eqLogicAttr[data-l2key='pull_use_custom']").addEventLis } }); +document.querySelector(".eqLogicAttr[data-l2key='multi_if']").addEventListener('change', function () { + if(this.checked){ + document.querySelector(".multi_if_conf").style.display = "block"; + } else { + document.querySelector(".multi_if_conf").style.display = "none"; + } +}); + document.querySelector(".eqLogicAttr[data-l2key='localoudistant']").addEventListener('change', function () { if (this.selectedIndex == 1) { document.querySelector(".distant").style.display = "block"; diff --git a/desktop/php/Monitoring.php b/desktop/php/Monitoring.php index fc473d9b..61e5f257 100644 --- a/desktop/php/Monitoring.php +++ b/desktop/php/Monitoring.php @@ -337,6 +337,20 @@
+
+ +
+ + ({{A cocher pour monitorer des cartes réseau supplémentaires}}) +
+
+
{{Statistiques}} : diff --git a/plugin_info/info.json b/plugin_info/info.json index 29156218..2e97459d 100644 --- a/plugin_info/info.json +++ b/plugin_info/info.json @@ -1,7 +1,7 @@ { "id": "Monitoring", "name": "Monitoring", - "pluginVersion": "3.1.18", + "pluginVersion": "3.2.1", "description": { "fr_FR": "Plugin permettant le monitoring des équipements locaux et distants (via SSH). Le plugin affichera les informations systèmes d'équipements sous Linux ou Synology (Distribution, CPU, Mémoire, Disques, Swap).", "en_US": "Plugin to monitor local and remote equipments (through SSH). The plugin will display system informations from Linux or Synology (Distribution, CPU, Memory, Disks, Swap).",