Cacti / plugin_mactrack

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

Changing device type sometimes create a duplicate entry #132

Closed vKnmnn closed 3 years ago

vKnmnn commented 4 years ago

I'm trying to configure Mactrack

i have some device types set up without the snmp vendor SNMP Object id match set. after that entry is created, if i change that value to .1.3.6.1.2.1.1.1.0 and hit save, i have two entries in the device type list, but the're linking to the same device_type ID. If i delete one of the entries, both entries disappear.

Same goes for creating a duplicate device type entry on purpose. Create a duplicate on purpose, give it a name. after creation change SNMP Vendor Object setting and hit save, you will have two entries now. image

vKnmnn commented 4 years ago

i believe this has somehow to do with the somewhat unintuitive definition of this table.

+-------------------------+------------------+------+-----+---------+----------------+
| Field                   | Type             | Null | Key | Default | Extra          |
+-------------------------+------------------+------+-----+---------+----------------+
| device_type_id          | int(10) unsigned | NO   | MUL | NULL    | auto_increment |
| description             | varchar(100)     | NO   |     |         |                |
| vendor                  | varchar(40)      | NO   |     |         |                |
| device_type             | varchar(10)      | NO   | PRI | 0       |                |
| sysDescr_match          | varchar(20)      | NO   | PRI |         |                |
| sysObjectID_match       | varchar(40)      | NO   | PRI |         |                |
| scanning_function       | varchar(100)     | NO   |     |         |                |
| ip_scanning_function    | varchar(100)     | NO   |     |         |                |
| dot1x_scanning_function | varchar(100)     | NO   |     |         |                |
| serial_number_oid       | varchar(100)     | YES  |     | NULL    |                |
| lowPort                 | int(10) unsigned | NO   |     | 0       |                |
| highPort                | int(10) unsigned | NO   |     | 0       |                |
+-------------------------+------------------+------+-----+---------+----------------+
+----------------+-----------------------+--------+-------------+----------------------+--------------------+------------------------------+-----------------------------+-------------------------+-------------------+---------+----------+
| device_type_id | description           | vendor | device_type | sysDescr_match       | sysObjectID_match  | scanning_function            | ip_scanning_function        | dot1x_scanning_function | serial_number_oid | lowPort | highPort |
+----------------+-----------------------+--------+-------------+----------------------+--------------------+------------------------------+-----------------------------+-------------------------+-------------------+---------+----------+
|              7 | 24 Port PoE Switch(0) | HP     | 1           | --dup--HP J9772A 253 | --dup--            | get_procurve_ng_switch_ports | Not Applicable - Switch/Hub | 0                       | NULL              |       0 |        0 |
|              7 | 24 Port PoE Switch    | HP     | 1           | HP J9772A 253        | .1.3.6.1.2.1.1.1.0 | get_procurve_ng_switch_ports | Not Applicable - Switch/Hub | 0                       |                   |       0 |        0 |
+----------------+-----------------------+--------+-------------+----------------------+--------------------+------------------------------+-----------------------------+-------------------------+-------------------+---------+----------+
vKnmnn commented 4 years ago

There is #130 that supposedly fixes this but i can'T confirm that it does.

TheWitness commented 3 years ago

I don't think it fixes it as that is not part of the create table syntax, or at least I don't think so.

TheWitness commented 3 years ago

I've fixed this now, but if you are already using version 4.4, you will have to back off a release to apply the fix. They way you will do that is by running this SQL first:

UPDATE plugin_config SET version='4.3' WHERE directory='mactrack';
vKnmnn commented 3 years ago

I no longer work at the company where i had this running. will close.