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

RFE: The path to the pci.ids database should be configurable by a command line switch #377

Closed
siebenmann opened this issue Apr 8, 2024 · 3 comments

Comments

@siebenmann
Copy link
Contributor

decoder/pci.go currently hard-codes the file of the PCI IDs database to /usr/share/misc/pci.ids. However, not all Linux distributions put it in that location; Fedora places it in /usr/share/hwdata/pci.ids, and I believe this is followed by current versions of Red Hat Enterprise/CentOS/etc (it is certainly the case on CentOS 7). A command line switch would allow this to be adjusted on a system by system basis, and also allow people to substitute their own more up to date PCI ID databases on older versions of long term support releases that may have old ones.

Based on a quick look at the code this might require significant restructuring, since the in-program PCI database is currently initialized in an init() function (which also means it's loaded immediately on program startup, whether or not it will be needed by any program configured). I suspect such a restructuring is best undertaken by a core author who has a solid idea of how the result should fit into the exporter's overall structure and usage of its modules.

@bobrik
Copy link
Contributor

bobrik commented Apr 8, 2024

We can do an ordered lookup with the first available file being used:

  1. --config.dir — a user can place an updated db file or a symlink there
  2. /usr/share/misc/pci.ids for Debian/Ubuntu
  3. /usr/share/hwdata/pci.ids For Fedora/RedHat/CentOS

This way there wouldn't be a need for a major code restructuring and thing would work out of the box for most users with no need to introduce any new command line arguments.

@bobrik
Copy link
Contributor

bobrik commented Apr 9, 2024

--config.dir — a user can place an updated db file or a symlink there

This wouldn't work in init().

bobrik added a commit to bobrik/ebpf_exporter that referenced this issue Apr 17, 2024
@bobrik
Copy link
Contributor

bobrik commented Apr 19, 2024

I added support for /usr/share/hwdata/pci.ids, which feels like should cover 99% of the cases. Let me know if you think otherwise.

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

2 participants