Cacti / plugin_mactrack

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

Port no and Port name not showing in Mac Address Tab #162

Closed ngchch2013 closed 11 months ago

ngchch2013 commented 3 years ago

Using Cacti 1.2.4 and MacTrack 4.4, everything is work fine but only in MAC Address tab, no Port Number and Port Name is displaying, Port Number field is "0" and Port Name is empty.

Device type is C2960X, MAC Address Scanning Function is using get_IOS_dot1dTpFdbEntry_ports.

JoeyChen-NTUT commented 2 years ago

--- 4.3 / 4.4 --- feature: Switch port_number to integer type of performance reasons

Seen is change by dev teams but We Still Needs real port number for some like Cisco Netgear...etc has like 1/0/1 interface name

Update: all in column are show 0 not mapping to mac_track_interfaces but mac_track_ips had port_number...

jdcoats commented 2 years ago

This is working fine for me. Port number and port name are correct.

JoeyChen-NTUT commented 2 years ago

This is working fine for me. Port number and port name are correct.

What device are you using? I'm use Cisco Device and it's didn't work

jdcoats commented 2 years ago

all Cisco switches

JoeyChen-NTUT commented 2 years ago

all Cisco switches

In my environment had more than 300 Cisco device since 2950 to 9500 there isn't have any result of device has port_number
image

There is my Device Type Setting image

Any idea for help me with it thanks.

TheWitness commented 2 years ago

You guys should compare schemas. Maybe port_num was converted to integer, which would cause this issue.

jdcoats commented 2 years ago
MariaDB [cacti]> describe mac_track_ports;
+--------------+---------------------+------+-----+---------------------+-------+
| Field        | Type                | Null | Key | Default             | Extra |
+--------------+---------------------+------+-----+---------------------+-------+
| site_id      | int(10) unsigned    | NO   | MUL | 0                   |       |
| device_id    | int(10) unsigned    | NO   | PRI | 0                   |       |
| hostname     | varchar(40)         | NO   | MUL |                     |       |
| device_name  | varchar(100)        | NO   | MUL |                     |       |
| vlan_id      | varchar(5)          | NO   | MUL | N/A                 |       |
| vlan_name    | varchar(50)         | NO   | MUL |                     |       |
| mac_address  | varchar(20)         | NO   | PRI |                     |       |
| vendor_mac   | varchar(8)          | YES  | MUL |                     |       |
| ip_address   | varchar(20)         | NO   | MUL |                     |       |
| dns_hostname | varchar(200)        | YES  | MUL |                     |       |
| port_number  | varchar(20)         | NO   | PRI |                     |       |
| port_name    | varchar(50)         | NO   | MUL |                     |       |
| scan_date    | timestamp           | NO   | PRI | 0000-00-00 00:00:00 |       |
| authorized   | tinyint(3) unsigned | NO   | MUL | 0                   |       |
+--------------+---------------------+------+-----+---------------------+-------+
14 rows in set (0.002 sec)
jdcoats commented 2 years ago

Also, if you would like to separate device types you can do it like this. image

TheWitness commented 2 years ago

That image takes me back to 2006 when MacTrack was so fresh. You look at it and it seems just a tiny plugin, but when populated with a few k hosts and 40 odd sites, it's marvelous.

JoeyChen-NTUT commented 2 years ago

You guys should compare schemas. Maybe port_num was converted to integer, which would cause this issue.

Yes, I think it's root cause
I just install the latest version from dev branch and my DB port_number column schemas it's integer
so the current schemas it's varchar??

jdcoats commented 2 years ago

@TheWitness You've been doing good work a long time 🥇

TheWitness commented 2 years ago

Oh boy, maybe not. Keep this bug open...

TheWitness commented 2 years ago

Just run the alter to make it varchar.

JoeyChen-NTUT commented 2 years ago

Just run the alter to make it varchar. --- 4.3 / 4.4 --- feature: Switch port_number to integer type of performance reasons

https://github.com/Cacti/plugin_mactrack/commit/92e8b5d4fc4394ca869a4e28124a6f8bd1df8694

so did I need to change back to varchar? for fix this issue?

TheWitness commented 2 years ago

Shame on me. But I coding blind. I have a bunch of Mikrotiks in the house though.

JoeyChen-NTUT commented 2 years ago

Shame on me. But I coding blind. I have a bunch of Mikrotiks in the house though.

and it's issue has inconsistent schema with sql file and mactrack_convert(https://github.com/Cacti/plugin_mactrack/blob/develop/mactrack_convert.php) in line 125

TheWitness commented 11 months ago

Fixed.