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

collector_cmd seems to force /usr/sbin prefix #199

Closed
growly opened this issue Jul 8, 2024 · 3 comments
Closed

collector_cmd seems to force /usr/sbin prefix #199

growly opened this issue Jul 8, 2024 · 3 comments

Comments

@growly
Copy link

growly commented Jul 8, 2024

Not sure why this is happening, whether it's to do with how the user is set up (PATH) or whether it's part of this codebase, but in trying to force sudo collection on Debian 12.0 it seems as if ipmi_exporter tries to force /usr/sbin/ as a prefix for the command.

Here's my ipmi_local.yml:

modules:
        default:
                # Available collectors are bmc, ipmi, chassis, dcmi, sel, and sm-lan-mode
                collectors:
                - bmc
                - ipmi
                - dcmi
                - chassis
                - sel
                # Got any sensors you don't care about? Add them here.
                exclude_sensor_ids:
                - 2
                - 29
                - 32
                collector_cmd:
                  bmc: sudo
                  ipmi: sudo
                  dcmi: sudo
                  chassis: sudo
                  sel: sudo
                custom_args:
                  bmc:
                  - "/usr/sbin/bmc-info"
                  ipmi:
                  - "/usr/sbin/ipmimonitoring"
                  sel:
                  - "/usr/sbin/ipmi-sel"
                  dcmi:
                  - "/usr/sbin/ipmi-dcmi"
                  chassis:
                  - "/usr/sbin/ipmi-chassis"
                  sel:
                  - "/usr/sbin/ipmi-sel"

With this I get the following error deep in syslog:
Failed to collect SEL data" target=[local] error="error running /usr/sbin/sudo: fork/exec /usr/sbin/sudo: no such file or directory:

Fair enough, my sudo lives in /usr/bin and there's no link from /usr/sbin.

So I tried making it an absolute path:

                collector_cmd:
                  ipmi: /usr/bin/sudo

But then I get this!

Failed to collect sensor data" target=[local] error="error running /usr/sbin/usr/bin/sudo: fork/exec /usr/sbin/usr/bin/sudo: no such file or directory: 

The fix is to add a symlink from /usr/sbin/sudo to /usr/bin/sudo, but that's not gonna work out of the box. Seems like this is surprising behaviour for specifying a an absolute command.

Don't have a moment to find the culprit in the codebase so sorry I can't do more of my own homework. Thought I'd report the issue anyway.

@bitfehler
Copy link
Contributor

This is caused by a patch that Debian applies, see #153 for all the details if you care 🙂

I think the workaround would currently be to start the exporter with --freeipmi.path=/usr/bin and use just sudo in the config file. The fact that the prefix gets added to an absolute path seems a bit silly indeed, I'll take a look at that.

@bitfehler
Copy link
Contributor

In the next release, your totally correct approach of setting the collector_cmd to /usr/bin/sudo should also work.

@growly
Copy link
Author

growly commented Jul 9, 2024

tysm 🙏

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