NetDB – Data too long for column ‘vendor’
We still use NetDB as a troubleshooting tool. It can quickly identify what switch and vlan a MAC address is on. I also heavily use it for checking the last time a MAC address was seen on the network and for cleaning up old DNS entries.
Anyway, I recently migrated NetDB to RHEL8 and discovered a new error while testing.
Database Transaction Error (MAC): Update Failure in mac for d49e.3bxx.xxxx: Data too long for column 'vendor' at row 1
NetDB has a cronjob setup that downloads an updated MAC Vendor Database every month. You can grep that file for failing MAC address.
$ cat /opt/netdb/data/oui.txt | grep D4-9E-3B
D4-9E-3B (hex) Guangzhou Shiyuan Electronic Technology Company Limited
NetDB could update that table to support more characters. However, the program is not really supported anymore and has not seen updates in a long time. A simple work around for this error is to just shorten this company name when the file is downloaded.
This is my new cronjob that does just that. I think this is a pretty basic, but cool example of what sed can do.
0 5 15 * * wget -q -O - http://standards-oui.ieee.org/oui.txt | sed 's/Guangzhou Shiyuan Electronic Technology Company Limited/Guangzhou Shiyuan Electronic Technology/' > /opt/netdb/data/oui.txt
Now when the new oui.txt is downloaded the MAC address vendor can be properly added to the table.
$ cat /opt/netdb/data/oui.txt | grep D4-9E-3B
D4-9E-3B (hex) Guangzhou Shiyuan Electronic Technology
It is not perfect and can break again if we run into another long vendor name.
I am happy with it for now.