Skip to content

New errors after sync of latest PR's #270

Open

Description

@jdcoats

@xxconn from my logs it looks like it started after grabbing the commits from the 19th. I am current today also though.

2026/01/22 09:22:45 - CMDPHP MAILER ERROR Backtrace: (/plugins/mactrack/poller_mactrack.php[278]:collect_mactrack_data(), /plugins/mactrack/poller_mactrack.php[980]:mactrack_process_mac_auth_report(), /plugins/mactrack/poller_mactrack.php[1063]:mactrack_mail(), /plugins/mactrack/lib/mactrack_functions.php[3316]:mailer(), /lib/functions.php[4984]:cacti_debug_backtrace())
2026/01/22 09:13:04 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/mactrack/mactrack_scanner.php[175]:get_IOS_dot1dTpFdbEntry_ports(), /plugins/mactrack/lib/mactrack_cisco.php[288]:build_InterfacesTable(), /plugins/mactrack/lib/mactrack_functions.php[751]:CactiErrorHandler())
2026/01/22 09:13:04 - 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: 751

Activity

  1. xxconn commented on Jan 23, 2026

    @xxconn
    Contributor

    @jdcoats

    About MAILER ERROR issue, would you see whether there are another general logs that mail sender or recipient weren’t configured. If you wouldn’t like to send email report, please disable it, or configure the necessary parameters.

    Another PHP WARNING, I also meet the same frequently, because there are some network issues (like network down suddenly or high bandwidth usage) or target device high cpu performance. I will fix this soon.

  2. jdcoats commented on Jan 23, 2026

    @jdcoats
    Author

    You mean these?
    2026/01/23 04:39:00 - SYSTEM WARNING: Primary Admin account notifications disabled! Unable to send administrative Email.
    I have now configured the report email.

  3. jdcoats commented on Jan 23, 2026

    @jdcoats
    Author

    Also notice that I cannot authorize macs. No matter if i select 1 or 1000 it never authorizes them and does not give an error or debug message

  4. xxconn commented on Jan 23, 2026

    @xxconn
    Contributor

    Could you post the screenshot of the ‘View MACs’ tab?

  5. jdcoats commented on Jan 25, 2026

    @jdcoats
    Author

    i cant get anything to show anymore after subsequent runs, I think i have to roll back.

  6. jdcoats commented on Jan 25, 2026

    @jdcoats
    Author

    queries got very slow hung up cacti and dont provide data

  7. jdcoats commented on Jan 25, 2026

    @jdcoats
    Author

    finally got a page to load

    Image
  8. xxconn commented on Jan 26, 2026

    @xxconn
    Contributor

    What version of Mactrack are you using?
    I'm using Version 4.8 and my pull request is under the 4.8
    I tried to show the most IP address's site (197 IPs), it need 3.857 sec

    MariaDB [cacti]> SELECT site_name, device_id, device_name, hostname, mtp.mac_address, vendor_name, ip_address, dns_hostname, port_number, port_name, vlan_id, vlan_name, MAX( scan_date) AS scan_date, mtm.mac_id FROM mac_track_ports AS mtp LEFT JOIN mac_track_sites AS mts ON mtp.site_id = mts.site_id LEFT JOIN mac_track_macauth AS mtm ON mtm.mac_a ddress = mtp.mac_address LEFT JOIN mac_track_oui_database AS mtod ON mtod.vendor_mac = mtp.vendor_mac WHERE mtp.site_id = 202 GROUP BY device_id, mtp.mac_address, port_numbe r, ip_address ORDER BY site_name ASC LIMIT 0,100;
    100 rows in set (3.857 sec)

  9. jdcoats commented on Jan 26, 2026

    @jdcoats
    Author

    your PR's are all going into develop which is 4.9

    site with 190 IP's = 100 rows in set (16.976 sec)
    site with 478 IP's = 100 rows in set (31.164 sec)
    site with 16,343 IP's = 100 rows in set (2 min 25.433 sec)

  10. xxconn commented on Jan 26, 2026

    @xxconn
    Contributor

    Could you tell me which version you rolled back? I just want to check what different about the SQL query statements with 4.9.

  11. jdcoats commented on Jan 26, 2026

    @jdcoats
    Author

    i didn't roll anything back, I'm still running current Develop 4.9

  12. jdcoats commented on Jan 26, 2026

    @jdcoats
    Author

    maybe my 8month data retention is to much?

    MariaDB [(none)]> SELECT
        TABLE_NAME AS `Table`,
        ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024), 2) AS `Size (MB)`
    FROM
        information_schema.TABLES
    WHERE
        TABLE_SCHEMA = 'cacti'
    AND
        TABLE_NAME = 'mac_track_ips';
    +---------------+-----------+
    | Table         | Size (MB) |
    +---------------+-----------+
    | mac_track_ips |  13515.91 |
    +---------------+-----------+
    1 row in set (0.000 sec)
    
    MariaDB [(none)]> SELECT
        TABLE_NAME AS `Table`,
        ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024), 2) AS `Size (MB)`
    FROM
        information_schema.TABLES
    WHERE
        TABLE_SCHEMA = 'cacti'
    AND
        TABLE_NAME = 'mac_track_ports';
    +-----------------+-----------+
    | Table           | Size (MB) |
    +-----------------+-----------+
    | mac_track_ports |  16072.81 |
    +-----------------+-----------+
    1 row in set (0.000 sec)
    
  13. TheWitness commented on Jan 26, 2026

    @TheWitness
    Member
    SHOW CREATE TABLE mac_track_ports;
    SHOW CREATE TABLE mac_track_ips;

    They should be partitioned to ensure they can be dropped as they age out over having to delete and then constantly have to optimize those tables over time.

    @xxconn, something to put on the list.

  14. TheWitness commented on Jan 26, 2026

    @TheWitness
    Member

    Then, apply a time range on the IP query to read from only a single or maybe just two partitions.

  15. jdcoats commented on Jan 26, 2026

    @jdcoats
    Author
    | mac_track_ports | CREATE TABLE `mac_track_ports` (
      `site_id` int(10) unsigned NOT NULL DEFAULT 0,
      `device_id` int(10) unsigned NOT NULL DEFAULT 0,
      `hostname` varchar(40) NOT NULL DEFAULT '',
      `device_name` varchar(100) NOT NULL DEFAULT '',
      `vlan_id` varchar(5) NOT NULL DEFAULT 'N/A',
      `vlan_name` varchar(50) NOT NULL DEFAULT '',
      `mac_address` varchar(20) NOT NULL DEFAULT '',
      `vendor_mac` varchar(8) DEFAULT '',
      `ip_address` varchar(20) NOT NULL DEFAULT '',
      `dns_hostname` varchar(200) DEFAULT '',
      `port_number` varchar(30) NOT NULL DEFAULT '',
      `port_name` varchar(50) NOT NULL DEFAULT '',
      `scan_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
      `authorized` tinyint(3) unsigned NOT NULL DEFAULT 0,
      PRIMARY KEY (`port_number`,`scan_date`,`mac_address`,`device_id`),
      KEY `site_id` (`site_id`),
      KEY `scan_date` (`scan_date`) USING BTREE,
      KEY `description` (`device_name`),
      KEY `mac` (`mac_address`),
      KEY `hostname` (`hostname`),
      KEY `vlan_name` (`vlan_name`),
      KEY `vlan_id` (`vlan_id`),
      KEY `device_id` (`device_id`),
      KEY `ip_address` (`ip_address`),
      KEY `port_name` (`port_name`),
      KEY `dns_hostname` (`dns_hostname`),
      KEY `vendor_mac` (`vendor_mac`),
      KEY `authorized` (`authorized`),
      KEY `site_id_device_id` (`site_id`,`device_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='Database for Tracking Device MACs' |
    
    | mac_track_ips | CREATE TABLE `mac_track_ips` (
      `site_id` int(10) unsigned NOT NULL DEFAULT 0,
      `device_id` int(10) unsigned NOT NULL DEFAULT 0,
      `hostname` varchar(40) NOT NULL DEFAULT '',
      `device_name` varchar(100) NOT NULL DEFAULT '',
      `port_number` varchar(30) NOT NULL DEFAULT '',
      `mac_address` varchar(20) NOT NULL DEFAULT '',
      `ip_address` varchar(20) NOT NULL DEFAULT '',
      `dns_hostname` varchar(200) DEFAULT '',
      `scan_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
      PRIMARY KEY (`scan_date`,`ip_address`,`mac_address`,`site_id`),
      KEY `ip` (`ip_address`),
      KEY `port_number` (`port_number`),
      KEY `mac` (`mac_address`),
      KEY `device_id` (`device_id`),
      KEY `site_id` (`site_id`),
      KEY `hostname` (`hostname`),
      KEY `scan_date` (`scan_date`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC |
    
  16. TheWitness commented on Jan 26, 2026

    @TheWitness
    Member

    Okay, making them partitioned could take a while to 'reorganize' the data. I'll leave that to @xxconn if he's able.

  17. xxconn commented on Jan 26, 2026

    @xxconn
    Contributor

    @TheWitness
    I'm not sure what that you said means. ‘Reorganized’ ?

  18. TheWitness commented on Jan 26, 2026

    @TheWitness
    Member

    ALTER TABLE REORGANIZE...

  19. xxconn commented on Jan 27, 2026

    @xxconn
    Contributor

    I reviewed the screenshot jdcoats posted. I think it will scan all mac_track_ports for the result when the filter of scan date is ‘Most Recent’ and only ‘Site Name’. It seems it will spend much time for long period data.

    I have some suggestions:

    1. The table with long period or bulk data should be patitioed.
    2. Delete the age out data daily (mac_track_ports, mac_track_ips, mac_track_aggregated_ports)
    3. In the ‘View Mac’ tab, scan date ‘Most Recent’ read data from mac_track_aggregated_ports. I wrote a script to display one site’s ’recent’ or ‘today’ data. Maybe it can be used in MacTrack web ui.
    4. Add a new filter ‘timespan’ (From ‘date’ To ‘date) to read data from mac_track_ports. But it will still spend much time to query because MacTrack poller collect and write data every interval.
  20. xxconn commented on Jan 27, 2026

    @xxconn
    Contributor

    This is my script to list 'Most Recent' data that I expected:

    SELECT ip_address,t1.mac_address,hostname,port_number,port_name,vlan_id,date_last
    FROM mac_track_aggregated_ports t1
    WHERE site_id={site_id}
    AND ip_address <> ''
    AND date_last=(
    SELECT MAX(t2.date_last)
    FROM mac_track_aggregated_ports t2
    WHERE t1.ip_address=t2.ip_address
    )
    ORDER BY inet_aton(ip_address)

  21. xxconn commented on Jan 27, 2026

    @xxconn
    Contributor

    This is the info of my site.

    MariaDB [cacti]> SELECT
    -> TABLE_NAME AS Table,
    -> ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024), 2) AS Size (MB)
    -> FROM
    -> information_schema.TABLES
    -> WHERE
    -> TABLE_SCHEMA = 'cacti'
    -> AND
    -> TABLE_NAME = 'mac_track_ips';
    +---------------+-----------+
    | Table | Size (MB) |
    +---------------+-----------+
    | mac_track_ips | 3739.04 |
    +---------------+-----------+
    1 row in set (0.000 sec)

    MariaDB [cacti]> SELECT
    -> TABLE_NAME AS Table,
    -> ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024), 2) AS Size (MB)
    -> FROM
    -> information_schema.TABLES
    -> WHERE
    -> TABLE_SCHEMA = 'cacti'
    -> AND
    -> TABLE_NAME = 'mac_track_ports';
    +-----------------+-----------+
    | Table | Size (MB) |
    +-----------------+-----------+
    | mac_track_ports | 8286.14 |
    +-----------------+-----------+
    1 row in set (0.000 sec)

    | mac_track_ports | CREATE TABLE mac_track_ports (
    site_id int(10) unsigned NOT NULL DEFAULT 0,
    device_id int(10) unsigned NOT NULL DEFAULT 0,
    hostname varchar(40) NOT NULL DEFAULT '',
    device_name varchar(100) NOT NULL DEFAULT '',
    vlan_id varchar(5) NOT NULL DEFAULT 'N/A',
    vlan_name varchar(50) NOT NULL DEFAULT '',
    mac_address varchar(20) NOT NULL DEFAULT '',
    vendor_mac varchar(8) DEFAULT NULL,
    ip_address varchar(20) NOT NULL DEFAULT '',
    dns_hostname varchar(200) DEFAULT '',
    port_number varchar(30) NOT NULL DEFAULT '',
    port_name varchar(50) NOT NULL DEFAULT '',
    scan_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    authorized tinyint(3) unsigned NOT NULL DEFAULT 0,
    PRIMARY KEY (port_number,scan_date,mac_address,device_id),
    KEY site_id (site_id),
    KEY scan_date (scan_date) USING BTREE,
    KEY description (device_name),
    KEY mac (mac_address),
    KEY hostname (hostname),
    KEY vlan_name (vlan_name),
    KEY vlan_id (vlan_id),
    KEY device_id (device_id),
    KEY ip_address (ip_address),
    KEY port_name (port_name),
    KEY dns_hostname (dns_hostname),
    KEY vendor_mac (vendor_mac),
    KEY authorized (authorized),
    KEY site_id_device_id (site_id,device_id)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Database for Tracking Device MACs'
    PARTITION BY RANGE (to_days(scan_date))
    (PARTITION d20251228 VALUES LESS THAN (739979) ENGINE = MyISAM,
    PARTITION d20251229 VALUES LESS THAN (739980) ENGINE = MyISAM,
    PARTITION d20251230 VALUES LESS THAN (739981) ENGINE = MyISAM,
    PARTITION d20251231 VALUES LESS THAN (739982) ENGINE = MyISAM,
    PARTITION d20260101 VALUES LESS THAN (739983) ENGINE = MyISAM,
    PARTITION d20260102 VALUES LESS THAN (739984) ENGINE = MyISAM,
    PARTITION d20260103 VALUES LESS THAN (739985) ENGINE = MyISAM,
    PARTITION d20260104 VALUES LESS THAN (739986) ENGINE = MyISAM,
    PARTITION d20260105 VALUES LESS THAN (739987) ENGINE = MyISAM,
    PARTITION d20260106 VALUES LESS THAN (739988) ENGINE = MyISAM,
    PARTITION d20260107 VALUES LESS THAN (739989) ENGINE = MyISAM,
    PARTITION d20260108 VALUES LESS THAN (739990) ENGINE = MyISAM,
    PARTITION d20260109 VALUES LESS THAN (739991) ENGINE = MyISAM,
    PARTITION d20260110 VALUES LESS THAN (739992) ENGINE = MyISAM,
    PARTITION d20260111 VALUES LESS THAN (739993) ENGINE = MyISAM,
    PARTITION d20260112 VALUES LESS THAN (739994) ENGINE = MyISAM,
    PARTITION d20260113 VALUES LESS THAN (739995) ENGINE = MyISAM,
    PARTITION d20260114 VALUES LESS THAN (739996) ENGINE = MyISAM,
    PARTITION d20260115 VALUES LESS THAN (739997) ENGINE = MyISAM,
    PARTITION d20260116 VALUES LESS THAN (739998) ENGINE = MyISAM,
    PARTITION d20260117 VALUES LESS THAN (739999) ENGINE = MyISAM,
    PARTITION d20260118 VALUES LESS THAN (740000) ENGINE = MyISAM,
    PARTITION d20260119 VALUES LESS THAN (740001) ENGINE = MyISAM,
    PARTITION d20260120 VALUES LESS THAN (740002) ENGINE = MyISAM,
    PARTITION d20260121 VALUES LESS THAN (740003) ENGINE = MyISAM,
    PARTITION d20260122 VALUES LESS THAN (740004) ENGINE = MyISAM,
    PARTITION d20260123 VALUES LESS THAN (740005) ENGINE = MyISAM,
    PARTITION d20260124 VALUES LESS THAN (740006) ENGINE = MyISAM,
    PARTITION d20260125 VALUES LESS THAN (740007) ENGINE = MyISAM,
    PARTITION d20260126 VALUES LESS THAN (740008) ENGINE = MyISAM,
    PARTITION dMaxValue VALUES LESS THAN MAXVALUE ENGINE = MyISAM) |

    | mac_track_ips | CREATE TABLE mac_track_ips (
    site_id int(10) unsigned NOT NULL DEFAULT 0,
    device_id int(10) unsigned NOT NULL DEFAULT 0,
    hostname varchar(40) NOT NULL DEFAULT '',
    device_name varchar(100) NOT NULL DEFAULT '',
    port_number varchar(10) NOT NULL DEFAULT '',
    mac_address varchar(20) NOT NULL DEFAULT '',
    ip_address varchar(20) NOT NULL DEFAULT '',
    dns_hostname varchar(200) DEFAULT '',
    scan_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    PRIMARY KEY (scan_date,ip_address,mac_address,site_id),
    KEY ip (ip_address),
    KEY port_number (port_number),
    KEY mac (mac_address),
    KEY device_id (device_id),
    KEY site_id (site_id),
    KEY hostname (hostname),
    KEY scan_date (scan_date)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci |

    The retentation of the table mac_track_ports is 30 days.
    The retentation of the table mac_track_ips is 7 days.

    FYI

  22. TheWitness commented on Jan 27, 2026

    @TheWitness
    Member

    Note, from a code perspective:.

    1. Always have tomorrow partition created
    2. Create/Drop the partitions at midnight.
    3. Example API in Syslog plugin.
    4. That API needs to be updated to do 1).
  23. somethingwithproof commented on Nov 9, 2026

    @somethingwithproof
    Member

    The location history and alert proposals in #414 depend on this partitioning work landing first.

  24. somethingwithproof commented on Nov 9, 2026

    @somethingwithproof
    Member

    Proposed partition lifecycle, following the outline above: daily partitions with tomorrow's always created in advance, and old ones dropped at midnight using the Syslog plugin's partition code.

    flowchart TD
      upg["Plugin upgrade"] --> isp{"mac_track_ips already<br/>partitioned by day?"}
      isp -- "No" --> conv["Rebuild as daily partitions,<br/>keeping existing rows"]
      isp -- "Yes" --> run
      conv --> run
      run["First poller run after midnight"] --> tom{"Partition for<br/>tomorrow exists?"}
      tom -- "No" --> mk["Create tomorrow's partition"]
      tom -- "Yes" --> old
      mk --> old{"Partitions older than<br/>the retention setting?"}
      old -- "Yes" --> drop["Drop them"]
      old -- "No" --> done["Done"]
      drop --> done
    
    Loading

    The location history and alert proposals in #414 read from this table, so they wait for this change.

  25. somethingwithproof commented on Nov 12, 2026

    @somethingwithproof
    Member

    The Undefined array key warning from build_InterfacesTable() in the original report was fixed by #271, which guards the $ifOperStatus[$ifIndex] lookups. This issue stays open for the mac_track_ips partitioning work above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions