Cacti / plugin_mactrack

Mactrack Plugin for Cacti
GNU General Public License v2.0
12 stars 24 forks source link

Undefined array key 2 in file: mactrack_functions.php on line: 753 #205

Closed jdcoats closed 4 months ago

jdcoats commented 4 months ago
2024/02/14 14:51:25 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/mactrack/mactrack_scanner.php[171]:get_IOS_dot1dTpFdbEntry_ports(), /plugins/mactrack/lib/mactrack_cisco.php[301]:build_InterfacesTable(), /plugins/mactrack/lib/mactrack_functions.php[753]:CactiErrorHandler())
2024/02/14 14:51:25 - ERROR PHP WARNING in Plugin 'mactrack': Undefined array key 2 in file: /var/www/localhost/htdocs/cacti/plugins/mactrack/lib/mactrack_functions.php on line: 753
jdcoats commented 4 months ago

and then a pile of these probably the reason for #204

2024/02/14 15:09:43 - CMDPHP SQL Backtrace: (/plugins/mactrack/mactrack_scanner.php[171]:get_IOS_dot1dTpFdbEntry_ports(), /plugins/mactrack/lib/mactrack_cisco.php[483]:db_store_device_port_results(), /plugins/mactrack/lib/mactrack_functions.php[2302]:db_execute_prepared())
2024/02/14 15:09:43 - CMDPHP ERROR: A DB Exec Failed!, Error: MySQL server has gone away
2024/02/14 15:09:43 - CMDPHP SQL Backtrace: (/plugins/mactrack/mactrack_scanner.php[171]:get_IOS_dot1dTpFdbEntry_ports(), /plugins/mactrack/lib/mactrack_cisco.php[483]:db_store_device_port_results(), /plugins/mactrack/lib/mactrack_functions.php[2274]:db_check_auth(), /plugins/mactrack/lib/mactrack_functions.php[2317]:db_fetch_cell_prepared(), /lib/database.php[598]:db_execute_prepared())
2024/02/14 15:09:43 - CMDPHP ERROR: A DB Cell Failed!, Error: MySQL server has gone away
xmacan commented 4 months ago

Error: MySQL server has gone away - It isn't cacti issue. check mysql server log SHOW GLOBAL VARIABLES LIKE 'max_connections'; SHOW GLOBAL STATUS LIKE 'max_used%';

jdcoats commented 4 months ago

Its a mactrack problem, mysql isnt really going away.

MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'max_connections';
SHOW GLOBAL STATUS LIKE 'max_used%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 1000  |
+-----------------+-------+
1 row in set (0.001 sec)

+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| Max_used_connections | 498   |
+----------------------+-------+
1 row in set (0.000 sec)
xmacan commented 4 months ago

Try to change in lib/mactrack_functions.php ling 753: if ($ifOperStatus[$ifIndex] == 1) { to if (isset($ifOperStatus[$ifIndex]) && $ifOperStatus[$ifIndex] == 1) {

Do you have php 8.x?

TheWitness commented 4 months ago

I think we need a wrapper function to accommodate the unset variables since @ does not work like it used to. That's a fairly big project.