Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mactrack no longer maps IP's to mac's #204

Closed
jdcoats opened this issue Nov 3, 2023 · 27 comments
Closed

Mactrack no longer maps IP's to mac's #204

jdcoats opened this issue Nov 3, 2023 · 27 comments

Comments

@jdcoats
Copy link

jdcoats commented Nov 3, 2023

My Mactrack has been broken since i updated develop on 8/25. I did a manual run from cli on individual switch 9/29 and got IP mapped but otherwise it does not work through normal runs.
image

image

@jdcoats
Copy link
Author

jdcoats commented Dec 6, 2023

still leaving abended processes

# ps aux| grep mact
root      1457  0.0  0.0 134824 64608 ?        S    02:03   0:08 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root      2055  0.0  0.0 134824 64892 ?        S    Dec02   0:49 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root      3427  0.0  0.0 134824 64824 ?        S    Dec04   0:21 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root      3453  0.0  0.0 134824 64804 ?        S    Dec05   0:13 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root      4952  0.0  0.0 134824 64896 ?        S    Dec02   0:52 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root      5824  0.0  0.0 134824 64960 ?        S    Dec03   0:33 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root      6396  0.0  0.0 134824 64884 ?        S    Dec05   0:17 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root      7437 25.6  0.0 122792 52592 ?        S    14:06  61:52 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/poller_mactrack.php
root      8226  0.0  0.0 134824 62880 ?        S    14:06   0:02 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root      8873  0.0  0.0 134824 64988 ?        S    Dec03   0:37 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     10676  0.0  0.0 134824 65040 ?        S    Dec02   0:54 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     12783  0.0  0.0 134824 64940 ?        S    Dec02   0:46 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     13181  0.0  0.0 134824 64960 ?        S    Dec04   0:28 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     13235  0.0  0.0 134824 64784 ?        S    Dec01   0:58 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     13504  0.0  0.0 134824 64748 ?        S    Dec04   0:26 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     15065  0.0  0.0 134824 64760 ?        S    Dec05   0:12 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     15874  0.0  0.0 134824 64828 ?        S    Dec03   0:43 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     16694  0.0  0.0 134824 64716 ?        S    Dec05   0:09 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     18680  0.0  0.0 134824 64596 ?        S    Dec05   0:15 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     19345  0.1  0.0 116392 45732 ?        S    18:06   0:00 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/poller_mactrack.php
root     19707  0.0  0.0 134824 64880 ?        S    Dec02   0:50 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     21284  0.0  0.0   6716  2228 pts/6    S+   18:07   0:00 grep --colour=auto mact
root     22867  0.0  0.0 134824 64620 ?        S    06:04   0:06 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     24171  0.0  0.0 134824 63952 ?        S    10:05   0:04 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     24207  0.0  0.0 134824 64912 ?        S    Dec03   0:35 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     24483  0.0  0.0 134824 64844 ?        S    Dec04   0:24 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     24498  0.0  0.0 134824 64968 ?        S    Dec04   0:31 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     25009  0.0  0.0 134824 64936 ?        S    Dec04   0:18 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     25911  0.0  0.0 134824 64876 ?        S    Dec03   0:39 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     28284  0.0  0.0 134824 65012 ?        S    Dec02   0:57 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     30125  0.0  0.0 134824 64972 ?        S    Dec01   1:00 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     30943  0.0  0.0 134824 64996 ?        S    Dec03   0:44 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     31804  0.0  0.0 134824 64672 ?        S    Dec05   0:11 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php

and bailing out

2023/12/06 18:05:23 - CMDPHP ERROR: Device Tracking timed out during main script processing.

@jdcoats
Copy link
Author

jdcoats commented Dec 13, 2023

ive been adjusting timings trying to figure out what may or may not work and have noticed that when set to run every for hours the poller runs for 4 hours and then is killed when the next run starts. Likewise if i set it to 8hours the poller runs for 8hrs and is then killed when the next run starts. I get mapping of IP's to macs for roughly half of the switches but not all so its getting hung up somewhere and I have no idea how to find where.

@xmacan
Copy link
Member

xmacan commented Dec 18, 2023

Please show result of SQL command:
SELECT * FROM mac_track_processes

@jdcoats
Copy link
Author

jdcoats commented Dec 18, 2023

MariaDB [cacti]> SELECT * FROM mac_track_processes;
+-----------+------------+---------+---------------------+
| device_id | process_id | status  | start_date          |
+-----------+------------+---------+---------------------+
|         0 |      26586 | Running | 2023-12-18 10:42:20 |
+-----------+------------+---------+---------------------+
1 row in set (0.000 sec)

@xmacan
Copy link
Member

xmacan commented Dec 18, 2023

SELECT count() FROM mac_track_temp_ports WHERE ip_address != '' AND (dns_hostname = '' OR dns_hostname IS NULL);
SELECT count(
) FROM mac_track_temp_ports WHERE ip_address != '';

@xmacan
Copy link
Member

xmacan commented Dec 18, 2023

try to run resolve manually and show at least few lines of output:
php mactrack_resolver.php -d

@jdcoats
Copy link
Author

jdcoats commented Dec 18, 2023

MariaDB [cacti]> SELECT count('') FROM mac_track_temp_ports WHERE ip_address != '' AND (dns_hostname = '' OR dns_hostname IS NULL);
+-----------+
| count('') |
+-----------+
|         0 |
+-----------+
1 row in set (0.005 sec)
 # php mactrack_resolver.php -d
2023/12/18 11:20:22 - MACTRACK DEBUG: No IP's require resolving this pass
2023/12/18 11:20:25 - MACTRACK DEBUG: No IP's require resolving this pass
2023/12/18 11:20:28 - MACTRACK DEBUG: No IP's require resolving this pass
2023/12/18 11:20:31 - MACTRACK DEBUG: No IP's require resolving this pass
2023/12/18 11:20:34 - MACTRACK DEBUG: No IP's require resolving this pass
2023/12/18 11:20:38 - MACTRACK DEBUG: No IP's require resolving this pass
2023/12/18 11:20:41 - MACTRACK DEBUG: No IP's require resolving this pass
# ps aux | grep php
root      1167  0.0  0.0 134824 64908 ?        S    Dec13   0:40 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root      5462  0.0  0.0 134824 64872 ?        S    Dec17   0:11 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     10091  0.0  0.0 134824 64780 ?        S    Dec16   0:19 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     10570  0.0  0.0 134824 64860 ?        S    Dec15   0:22 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     11113  0.0  0.0 132776 62368 ?        S    02:41   0:03 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     13748  0.0  0.0 134824 65056 ?        S    Dec13   0:42 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     17593  0.0  0.0 134824 64848 ?        S    Dec16   0:14 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     17700  0.0  0.0 134824 64928 ?        S    Dec15   0:25 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     21724  0.0  0.0 132776 62344 ?        S    Dec17   0:05 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     23491  0.0  0.0 134824 64892 ?        S    Dec15   0:28 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     25283  0.0  0.0 134824 64856 ?        S    Dec16   0:17 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     25409  7.6  0.0 122792 52296 ?        R    10:42   1:15 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/poller_mactrack.php
root     26586  0.0  0.0 134824 62924 ?        S    10:42   0:00 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     26971  0.0  0.0 134824 65080 ?        S    Dec14   0:32 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     29830  0.0  0.0 134824 64968 ?        S    Dec14   0:36 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     30782  0.0  0.0 134824 64328 ?        S    Dec17   0:08 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php
root     32091  0.0  0.0 134824 64600 ?        S    Dec14   0:33 /usr/bin/php -q /var/www/localhost/htdocs/cacti/plugins/mactrack/mactrack_resolver.php

@xmacan
Copy link
Member

xmacan commented Dec 18, 2023

for now workaround - in file mactrack_resolver.php around line 154 is
mactrack_debug('No IP's require resolving this pass');
sleep(3);

change second line to
$break = true;

Let me know if it helps.

For my perspective - mactrack has a lot of unfinished work. I am not quickly able to tell if this is a bug or a feature. I will return here maybe in january.

@jdcoats
Copy link
Author

jdcoats commented Dec 19, 2023

okay i think I have figured out what part broken. It's only mapping IP's for devices in site id 2 but none of the other sites that have their own routers and mac tables work anymore. But yes the process control for the resolver is worked around :)

@TheWitness
Copy link
Member

If I remember correctly, we were going to work on that as a new feature.

@TheWitness
Copy link
Member

#151

@jdcoats
Copy link
Author

jdcoats commented Dec 19, 2023

The feature request was based on being able to say I'm in site A but my router is in site B and to be able to set that. In this case its always worked that Site A's router is in Site A and Site B's router is in site B. This normal functionality is only working for 1 site (first site ID) and none of the others.

@jdcoats
Copy link
Author

jdcoats commented Mar 6, 2024

#205 is fixed Thanks! We still have the situation where mactrack's IP to port mapping logic is no longer aware of which site it is in.

@xmacan
Copy link
Member

xmacan commented Mar 11, 2024

@jdcoats could you explain to me, where is problem with ip to port mapping logic?

@jdcoats
Copy link
Author

jdcoats commented Mar 11, 2024

I have many remote sites where the router and switch are both in the remote site. This means the Sites mac's and IP are seen in that site. Well the port mac addresses are shown in mactrack but no IP's or DNS names for those remote sites work.
remote site example with no IP's:
image
main site works/has IP's:
image

@jdcoats
Copy link
Author

jdcoats commented Mar 11, 2024

my example remote site, mactrack see's the IP's but does not corelate the data.
image

@xmacan
Copy link
Member

xmacan commented Mar 11, 2024

So this is still true? My Mactrack has been broken since i updated develop on 8/25. I did a manual run from cli on individual switch 9/29 and got IP mapped but otherwise it does not work through normal runs.

Maybe it isn't problem with data gathering but with cleaning/retention

@jdcoats
Copy link
Author

jdcoats commented Apr 17, 2024

Yes, see all of the IP's in all of the different sites?
image
but here there are no IP's
image
which results in no IP's for the sites
image

@xmacan
Copy link
Member

xmacan commented Apr 19, 2024

I will revise last code changes from that time

Did you change PHP version from 7 to 8 or upgrade SQL server at that time?

@jdcoats
Copy link
Author

jdcoats commented Apr 19, 2024

Yes I did, updated system, Cacti and plugins

 * dev-db/mariadb-10.6.14
        Emerged at: Fri Aug 25 14:40:22 2023
        Build time: 9 minutes, and 11 seconds
 * dev-lang/php-8.1.20-r1
        Emerged at: Fri Aug 25 14:59:24 2023
        Build time: 14 minutes

@jdcoats
Copy link
Author

jdcoats commented Apr 19, 2024

Sad that I don't know the date of the develop i had prior it could have been March or April so no way to be sure which changes broke it.

@xmacan
Copy link
Member

xmacan commented Apr 19, 2024

did you update php from php7 to php8?

@jdcoats
Copy link
Author

jdcoats commented Apr 19, 2024

I have both installed and i think that I was already switched to 8 by then, cant be sure it was a year ago :)

@xmacan
Copy link
Member

xmacan commented Apr 19, 2024

It seems that I broke it one year ago. @jdcoats please try comment or delete in file mactrack_scanner.php these lines:
if ($device['site_id'] != 0) {
$scan_date = date('Y-m-d H:i:s');
} else {
$scan_date = read_config_option('mt_scan_date');
}

And wait for matrack poller. It was added here:
212e823
It seems that I fixed here manual run but broke automatic.

@jdcoats
Copy link
Author

jdcoats commented Apr 19, 2024

next run is in about 20min I'll let you know :) Thanks!

@jdcoats
Copy link
Author

jdcoats commented Apr 19, 2024

I have IP's in the other sites now. Thank You! I've missed this feature for the last year. 👍

@xmacan
Copy link
Member

xmacan commented Apr 19, 2024

thank you for testing.
Closing

@xmacan xmacan closed this as completed Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants